Improve AST node definitions in @babel/types (#12510)
This commit is contained in:
parent
4f1df9a713
commit
2f6de2f0c5
@ -821,6 +821,7 @@ export interface ExportAllDeclaration extends BaseNode {
|
||||
type: "ExportAllDeclaration";
|
||||
source: StringLiteral;
|
||||
assertions?: ImportAttribute | null;
|
||||
exportKind?: "type" | "value" | null;
|
||||
}
|
||||
|
||||
export interface ExportDefaultDeclaration extends BaseNode {
|
||||
@ -1225,6 +1226,7 @@ export interface ObjectTypeProperty extends BaseNode {
|
||||
value: FlowType;
|
||||
variance?: Variance | null;
|
||||
kind: "init" | "get" | "set";
|
||||
method: boolean;
|
||||
optional: boolean;
|
||||
proto: boolean;
|
||||
static: boolean;
|
||||
@ -1335,19 +1337,19 @@ export interface EnumDeclaration extends BaseNode {
|
||||
export interface EnumBooleanBody extends BaseNode {
|
||||
type: "EnumBooleanBody";
|
||||
members: Array<EnumBooleanMember>;
|
||||
explicit: boolean;
|
||||
explicitType: boolean;
|
||||
}
|
||||
|
||||
export interface EnumNumberBody extends BaseNode {
|
||||
type: "EnumNumberBody";
|
||||
members: Array<EnumNumberMember>;
|
||||
explicit: boolean;
|
||||
explicitType: boolean;
|
||||
}
|
||||
|
||||
export interface EnumStringBody extends BaseNode {
|
||||
type: "EnumStringBody";
|
||||
members: Array<EnumStringMember | EnumDefaultedMember>;
|
||||
explicit: boolean;
|
||||
explicitType: boolean;
|
||||
}
|
||||
|
||||
export interface EnumSymbolBody extends BaseNode {
|
||||
@ -1542,6 +1544,7 @@ export interface ClassPrivateProperty extends BaseNode {
|
||||
value?: Expression | null;
|
||||
decorators?: Array<Decorator> | null;
|
||||
static: any;
|
||||
typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null;
|
||||
}
|
||||
|
||||
export interface ClassPrivateMethod extends BaseNode {
|
||||
|
||||
@ -1399,6 +1399,7 @@ defineType("ExportAllDeclaration", {
|
||||
source: {
|
||||
validate: assertNodeType("StringLiteral"),
|
||||
},
|
||||
exportKind: validateOptional(assertOneOf("type", "value")),
|
||||
assertions: {
|
||||
optional: true,
|
||||
validate: chain(
|
||||
|
||||
@ -117,6 +117,10 @@ defineType("ClassPrivateProperty", {
|
||||
validate: assertNodeType("Expression"),
|
||||
optional: true,
|
||||
},
|
||||
typeAnnotation: {
|
||||
validate: assertNodeType("TypeAnnotation", "TSTypeAnnotation", "Noop"),
|
||||
optional: true,
|
||||
},
|
||||
decorators: {
|
||||
validate: chain(
|
||||
assertValueType("array"),
|
||||
|
||||
@ -328,6 +328,7 @@ defineType("ObjectTypeProperty", {
|
||||
proto: validate(assertValueType("boolean")),
|
||||
optional: validate(assertValueType("boolean")),
|
||||
variance: validateOptionalType("Variance"),
|
||||
method: validate(assertValueType("boolean")),
|
||||
},
|
||||
});
|
||||
|
||||
@ -488,7 +489,7 @@ defineType("EnumBooleanBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
explicit: validate(assertValueType("boolean")),
|
||||
explicitType: validate(assertValueType("boolean")),
|
||||
members: validateArrayOfType("EnumBooleanMember"),
|
||||
},
|
||||
});
|
||||
@ -497,7 +498,7 @@ defineType("EnumNumberBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
explicit: validate(assertValueType("boolean")),
|
||||
explicitType: validate(assertValueType("boolean")),
|
||||
members: validateArrayOfType("EnumNumberMember"),
|
||||
},
|
||||
});
|
||||
@ -506,7 +507,7 @@ defineType("EnumStringBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
explicit: validate(assertValueType("boolean")),
|
||||
explicitType: validate(assertValueType("boolean")),
|
||||
members: validateArrayOfType(["EnumStringMember", "EnumDefaultedMember"]),
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user