mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 11:24:49 -05:00
Simplify getConvertibleFieldAtPosition (#23315)
This commit is contained in:
@@ -879,6 +879,7 @@ namespace ts {
|
||||
|
||||
export interface PropertyDeclaration extends ClassElement, JSDocContainer {
|
||||
kind: SyntaxKind.PropertyDeclaration;
|
||||
parent: ClassLikeDeclaration;
|
||||
name: PropertyName;
|
||||
questionToken?: QuestionToken; // Present for use with reporting a grammar error
|
||||
exclamationToken?: ExclamationToken;
|
||||
|
||||
@@ -3037,6 +3037,10 @@ namespace ts {
|
||||
return (node as HasType).type || (isInJavaScriptFile(node) ? getJSDocType(node) : undefined);
|
||||
}
|
||||
|
||||
export function getTypeAnnotationNode(node: Node): TypeNode | undefined {
|
||||
return (node as HasType).type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the effective return type annotation of a signature. If the node was parsed in a
|
||||
* JavaScript file, gets the return type annotation from JSDoc.
|
||||
@@ -4271,8 +4275,9 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function isParameterPropertyDeclaration(node: Node): node is ParameterDeclaration {
|
||||
return hasModifier(node, ModifierFlags.ParameterPropertyModifier) && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent);
|
||||
export type ParameterPropertyDeclaration = ParameterDeclaration & { parent: ConstructorDeclaration, name: Identifier };
|
||||
export function isParameterPropertyDeclaration(node: Node): node is ParameterPropertyDeclaration {
|
||||
return hasModifier(node, ModifierFlags.ParameterPropertyModifier) && node.parent.kind === SyntaxKind.Constructor;
|
||||
}
|
||||
|
||||
export function isEmptyBindingPattern(node: BindingName): node is BindingPattern {
|
||||
|
||||
Reference in New Issue
Block a user