TypeScript: reserve unknown as TSUnknownKeyword (#8755)
This commit is contained in:
parent
889cdb8da5
commit
f38be13113
@ -127,6 +127,9 @@ export function TSIndexSignature(node) {
|
|||||||
export function TSAnyKeyword() {
|
export function TSAnyKeyword() {
|
||||||
this.word("any");
|
this.word("any");
|
||||||
}
|
}
|
||||||
|
export function TSUnknownKeyword() {
|
||||||
|
this.word("unknown");
|
||||||
|
}
|
||||||
export function TSNumberKeyword() {
|
export function TSNumberKeyword() {
|
||||||
this.word("number");
|
this.word("number");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
let a: any;
|
let a: any;
|
||||||
|
let un: unknown;
|
||||||
let b: boolean;
|
let b: boolean;
|
||||||
let ne: never;
|
let ne: never;
|
||||||
let nul: null;
|
let nul: null;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
let a: any;
|
let a: any;
|
||||||
|
let un: unknown;
|
||||||
let b: boolean;
|
let b: boolean;
|
||||||
let ne: never;
|
let ne: never;
|
||||||
let nul: null;
|
let nul: null;
|
||||||
|
|||||||
@ -57,6 +57,8 @@ function keywordTypeFromName(
|
|||||||
return "TSSymbolKeyword";
|
return "TSSymbolKeyword";
|
||||||
case "undefined":
|
case "undefined":
|
||||||
return "TSUndefinedKeyword";
|
return "TSUndefinedKeyword";
|
||||||
|
case "unknown":
|
||||||
|
return "TSUnknownKeyword";
|
||||||
default:
|
default:
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1119,6 +1119,7 @@ export type TsTypeBase = NodeBase;
|
|||||||
|
|
||||||
export type TsKeywordTypeType =
|
export type TsKeywordTypeType =
|
||||||
| "TSAnyKeyword"
|
| "TSAnyKeyword"
|
||||||
|
| "TSUnknownKeyword"
|
||||||
| "TSNumberKeyword"
|
| "TSNumberKeyword"
|
||||||
| "TSObjectKeyword"
|
| "TSObjectKeyword"
|
||||||
| "TSBooleanKeyword"
|
| "TSBooleanKeyword"
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
let a: any;
|
let a: any;
|
||||||
|
let un: unknown;
|
||||||
let b: boolean;
|
let b: boolean;
|
||||||
let ne: never;
|
let ne: never;
|
||||||
let nul: null;
|
let nul: null;
|
||||||
|
|||||||
@ -1,28 +1,28 @@
|
|||||||
{
|
{
|
||||||
"type": "File",
|
"type": "File",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"end": 152,
|
"end": 169,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 1,
|
"line": 1,
|
||||||
"column": 0
|
"column": 0
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 12
|
"column": 12
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"program": {
|
"program": {
|
||||||
"type": "Program",
|
"type": "Program",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"end": 152,
|
"end": 169,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 1,
|
"line": 1,
|
||||||
"column": 0
|
"column": 0
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 12
|
"column": 12
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -113,7 +113,7 @@
|
|||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"start": 12,
|
"start": 12,
|
||||||
"end": 27,
|
"end": 28,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 2,
|
"line": 2,
|
||||||
@ -121,14 +121,14 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 2,
|
"line": 2,
|
||||||
"column": 15
|
"column": 16
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "VariableDeclarator",
|
||||||
"start": 16,
|
"start": 16,
|
||||||
"end": 26,
|
"end": 27,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 2,
|
"line": 2,
|
||||||
@ -136,13 +136,13 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 2,
|
"line": 2,
|
||||||
"column": 14
|
"column": 15
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start": 16,
|
"start": 16,
|
||||||
"end": 26,
|
"end": 27,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 2,
|
"line": 2,
|
||||||
@ -150,6 +150,87 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 2,
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"identifierName": "un"
|
||||||
|
},
|
||||||
|
"name": "un",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start": 18,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSUnknownKeyword",
|
||||||
|
"start": 20,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 8
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"init": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "let"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"start": 29,
|
||||||
|
"end": 44,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"start": 33,
|
||||||
|
"end": 43,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 33,
|
||||||
|
"end": 43,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
"column": 14
|
"column": 14
|
||||||
},
|
},
|
||||||
"identifierName": "b"
|
"identifierName": "b"
|
||||||
@ -157,29 +238,29 @@
|
|||||||
"name": "b",
|
"name": "b",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start": 17,
|
"start": 34,
|
||||||
"end": 26,
|
"end": 43,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 2,
|
"line": 3,
|
||||||
"column": 5
|
"column": 5
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 2,
|
"line": 3,
|
||||||
"column": 14
|
"column": 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSBooleanKeyword",
|
"type": "TSBooleanKeyword",
|
||||||
"start": 19,
|
"start": 36,
|
||||||
"end": 26,
|
"end": 43,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 2,
|
"line": 3,
|
||||||
"column": 7
|
"column": 7
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 2,
|
"line": 3,
|
||||||
"column": 14
|
"column": 14
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,44 +274,44 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"start": 28,
|
"start": 45,
|
||||||
"end": 42,
|
"end": 59,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 3,
|
"line": 4,
|
||||||
"column": 0
|
"column": 0
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 3,
|
"line": 4,
|
||||||
"column": 14
|
"column": 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "VariableDeclarator",
|
||||||
"start": 32,
|
"start": 49,
|
||||||
"end": 41,
|
"end": 58,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 3,
|
"line": 4,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 3,
|
"line": 4,
|
||||||
"column": 13
|
"column": 13
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start": 32,
|
"start": 49,
|
||||||
"end": 41,
|
"end": 58,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 3,
|
"line": 4,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 3,
|
"line": 4,
|
||||||
"column": 13
|
"column": 13
|
||||||
},
|
},
|
||||||
"identifierName": "ne"
|
"identifierName": "ne"
|
||||||
@ -238,108 +319,27 @@
|
|||||||
"name": "ne",
|
"name": "ne",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start": 34,
|
"start": 51,
|
||||||
"end": 41,
|
"end": 58,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 3,
|
"line": 4,
|
||||||
"column": 6
|
"column": 6
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 3,
|
"line": 4,
|
||||||
"column": 13
|
"column": 13
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSNeverKeyword",
|
"type": "TSNeverKeyword",
|
||||||
"start": 36,
|
"start": 53,
|
||||||
"end": 41,
|
"end": 58,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 3,
|
"line": 4,
|
||||||
"column": 8
|
"column": 8
|
||||||
},
|
},
|
||||||
"end": {
|
|
||||||
"line": 3,
|
|
||||||
"column": 13
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"init": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"kind": "let"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "VariableDeclaration",
|
|
||||||
"start": 43,
|
|
||||||
"end": 57,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 4,
|
|
||||||
"column": 0
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 4,
|
|
||||||
"column": 14
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"declarations": [
|
|
||||||
{
|
|
||||||
"type": "VariableDeclarator",
|
|
||||||
"start": 47,
|
|
||||||
"end": 56,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 4,
|
|
||||||
"column": 4
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 4,
|
|
||||||
"column": 13
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"id": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 47,
|
|
||||||
"end": 56,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 4,
|
|
||||||
"column": 4
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 4,
|
|
||||||
"column": 13
|
|
||||||
},
|
|
||||||
"identifierName": "nul"
|
|
||||||
},
|
|
||||||
"name": "nul",
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSTypeAnnotation",
|
|
||||||
"start": 50,
|
|
||||||
"end": 56,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 4,
|
|
||||||
"column": 7
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 4,
|
|
||||||
"column": 13
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSNullKeyword",
|
|
||||||
"start": 52,
|
|
||||||
"end": 56,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 4,
|
|
||||||
"column": 9
|
|
||||||
},
|
|
||||||
"end": {
|
"end": {
|
||||||
"line": 4,
|
"line": 4,
|
||||||
"column": 13
|
"column": 13
|
||||||
@ -355,7 +355,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"start": 58,
|
"start": 60,
|
||||||
"end": 74,
|
"end": 74,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
@ -364,13 +364,13 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 5,
|
"line": 5,
|
||||||
"column": 16
|
"column": 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "VariableDeclarator",
|
||||||
"start": 62,
|
"start": 64,
|
||||||
"end": 73,
|
"end": 73,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
@ -379,12 +379,12 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 5,
|
"line": 5,
|
||||||
"column": 15
|
"column": 13
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start": 62,
|
"start": 64,
|
||||||
"end": 73,
|
"end": 73,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
@ -393,14 +393,14 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 5,
|
"line": 5,
|
||||||
"column": 15
|
"column": 13
|
||||||
},
|
},
|
||||||
"identifierName": "num"
|
"identifierName": "nul"
|
||||||
},
|
},
|
||||||
"name": "num",
|
"name": "nul",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start": 65,
|
"start": 67,
|
||||||
"end": 73,
|
"end": 73,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
@ -409,12 +409,12 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 5,
|
"line": 5,
|
||||||
"column": 15
|
"column": 13
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSNumberKeyword",
|
"type": "TSNullKeyword",
|
||||||
"start": 67,
|
"start": 69,
|
||||||
"end": 73,
|
"end": 73,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
@ -423,7 +423,7 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 5,
|
"line": 5,
|
||||||
"column": 15
|
"column": 13
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -437,7 +437,7 @@
|
|||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"start": 75,
|
"start": 75,
|
||||||
"end": 89,
|
"end": 91,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 6,
|
"line": 6,
|
||||||
@ -445,14 +445,14 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 6,
|
"line": 6,
|
||||||
"column": 14
|
"column": 16
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "VariableDeclarator",
|
||||||
"start": 79,
|
"start": 79,
|
||||||
"end": 88,
|
"end": 90,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 6,
|
"line": 6,
|
||||||
@ -460,13 +460,13 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 6,
|
"line": 6,
|
||||||
"column": 13
|
"column": 15
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start": 79,
|
"start": 79,
|
||||||
"end": 88,
|
"end": 90,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 6,
|
"line": 6,
|
||||||
@ -474,6 +474,87 @@
|
|||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 6,
|
"line": 6,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"identifierName": "num"
|
||||||
|
},
|
||||||
|
"name": "num",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start": 82,
|
||||||
|
"end": 90,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSNumberKeyword",
|
||||||
|
"start": 84,
|
||||||
|
"end": 90,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 9
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"init": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "let"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"start": 92,
|
||||||
|
"end": 106,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"start": 96,
|
||||||
|
"end": 105,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 96,
|
||||||
|
"end": 105,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 7,
|
||||||
"column": 13
|
"column": 13
|
||||||
},
|
},
|
||||||
"identifierName": "o"
|
"identifierName": "o"
|
||||||
@ -481,29 +562,29 @@
|
|||||||
"name": "o",
|
"name": "o",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start": 80,
|
"start": 97,
|
||||||
"end": 88,
|
"end": 105,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 6,
|
"line": 7,
|
||||||
"column": 5
|
"column": 5
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 6,
|
"line": 7,
|
||||||
"column": 13
|
"column": 13
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSObjectKeyword",
|
"type": "TSObjectKeyword",
|
||||||
"start": 82,
|
"start": 99,
|
||||||
"end": 88,
|
"end": 105,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 6,
|
"line": 7,
|
||||||
"column": 7
|
"column": 7
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 6,
|
"line": 7,
|
||||||
"column": 13
|
"column": 13
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -517,44 +598,44 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"start": 90,
|
"start": 107,
|
||||||
"end": 105,
|
"end": 122,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 0
|
"column": 0
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 15
|
"column": 15
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "VariableDeclarator",
|
||||||
"start": 94,
|
"start": 111,
|
||||||
"end": 104,
|
"end": 121,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 14
|
"column": 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start": 94,
|
"start": 111,
|
||||||
"end": 104,
|
"end": 121,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 14
|
"column": 14
|
||||||
},
|
},
|
||||||
"identifierName": "st"
|
"identifierName": "st"
|
||||||
@ -562,29 +643,29 @@
|
|||||||
"name": "st",
|
"name": "st",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start": 96,
|
"start": 113,
|
||||||
"end": 104,
|
"end": 121,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 6
|
"column": 6
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 14
|
"column": 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSStringKeyword",
|
"type": "TSStringKeyword",
|
||||||
"start": 98,
|
"start": 115,
|
||||||
"end": 104,
|
"end": 121,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 8
|
"column": 8
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 7,
|
"line": 8,
|
||||||
"column": 14
|
"column": 14
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -598,44 +679,44 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"start": 106,
|
"start": 123,
|
||||||
"end": 121,
|
"end": 138,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 0
|
"column": 0
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 15
|
"column": 15
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "VariableDeclarator",
|
||||||
"start": 110,
|
"start": 127,
|
||||||
"end": 120,
|
"end": 137,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 14
|
"column": 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start": 110,
|
"start": 127,
|
||||||
"end": 120,
|
"end": 137,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 14
|
"column": 14
|
||||||
},
|
},
|
||||||
"identifierName": "sy"
|
"identifierName": "sy"
|
||||||
@ -643,29 +724,29 @@
|
|||||||
"name": "sy",
|
"name": "sy",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start": 112,
|
"start": 129,
|
||||||
"end": 120,
|
"end": 137,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 6
|
"column": 6
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 14
|
"column": 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSSymbolKeyword",
|
"type": "TSSymbolKeyword",
|
||||||
"start": 114,
|
"start": 131,
|
||||||
"end": 120,
|
"end": 137,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 8
|
"column": 8
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 8,
|
"line": 9,
|
||||||
"column": 14
|
"column": 14
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -679,44 +760,44 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"start": 122,
|
"start": 139,
|
||||||
"end": 139,
|
"end": 156,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 0
|
"column": 0
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 17
|
"column": 17
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "VariableDeclarator",
|
||||||
"start": 126,
|
"start": 143,
|
||||||
"end": 138,
|
"end": 155,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 16
|
"column": 16
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start": 126,
|
"start": 143,
|
||||||
"end": 138,
|
"end": 155,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 16
|
"column": 16
|
||||||
},
|
},
|
||||||
"identifierName": "u"
|
"identifierName": "u"
|
||||||
@ -724,29 +805,29 @@
|
|||||||
"name": "u",
|
"name": "u",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start": 127,
|
"start": 144,
|
||||||
"end": 138,
|
"end": 155,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 5
|
"column": 5
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 16
|
"column": 16
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSUndefinedKeyword",
|
"type": "TSUndefinedKeyword",
|
||||||
"start": 129,
|
"start": 146,
|
||||||
"end": 138,
|
"end": 155,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 7
|
"column": 7
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 9,
|
"line": 10,
|
||||||
"column": 16
|
"column": 16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -760,44 +841,44 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"start": 140,
|
"start": 157,
|
||||||
"end": 152,
|
"end": 169,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 0
|
"column": 0
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 12
|
"column": 12
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "VariableDeclarator",
|
||||||
"start": 144,
|
"start": 161,
|
||||||
"end": 151,
|
"end": 168,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 11
|
"column": 11
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start": 144,
|
"start": 161,
|
||||||
"end": 151,
|
"end": 168,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 11
|
"column": 11
|
||||||
},
|
},
|
||||||
"identifierName": "v"
|
"identifierName": "v"
|
||||||
@ -805,29 +886,29 @@
|
|||||||
"name": "v",
|
"name": "v",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start": 145,
|
"start": 162,
|
||||||
"end": 151,
|
"end": 168,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 5
|
"column": 5
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 11
|
"column": 11
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSVoidKeyword",
|
"type": "TSVoidKeyword",
|
||||||
"start": 147,
|
"start": 164,
|
||||||
"end": 151,
|
"end": 168,
|
||||||
"loc": {
|
"loc": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 7
|
"column": 7
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 10,
|
"line": 11,
|
||||||
"column": 11
|
"column": 11
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -762,6 +762,9 @@ export function assertTSIndexSignature(node: Object, opts?: Object = {}): void {
|
|||||||
export function assertTSAnyKeyword(node: Object, opts?: Object = {}): void {
|
export function assertTSAnyKeyword(node: Object, opts?: Object = {}): void {
|
||||||
assert("TSAnyKeyword", node, opts);
|
assert("TSAnyKeyword", node, opts);
|
||||||
}
|
}
|
||||||
|
export function assertTSUnknownKeyword(node: Object, opts?: Object = {}): void {
|
||||||
|
assert("TSUnknownKeyword", node, opts);
|
||||||
|
}
|
||||||
export function assertTSNumberKeyword(node: Object, opts?: Object = {}): void {
|
export function assertTSNumberKeyword(node: Object, opts?: Object = {}): void {
|
||||||
assert("TSNumberKeyword", node, opts);
|
assert("TSNumberKeyword", node, opts);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -698,6 +698,11 @@ export function TSAnyKeyword(...args: Array<any>): Object {
|
|||||||
}
|
}
|
||||||
export { TSAnyKeyword as tsAnyKeyword };
|
export { TSAnyKeyword as tsAnyKeyword };
|
||||||
export { TSAnyKeyword as tSAnyKeyword };
|
export { TSAnyKeyword as tSAnyKeyword };
|
||||||
|
export function TSUnknownKeyword(...args: Array<any>): Object {
|
||||||
|
return builder("TSUnknownKeyword", ...args);
|
||||||
|
}
|
||||||
|
export { TSUnknownKeyword as tsUnknownKeyword };
|
||||||
|
export { TSUnknownKeyword as tSUnknownKeyword };
|
||||||
export function TSNumberKeyword(...args: Array<any>): Object {
|
export function TSNumberKeyword(...args: Array<any>): Object {
|
||||||
return builder("TSNumberKeyword", ...args);
|
return builder("TSNumberKeyword", ...args);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,6 +128,7 @@ defineType("TSIndexSignature", {
|
|||||||
|
|
||||||
const tsKeywordTypes = [
|
const tsKeywordTypes = [
|
||||||
"TSAnyKeyword",
|
"TSAnyKeyword",
|
||||||
|
"TSUnknownKeyword",
|
||||||
"TSNumberKeyword",
|
"TSNumberKeyword",
|
||||||
"TSObjectKeyword",
|
"TSObjectKeyword",
|
||||||
"TSBooleanKeyword",
|
"TSBooleanKeyword",
|
||||||
|
|||||||
@ -2406,6 +2406,20 @@ export function isTSAnyKeyword(node: Object, opts?: Object): boolean {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
export function isTSUnknownKeyword(node: Object, opts?: Object): boolean {
|
||||||
|
if (!node) return false;
|
||||||
|
|
||||||
|
const nodeType = node.type;
|
||||||
|
if (nodeType === "TSUnknownKeyword") {
|
||||||
|
if (typeof opts === "undefined") {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return shallowEqual(node, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
export function isTSNumberKeyword(node: Object, opts?: Object): boolean {
|
export function isTSNumberKeyword(node: Object, opts?: Object): boolean {
|
||||||
if (!node) return false;
|
if (!node) return false;
|
||||||
|
|
||||||
@ -4116,6 +4130,7 @@ export function isTSType(node: Object, opts?: Object): boolean {
|
|||||||
if (
|
if (
|
||||||
nodeType === "TSType" ||
|
nodeType === "TSType" ||
|
||||||
"TSAnyKeyword" === nodeType ||
|
"TSAnyKeyword" === nodeType ||
|
||||||
|
"TSUnknownKeyword" === nodeType ||
|
||||||
"TSNumberKeyword" === nodeType ||
|
"TSNumberKeyword" === nodeType ||
|
||||||
"TSObjectKeyword" === nodeType ||
|
"TSObjectKeyword" === nodeType ||
|
||||||
"TSBooleanKeyword" === nodeType ||
|
"TSBooleanKeyword" === nodeType ||
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user