-
Notifications
You must be signed in to change notification settings - Fork 13.2k
JSDoc string literal types #9995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a6642d6
6fbd79b
5c2ba01
f8103b5
e5973b8
4c35296
3c32478
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -346,7 +346,7 @@ namespace ts { | |
| JSDocTypedefTag, | ||
| JSDocPropertyTag, | ||
| JSDocTypeLiteral, | ||
| JSDocStringLiteralType, | ||
| JSDocLiteralType, | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may need to update the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated |
||
| // Synthesized list | ||
| SyntaxList, | ||
|
|
@@ -377,9 +377,9 @@ namespace ts { | |
| LastBinaryOperator = CaretEqualsToken, | ||
| FirstNode = QualifiedName, | ||
| FirstJSDocNode = JSDocTypeExpression, | ||
| LastJSDocNode = JSDocStringLiteralType, | ||
| LastJSDocNode = JSDocLiteralType, | ||
| FirstJSDocTagNode = JSDocComment, | ||
| LastJSDocTagNode = JSDocStringLiteralType | ||
| LastJSDocTagNode = JSDocLiteralType | ||
| } | ||
|
|
||
| export const enum NodeFlags { | ||
|
|
@@ -1493,8 +1493,8 @@ namespace ts { | |
| type: JSDocType; | ||
| } | ||
|
|
||
| export interface JSDocStringLiteralType extends JSDocType { | ||
| stringLiteral: StringLiteralTypeNode; | ||
| export interface JSDocLiteralType extends JSDocType { | ||
| literal: LiteralTypeNode; | ||
| } | ||
|
|
||
| export type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| === tests/cases/conformance/jsdoc/in.js === | ||
| /** | ||
| * @param {'literal'} p1 | ||
| * @param {"literal"} p2 | ||
| * @param {'literal' | 'other'} p3 | ||
| * @param {'literal' | number} p4 | ||
| * @param {12 | true | 'str'} p5 | ||
| */ | ||
| function f(p1, p2, p3, p4, p5) { | ||
| >f : Symbol(f, Decl(in.js, 0, 0)) | ||
| >p1 : Symbol(p1, Decl(in.js, 7, 11)) | ||
| >p2 : Symbol(p2, Decl(in.js, 7, 14)) | ||
| >p3 : Symbol(p3, Decl(in.js, 7, 18)) | ||
| >p4 : Symbol(p4, Decl(in.js, 7, 22)) | ||
| >p5 : Symbol(p5, Decl(in.js, 7, 26)) | ||
|
|
||
| return p1 + p2 + p3 + p4 + p5 + '.'; | ||
| >p1 : Symbol(p1, Decl(in.js, 7, 11)) | ||
| >p2 : Symbol(p2, Decl(in.js, 7, 14)) | ||
| >p3 : Symbol(p3, Decl(in.js, 7, 18)) | ||
| >p4 : Symbol(p4, Decl(in.js, 7, 22)) | ||
| >p5 : Symbol(p5, Decl(in.js, 7, 26)) | ||
| } | ||
|
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need
NeverKeywordandUndefinedKeywordhere tooThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and
NullKeywordas well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, those are not literal types, it turns out. In the interests of getting this PR in, I'll do those separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They probably need their own special handling (see the lines preceding the diff in checker)