mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Parse more types in JSDoc function() syntax
Also some cleanup from PR comments
This commit is contained in:
@@ -6866,6 +6866,10 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isJSDocTypeReference(node: TypeReferenceType): node is TypeReferenceNode {
|
||||
return node.flags & NodeFlags.JSDoc && node.kind === SyntaxKind.TypeReference;
|
||||
}
|
||||
|
||||
function getPrimitiveTypeFromJSDocTypeReference(node: TypeReferenceNode): Type {
|
||||
if (isIdentifier(node.typeName)) {
|
||||
switch (node.typeName.text) {
|
||||
|
||||
@@ -2199,7 +2199,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isStartOfParameter(): boolean {
|
||||
return token() === SyntaxKind.DotDotDotToken || isIdentifierOrPattern() || isModifierKind(token()) || token() === SyntaxKind.AtToken || token() === SyntaxKind.ThisKeyword || token() === SyntaxKind.NewKeyword;
|
||||
return token() === SyntaxKind.DotDotDotToken ||
|
||||
isIdentifierOrPattern() ||
|
||||
isModifierKind(token()) ||
|
||||
token() === SyntaxKind.AtToken || token() === SyntaxKind.ThisKeyword || token() === SyntaxKind.NewKeyword ||
|
||||
token() === SyntaxKind.StringLiteral || token() === SyntaxKind.NumericLiteral;
|
||||
}
|
||||
|
||||
function parseParameter(): ParameterDeclaration {
|
||||
|
||||
@@ -3302,10 +3302,6 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isJSDocTypeReference(node: TypeReferenceType): node is TypeReferenceNode {
|
||||
return node.flags & NodeFlags.JSDoc && node.kind === SyntaxKind.TypeReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats an enum value as a string for debugging and debug assertions.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user