Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function getGroup(node: TSESTree.TypeNode): Group {
case AST_NODE_TYPES.TSSymbolKeyword:
case AST_NODE_TYPES.TSThisType:
case AST_NODE_TYPES.TSUnknownKeyword:
case AST_NODE_TYPES.TSIntrinsicKeyword:
return Group.keyword;

case AST_NODE_TYPES.TSNullKeyword:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ const valid = (operator: '|' | '&'): TSESLint.ValidTestCase<Options>[] => [
type T =
${operator} A
${operator} B
${operator} intrinsic
${operator} number[]
${operator} string[]
${operator} any
${operator} string
${operator} symbol
${operator} this
${operator} readonly number[]
${operator} readonly string[]
${operator} 'a'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type Uppercase<S extends string> = intrinsic;
type Lowercase<S extends string> = intrinsic;
type Capitalize<S extends string> = intrinsic;
type Uncapitalize<S extends string> = intrinsic;
1 change: 1 addition & 0 deletions packages/types/src/ast-node-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ enum AST_NODE_TYPES {
TSInterfaceDeclaration = 'TSInterfaceDeclaration',
TSInterfaceHeritage = 'TSInterfaceHeritage',
TSIntersectionType = 'TSIntersectionType',
TSIntrinsicKeyword = 'TSIntrinsicKeyword',
TSLiteralType = 'TSLiteralType',
TSMappedType = 'TSMappedType',
TSMethodSignature = 'TSMethodSignature',
Expand Down
6 changes: 6 additions & 0 deletions packages/types/src/ts-estree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export type Node =
| TSInterfaceDeclaration
| TSInterfaceHeritage
| TSIntersectionType
| TSIntrinsicKeyword
| TSLiteralType
| TSMappedType
| TSMethodSignature
Expand Down Expand Up @@ -544,6 +545,7 @@ export type TypeNode =
| TSInferType
| TSInterfaceHeritage
| TSIntersectionType
| TSIntrinsicKeyword
| TSLiteralType
| TSMappedType
| TSNamedTupleMember
Expand Down Expand Up @@ -1469,6 +1471,10 @@ export interface TSIntersectionType extends BaseNode {
types: TypeNode[];
}

export interface TSIntrinsicKeyword extends BaseNode {
type: AST_NODE_TYPES.TSIntrinsicKeyword;
}

export interface TSLiteralType extends BaseNode {
type: AST_NODE_TYPES.TSLiteralType;
literal: LiteralExpression | UnaryExpression | UpdateExpression;
Expand Down
3 changes: 2 additions & 1 deletion packages/typescript-estree/src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2206,7 +2206,8 @@ export class Converter {
case SyntaxKind.SymbolKeyword:
case SyntaxKind.UnknownKeyword:
case SyntaxKind.VoidKeyword:
case SyntaxKind.UndefinedKeyword: {
case SyntaxKind.UndefinedKeyword:
case SyntaxKind.IntrinsicKeyword: {
return this.createNode<any>(node, {
type: AST_NODE_TYPES[`TS${SyntaxKind[node.kind]}` as AST_NODE_TYPES],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export interface EstreeToTsNodeTypes {
[AST_NODE_TYPES.TSAnyKeyword]: ts.KeywordTypeNode;
[AST_NODE_TYPES.TSBigIntKeyword]: ts.KeywordTypeNode;
[AST_NODE_TYPES.TSBooleanKeyword]: ts.KeywordTypeNode;
[AST_NODE_TYPES.TSIntrinsicKeyword]: ts.KeywordTypeNode;
[AST_NODE_TYPES.TSNeverKeyword]: ts.KeywordTypeNode;
[AST_NODE_TYPES.TSNumberKeyword]: ts.KeywordTypeNode;
[AST_NODE_TYPES.TSObjectKeyword]: ts.KeywordTypeNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-without-type-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/intrinsic-keyword.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/keyof-operator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/keyword-variables.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
Expand Down
Loading