Simplify getConvertibleFieldAtPosition (#23315)

This commit is contained in:
Andy
2018-04-16 09:30:10 -07:00
committed by GitHub
parent 3c92344fcc
commit cc6bc763bc
5 changed files with 27 additions and 52 deletions

View File

@@ -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;

View File

@@ -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 {