Commit d7204587 authored by Rosanny Sihombing's avatar Rosanny Sihombing Committed by Rosanny Sihombing
Browse files

MLAB-677: Update required modules


(cherry picked from commit 5b932c11)
parent b807a4c1
......@@ -939,7 +939,7 @@ function classAccessorProperty(key, value = null, typeAnnotation = null, decorat
});
}
function classPrivateProperty(key, value = null, decorators = null, _static = false) {
function classPrivateProperty(key, value = null, decorators = null, _static) {
return (0, _validateNode.default)({
type: "ClassPrivateProperty",
key,
......
......@@ -9,12 +9,8 @@ var _generated = require("../generated");
var _removeTypeDuplicates = require("../../modifications/typescript/removeTypeDuplicates");
var _index = require("../../validators/generated/index");
function createTSUnionType(typeAnnotations) {
const types = typeAnnotations.map(type => {
return (0, _index.isTSTypeAnnotation)(type) ? type.typeAnnotation : type;
});
const types = typeAnnotations.map(type => type.typeAnnotation);
const flattened = (0, _removeTypeDuplicates.default)(types);
if (flattened.length === 1) {
......
......@@ -278,8 +278,7 @@ defineType("ForStatement", {
}
}
});
const functionCommon = () => ({
const functionCommon = {
params: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement")))
},
......@@ -289,11 +288,9 @@ const functionCommon = () => ({
async: {
default: false
}
});
};
exports.functionCommon = functionCommon;
const functionTypeAnnotationCommon = () => ({
const functionTypeAnnotationCommon = {
returnType: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
......@@ -302,11 +299,9 @@ const functionTypeAnnotationCommon = () => ({
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true
}
});
};
exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon;
const functionDeclarationCommon = () => Object.assign({}, functionCommon(), {
const functionDeclarationCommon = Object.assign({}, functionCommon, {
declare: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
......@@ -316,12 +311,11 @@ const functionDeclarationCommon = () => Object.assign({}, functionCommon(), {
optional: true
}
});
exports.functionDeclarationCommon = functionDeclarationCommon;
defineType("FunctionDeclaration", {
builder: ["id", "params", "body", "generator", "async"],
visitor: ["id", "params", "body", "returnType", "typeParameters"],
fields: Object.assign({}, functionDeclarationCommon(), functionTypeAnnotationCommon(), {
fields: Object.assign({}, functionDeclarationCommon, functionTypeAnnotationCommon, {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
},
......@@ -344,7 +338,7 @@ defineType("FunctionDeclaration", {
defineType("FunctionExpression", {
inherits: "FunctionDeclaration",
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), {
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
id: {
validate: (0, _utils.assertNodeType)("Identifier"),
optional: true
......@@ -358,24 +352,21 @@ defineType("FunctionExpression", {
}
})
});
const patternLikeCommon = () => ({
const patternLikeCommon = {
typeAnnotation: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator")))
}
});
};
exports.patternLikeCommon = patternLikeCommon;
defineType("Identifier", {
builder: ["name"],
visitor: ["typeAnnotation", "decorators"],
aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"],
fields: Object.assign({}, patternLikeCommon(), {
fields: Object.assign({}, patternLikeCommon, {
name: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) {
if (!process.env.BABEL_TYPES_8_BREAKING) return;
......@@ -596,7 +587,7 @@ defineType("ObjectExpression", {
});
defineType("ObjectMethod", {
builder: ["kind", "key", "params", "body", "computed", "generator", "async"],
fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), {
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
kind: Object.assign({
validate: (0, _utils.assertOneOf)("method", "get", "set")
}, !process.env.BABEL_TYPES_8_BREAKING ? {
......@@ -607,7 +598,7 @@ defineType("ObjectMethod", {
},
key: {
validate: function () {
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral");
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
const computed = (0, _utils.assertNodeType)("Expression");
const validator = function (node, key, val) {
......@@ -615,7 +606,7 @@ defineType("ObjectMethod", {
validator(node, key, val);
};
validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral"];
validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral"];
return validator;
}()
},
......@@ -692,7 +683,7 @@ defineType("RestElement", {
builder: ["argument"],
aliases: ["LVal", "PatternLike"],
deprecatedAlias: "RestProperty",
fields: Object.assign({}, patternLikeCommon(), {
fields: Object.assign({}, patternLikeCommon, {
argument: {
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression", "TSAsExpression", "TSTypeAssertion", "TSNonNullExpression")
},
......@@ -919,7 +910,7 @@ defineType("AssignmentPattern", {
visitor: ["left", "right", "decorators"],
builder: ["left", "right"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, patternLikeCommon(), {
fields: Object.assign({}, patternLikeCommon, {
left: {
validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression", "TSAsExpression", "TSTypeAssertion", "TSNonNullExpression")
},
......@@ -936,7 +927,7 @@ defineType("ArrayPattern", {
visitor: ["elements", "typeAnnotation"],
builder: ["elements"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, patternLikeCommon(), {
fields: Object.assign({}, patternLikeCommon, {
elements: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "PatternLike")))
},
......@@ -954,7 +945,7 @@ defineType("ArrowFunctionExpression", {
builder: ["params", "body", "async"],
visitor: ["params", "body", "returnType", "typeParameters"],
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), {
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
expression: {
validate: (0, _utils.assertValueType)("boolean")
},
......@@ -1276,8 +1267,7 @@ defineType("MetaProperty", {
}
}
});
const classMethodOrPropertyCommon = () => ({
const classMethodOrPropertyCommon = {
abstract: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
......@@ -1307,13 +1297,11 @@ const classMethodOrPropertyCommon = () => ({
const validator = node.computed ? computed : normal;
validator(node, key, val);
};
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "Expression"))
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "Expression"))
}
});
};
exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon;
const classMethodOrDeclareMethodCommon = () => Object.assign({}, functionCommon(), classMethodOrPropertyCommon(), {
const classMethodOrDeclareMethodCommon = Object.assign({}, functionCommon, classMethodOrPropertyCommon, {
params: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement", "TSParameterProperty")))
},
......@@ -1330,13 +1318,12 @@ const classMethodOrDeclareMethodCommon = () => Object.assign({}, functionCommon(
optional: true
}
});
exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon;
defineType("ClassMethod", {
aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"],
builder: ["kind", "key", "params", "body", "computed", "static", "generator", "async"],
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
fields: Object.assign({}, classMethodOrDeclareMethodCommon(), functionTypeAnnotationCommon(), {
fields: Object.assign({}, classMethodOrDeclareMethodCommon, functionTypeAnnotationCommon, {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
......@@ -1346,7 +1333,7 @@ defineType("ObjectPattern", {
visitor: ["properties", "typeAnnotation", "decorators"],
builder: ["properties"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, patternLikeCommon(), {
fields: Object.assign({}, patternLikeCommon, {
properties: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("RestElement", "ObjectProperty")))
}
......@@ -1528,7 +1515,7 @@ defineType("ClassProperty", {
visitor: ["key", "value", "typeAnnotation", "decorators"],
builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"],
aliases: ["Property"],
fields: Object.assign({}, classMethodOrPropertyCommon(), {
fields: Object.assign({}, classMethodOrPropertyCommon, {
value: {
validate: (0, _utils.assertNodeType)("Expression"),
optional: true
......@@ -1563,16 +1550,16 @@ defineType("ClassAccessorProperty", {
visitor: ["key", "value", "typeAnnotation", "decorators"],
builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"],
aliases: ["Property", "Accessor"],
fields: Object.assign({}, classMethodOrPropertyCommon(), {
fields: Object.assign({}, classMethodOrPropertyCommon, {
key: {
validate: (0, _utils.chain)(function () {
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "PrivateName");
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "PrivateName");
const computed = (0, _utils.assertNodeType)("Expression");
return function (node, key, val) {
const validator = node.computed ? computed : normal;
validator(node, key, val);
};
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "Expression", "PrivateName"))
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "Expression", "PrivateName"))
},
value: {
validate: (0, _utils.assertNodeType)("Expression"),
......@@ -1624,10 +1611,6 @@ defineType("ClassPrivateProperty", {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
},
static: {
validate: (0, _utils.assertValueType)("boolean"),
default: false
},
readonly: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
......@@ -1646,11 +1629,7 @@ defineType("ClassPrivateMethod", {
builder: ["kind", "key", "params", "body", "static"],
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method", "Private"],
fields: Object.assign({}, classMethodOrDeclareMethodCommon(), functionTypeAnnotationCommon(), {
kind: {
validate: (0, _utils.assertOneOf)("get", "set", "method"),
default: "method"
},
fields: Object.assign({}, classMethodOrDeclareMethodCommon, functionTypeAnnotationCommon, {
key: {
validate: (0, _utils.assertNodeType)("PrivateName")
},
......
......@@ -8,8 +8,7 @@ var _is = require("../validators/is");
const defineType = (0, _utils.defineAliasedType)("TypeScript");
const bool = (0, _utils.assertValueType)("boolean");
const tSFunctionTypeAnnotationCommon = () => ({
const tSFunctionTypeAnnotationCommon = {
returnType: {
validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"),
optional: true
......@@ -18,8 +17,7 @@ const tSFunctionTypeAnnotationCommon = () => ({
validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
optional: true
}
});
};
defineType("TSParameterProperty", {
aliases: ["LVal"],
visitor: ["parameter"],
......@@ -48,11 +46,11 @@ defineType("TSParameterProperty", {
defineType("TSDeclareFunction", {
aliases: ["Statement", "Declaration"],
visitor: ["id", "typeParameters", "params", "returnType"],
fields: Object.assign({}, (0, _core.functionDeclarationCommon)(), tSFunctionTypeAnnotationCommon())
fields: Object.assign({}, _core.functionDeclarationCommon, tSFunctionTypeAnnotationCommon)
});
defineType("TSDeclareMethod", {
visitor: ["decorators", "key", "typeParameters", "params", "returnType"],
fields: Object.assign({}, (0, _core.classMethodOrDeclareMethodCommon)(), tSFunctionTypeAnnotationCommon())
fields: Object.assign({}, _core.classMethodOrDeclareMethodCommon, tSFunctionTypeAnnotationCommon)
});
defineType("TSQualifiedName", {
aliases: ["TSEntityName"],
......@@ -62,33 +60,27 @@ defineType("TSQualifiedName", {
right: (0, _utils.validateType)("Identifier")
}
});
const signatureDeclarationCommon = () => ({
const signatureDeclarationCommon = {
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
["parameters"]: (0, _utils.validateArrayOfType)(["Identifier", "RestElement"]),
["typeAnnotation"]: (0, _utils.validateOptionalType)("TSTypeAnnotation")
});
};
const callConstructSignatureDeclaration = {
aliases: ["TSTypeElement"],
visitor: ["typeParameters", "parameters", "typeAnnotation"],
fields: signatureDeclarationCommon()
fields: signatureDeclarationCommon
};
defineType("TSCallSignatureDeclaration", callConstructSignatureDeclaration);
defineType("TSConstructSignatureDeclaration", callConstructSignatureDeclaration);
const namedTypeElementCommon = () => ({
const namedTypeElementCommon = {
key: (0, _utils.validateType)("Expression"),
computed: {
default: false
},
computed: (0, _utils.validate)(bool),
optional: (0, _utils.validateOptional)(bool)
});
};
defineType("TSPropertySignature", {
aliases: ["TSTypeElement"],
visitor: ["key", "typeAnnotation", "initializer"],
fields: Object.assign({}, namedTypeElementCommon(), {
fields: Object.assign({}, namedTypeElementCommon, {
readonly: (0, _utils.validateOptional)(bool),
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"),
initializer: (0, _utils.validateOptionalType)("Expression"),
......@@ -100,7 +92,7 @@ defineType("TSPropertySignature", {
defineType("TSMethodSignature", {
aliases: ["TSTypeElement"],
visitor: ["key", "typeParameters", "parameters", "typeAnnotation"],
fields: Object.assign({}, signatureDeclarationCommon(), namedTypeElementCommon(), {
fields: Object.assign({}, signatureDeclarationCommon, namedTypeElementCommon, {
kind: {
validate: (0, _utils.assertOneOf)("method", "get", "set")
}
......@@ -136,10 +128,10 @@ const fnOrCtrBase = {
visitor: ["typeParameters", "parameters", "typeAnnotation"]
};
defineType("TSFunctionType", Object.assign({}, fnOrCtrBase, {
fields: signatureDeclarationCommon()
fields: signatureDeclarationCommon
}));
defineType("TSConstructorType", Object.assign({}, fnOrCtrBase, {
fields: Object.assign({}, signatureDeclarationCommon(), {
fields: Object.assign({}, signatureDeclarationCommon, {
abstract: (0, _utils.validateOptional)(bool)
})
}));
......
......@@ -269,7 +269,7 @@ export interface ObjectExpression extends BaseNode {
export interface ObjectMethod extends BaseNode {
type: "ObjectMethod";
kind: "method" | "get" | "set";
key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral;
key: Expression | Identifier | StringLiteral | NumericLiteral;
params: Array<Identifier | Pattern | RestElement>;
body: BlockStatement;
computed: boolean;
......@@ -510,7 +510,7 @@ export interface MetaProperty extends BaseNode {
export interface ClassMethod extends BaseNode {
type: "ClassMethod";
kind: "get" | "set" | "method" | "constructor";
key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression;
key: Identifier | StringLiteral | NumericLiteral | Expression;
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
body: BlockStatement;
computed: boolean;
......@@ -606,7 +606,7 @@ export interface OptionalCallExpression extends BaseNode {
export interface ClassProperty extends BaseNode {
type: "ClassProperty";
key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression;
key: Identifier | StringLiteral | NumericLiteral | Expression;
value: Expression | null;
typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
decorators: Array<Decorator> | null;
......@@ -624,7 +624,7 @@ export interface ClassProperty extends BaseNode {
export interface ClassAccessorProperty extends BaseNode {
type: "ClassAccessorProperty";
key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName;
key: Identifier | StringLiteral | NumericLiteral | Expression | PrivateName;
value: Expression | null;
typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
decorators: Array<Decorator> | null;
......@@ -645,7 +645,7 @@ export interface ClassPrivateProperty extends BaseNode {
key: PrivateName;
value: Expression | null;
decorators: Array<Decorator> | null;
static: boolean;
static: any;
definite: boolean | null;
readonly: boolean | null;
typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
......@@ -654,7 +654,7 @@ export interface ClassPrivateProperty extends BaseNode {
export interface ClassPrivateMethod extends BaseNode {
type: "ClassPrivateMethod";
kind: "get" | "set" | "method";
kind: "get" | "set" | "method" | "constructor";
key: PrivateName;
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
body: BlockStatement;
......@@ -1268,7 +1268,7 @@ export interface TSDeclareFunction extends BaseNode {
export interface TSDeclareMethod extends BaseNode {
type: "TSDeclareMethod";
decorators: Array<Decorator> | null;
key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression;
key: Identifier | StringLiteral | NumericLiteral | Expression;
typeParameters: TSTypeParameterDeclaration | Noop | null;
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
returnType: TSTypeAnnotation | Noop | null;
......@@ -1309,7 +1309,7 @@ export interface TSPropertySignature extends BaseNode {
key: Expression;
typeAnnotation: TSTypeAnnotation | null;
initializer: Expression | null;
computed: boolean;
computed: boolean | null;
kind: "get" | "set";
optional: boolean | null;
readonly: boolean | null;
......@@ -1321,7 +1321,7 @@ export interface TSMethodSignature extends BaseNode {
typeParameters: TSTypeParameterDeclaration | null;
parameters: Array<Identifier | RestElement>;
typeAnnotation: TSTypeAnnotation | null;
computed: boolean;
computed: boolean | null;
kind: "method" | "get" | "set";
optional: boolean | null;
}
......@@ -1799,7 +1799,7 @@ export function memberExpression(object: Expression, property: Expression | Iden
export function newExpression(callee: Expression | V8IntrinsicIdentifier, _arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>): NewExpression;
export function program(body: Array<Statement>, directives?: Array<Directive>, sourceType?: "script" | "module", interpreter?: InterpreterDirective | null): Program;
export function objectExpression(properties: Array<ObjectMethod | ObjectProperty | SpreadElement>): ObjectExpression;
export function objectMethod(kind: "method" | "get" | "set" | undefined, key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral, params: Array<Identifier | Pattern | RestElement>, body: BlockStatement, computed?: boolean, generator?: boolean, async?: boolean): ObjectMethod;
export function objectMethod(kind: "method" | "get" | "set" | undefined, key: Expression | Identifier | StringLiteral | NumericLiteral, params: Array<Identifier | Pattern | RestElement>, body: BlockStatement, computed?: boolean, generator?: boolean, async?: boolean): ObjectMethod;
export function objectProperty(key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral | DecimalLiteral | PrivateName, value: Expression | PatternLike, computed?: boolean, shorthand?: boolean, decorators?: Array<Decorator> | null): ObjectProperty;
export function restElement(argument: LVal): RestElement;
export function returnStatement(argument?: Expression | null): ReturnStatement;
......@@ -1832,7 +1832,7 @@ export function importDefaultSpecifier(local: Identifier): ImportDefaultSpecifie
export function importNamespaceSpecifier(local: Identifier): ImportNamespaceSpecifier;
export function importSpecifier(local: Identifier, imported: Identifier | StringLiteral): ImportSpecifier;
export function metaProperty(meta: Identifier, property: Identifier): MetaProperty;
export function classMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, computed?: boolean, _static?: boolean, generator?: boolean, async?: boolean): ClassMethod;
export function classMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: Identifier | StringLiteral | NumericLiteral | Expression, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, computed?: boolean, _static?: boolean, generator?: boolean, async?: boolean): ClassMethod;
export function objectPattern(properties: Array<RestElement | ObjectProperty>): ObjectPattern;
export function spreadElement(argument: Expression): SpreadElement;
declare function _super(): Super;
......@@ -1848,10 +1848,10 @@ export function bigIntLiteral(value: string): BigIntLiteral;
export function exportNamespaceSpecifier(exported: Identifier): ExportNamespaceSpecifier;
export function optionalMemberExpression(object: Expression, property: Expression | Identifier, computed: boolean | undefined, optional: boolean): OptionalMemberExpression;
export function optionalCallExpression(callee: Expression, _arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>, optional: boolean): OptionalCallExpression;
export function classProperty(key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassProperty;
export function classAccessorProperty(key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassAccessorProperty;
export function classPrivateProperty(key: PrivateName, value?: Expression | null, decorators?: Array<Decorator> | null, _static?: boolean): ClassPrivateProperty;
export function classPrivateMethod(kind: "get" | "set" | "method" | undefined, key: PrivateName, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, _static?: boolean): ClassPrivateMethod;
export function classProperty(key: Identifier | StringLiteral | NumericLiteral | Expression, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassProperty;
export function classAccessorProperty(key: Identifier | StringLiteral | NumericLiteral | Expression | PrivateName, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassAccessorProperty;
export function classPrivateProperty(key: PrivateName, value: Expression | null | undefined, decorators: Array<Decorator> | null | undefined, _static: any): ClassPrivateProperty;
export function classPrivateMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: PrivateName, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, _static?: boolean): ClassPrivateMethod;
export function privateName(id: Identifier): PrivateName;
export function staticBlock(body: Array<Statement>): StaticBlock;
export function anyTypeAnnotation(): AnyTypeAnnotation;
......@@ -1953,7 +1953,7 @@ export function pipelineBareFunction(callee: Expression): PipelineBareFunction;
export function pipelinePrimaryTopicReference(): PipelinePrimaryTopicReference;
export function tsParameterProperty(parameter: Identifier | AssignmentPattern): TSParameterProperty;
export function tsDeclareFunction(id: Identifier | null | undefined, typeParameters: TSTypeParameterDeclaration | Noop | null | undefined, params: Array<Identifier | Pattern | RestElement>, returnType?: TSTypeAnnotation | Noop | null): TSDeclareFunction;
export function tsDeclareMethod(decorators: Array<Decorator> | null | undefined, key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression, typeParameters: TSTypeParameterDeclaration | Noop | null | undefined, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, returnType?: TSTypeAnnotation | Noop | null): TSDeclareMethod;
export function tsDeclareMethod(decorators: Array<Decorator> | null | undefined, key: Identifier | StringLiteral | NumericLiteral | Expression, typeParameters: TSTypeParameterDeclaration | Noop | null | undefined, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, returnType?: TSTypeAnnotation | Noop | null): TSDeclareMethod;
export function tsQualifiedName(left: TSEntityName, right: Identifier): TSQualifiedName;
export function tsCallSignatureDeclaration(typeParameters: TSTypeParameterDeclaration | null | undefined, parameters: Array<Identifier | RestElement>, typeAnnotation?: TSTypeAnnotation | null): TSCallSignatureDeclaration;
export function tsConstructSignatureDeclaration(typeParameters: TSTypeParameterDeclaration | null | undefined, parameters: Array<Identifier | RestElement>, typeAnnotation?: TSTypeAnnotation | null): TSConstructSignatureDeclaration;
......
......@@ -135,8 +135,8 @@ interface FunctionDeclaration extends BaseNode {
id?: Identifier | null;
params: Array<Identifier | Pattern | RestElement>;
body: BlockStatement;
generator: boolean;
async: boolean;
generator?: boolean;
async?: boolean;
declare?: boolean | null;
predicate?: DeclaredPredicate | InferredPredicate | null;
returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null;
......@@ -147,8 +147,8 @@ interface FunctionExpression extends BaseNode {
id?: Identifier | null;
params: Array<Identifier | Pattern | RestElement>;
body: BlockStatement;
generator: boolean;
async: boolean;
generator?: boolean;
async?: boolean;
predicate?: DeclaredPredicate | InferredPredicate | null;
returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null;
typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null;
......@@ -242,12 +242,12 @@ interface ObjectExpression extends BaseNode {
interface ObjectMethod extends BaseNode {
type: "ObjectMethod";
kind: "method" | "get" | "set";
key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral;
key: Expression | Identifier | StringLiteral | NumericLiteral;
params: Array<Identifier | Pattern | RestElement>;
body: BlockStatement;
computed: boolean;
generator: boolean;
async: boolean;
generator?: boolean;
async?: boolean;
decorators?: Array<Decorator> | null;
returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null;
typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null;
......@@ -364,7 +364,7 @@ interface ArrowFunctionExpression extends BaseNode {
type: "ArrowFunctionExpression";
params: Array<Identifier | Pattern | RestElement>;
body: BlockStatement | Expression;
async: boolean;
async?: boolean;
expression: boolean;
generator?: boolean;
predicate?: DeclaredPredicate | InferredPredicate | null;
......@@ -459,14 +459,14 @@ interface MetaProperty extends BaseNode {
}
interface ClassMethod extends BaseNode {
type: "ClassMethod";
kind: "get" | "set" | "method" | "constructor";
key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression;
kind?: "get" | "set" | "method" | "constructor";
key: Identifier | StringLiteral | NumericLiteral | Expression;
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
body: BlockStatement;
computed: boolean;
static: boolean;
generator: boolean;
async: boolean;