Only allow TSParameterProperty in ClassMethod parameters (#13349)
This commit is contained in:
parent
d6a5f6190d
commit
b1f57e5fb5
@ -481,7 +481,7 @@ export interface ForStatement extends BaseNode {
|
||||
export interface FunctionDeclaration extends BaseNode {
|
||||
type: "FunctionDeclaration";
|
||||
id?: Identifier | null;
|
||||
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
|
||||
params: Array<Identifier | Pattern | RestElement>;
|
||||
body: BlockStatement;
|
||||
generator?: boolean;
|
||||
async?: boolean;
|
||||
@ -497,7 +497,7 @@ export interface FunctionDeclaration extends BaseNode {
|
||||
export interface FunctionExpression extends BaseNode {
|
||||
type: "FunctionExpression";
|
||||
id?: Identifier | null;
|
||||
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
|
||||
params: Array<Identifier | Pattern | RestElement>;
|
||||
body: BlockStatement;
|
||||
generator?: boolean;
|
||||
async?: boolean;
|
||||
@ -616,7 +616,7 @@ export interface ObjectMethod extends BaseNode {
|
||||
type: "ObjectMethod";
|
||||
kind: "method" | "get" | "set";
|
||||
key: Expression | Identifier | StringLiteral | NumericLiteral;
|
||||
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
|
||||
params: Array<Identifier | Pattern | RestElement>;
|
||||
body: BlockStatement;
|
||||
computed: boolean;
|
||||
generator?: boolean;
|
||||
@ -756,7 +756,7 @@ export interface ArrayPattern extends BaseNode {
|
||||
|
||||
export interface ArrowFunctionExpression extends BaseNode {
|
||||
type: "ArrowFunctionExpression";
|
||||
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
|
||||
params: Array<Identifier | Pattern | RestElement>;
|
||||
body: BlockStatement | Expression;
|
||||
async?: boolean;
|
||||
expression: boolean;
|
||||
@ -1658,7 +1658,7 @@ export interface TSDeclareFunction extends BaseNode {
|
||||
type: "TSDeclareFunction";
|
||||
id?: Identifier | null;
|
||||
typeParameters?: TSTypeParameterDeclaration | Noop | null;
|
||||
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
|
||||
params: Array<Identifier | Pattern | RestElement>;
|
||||
returnType?: TSTypeAnnotation | Noop | null;
|
||||
async?: boolean;
|
||||
declare?: boolean | null;
|
||||
|
||||
@ -133,9 +133,7 @@ export function forStatement(
|
||||
}
|
||||
export function functionDeclaration(
|
||||
id: t.Identifier | null | undefined,
|
||||
params: Array<
|
||||
t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
|
||||
>,
|
||||
params: Array<t.Identifier | t.Pattern | t.RestElement>,
|
||||
body: t.BlockStatement,
|
||||
generator?: boolean,
|
||||
async?: boolean,
|
||||
@ -144,9 +142,7 @@ export function functionDeclaration(
|
||||
}
|
||||
export function functionExpression(
|
||||
id: t.Identifier | null | undefined,
|
||||
params: Array<
|
||||
t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
|
||||
>,
|
||||
params: Array<t.Identifier | t.Pattern | t.RestElement>,
|
||||
body: t.BlockStatement,
|
||||
generator?: boolean,
|
||||
async?: boolean,
|
||||
@ -226,9 +222,7 @@ export function objectExpression(
|
||||
export function objectMethod(
|
||||
kind: "method" | "get" | "set" | undefined,
|
||||
key: t.Expression | t.Identifier | t.StringLiteral | t.NumericLiteral,
|
||||
params: Array<
|
||||
t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
|
||||
>,
|
||||
params: Array<t.Identifier | t.Pattern | t.RestElement>,
|
||||
body: t.BlockStatement,
|
||||
computed?: boolean,
|
||||
generator?: boolean,
|
||||
@ -338,9 +332,7 @@ export function arrayPattern(
|
||||
return builder("ArrayPattern", ...arguments);
|
||||
}
|
||||
export function arrowFunctionExpression(
|
||||
params: Array<
|
||||
t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
|
||||
>,
|
||||
params: Array<t.Identifier | t.Pattern | t.RestElement>,
|
||||
body: t.BlockStatement | t.Expression,
|
||||
async?: boolean,
|
||||
): t.ArrowFunctionExpression {
|
||||
@ -1093,9 +1085,7 @@ export { tsParameterProperty as tSParameterProperty };
|
||||
export function tsDeclareFunction(
|
||||
id: t.Identifier | null | undefined,
|
||||
typeParameters: t.TSTypeParameterDeclaration | t.Noop | null | undefined,
|
||||
params: Array<
|
||||
t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
|
||||
>,
|
||||
params: Array<t.Identifier | t.Pattern | t.RestElement>,
|
||||
returnType?: t.TSTypeAnnotation | t.Noop | null,
|
||||
): t.TSDeclareFunction {
|
||||
return builder("TSDeclareFunction", ...arguments);
|
||||
|
||||
@ -353,14 +353,7 @@ export const functionCommon = {
|
||||
params: {
|
||||
validate: chain(
|
||||
assertValueType("array"),
|
||||
assertEach(
|
||||
assertNodeType(
|
||||
"Identifier",
|
||||
"Pattern",
|
||||
"RestElement",
|
||||
"TSParameterProperty",
|
||||
),
|
||||
),
|
||||
assertEach(assertNodeType("Identifier", "Pattern", "RestElement")),
|
||||
),
|
||||
},
|
||||
generator: {
|
||||
@ -1743,6 +1736,19 @@ export const classMethodOrPropertyCommon = {
|
||||
export const classMethodOrDeclareMethodCommon = {
|
||||
...functionCommon,
|
||||
...classMethodOrPropertyCommon,
|
||||
params: {
|
||||
validate: chain(
|
||||
assertValueType("array"),
|
||||
assertEach(
|
||||
assertNodeType(
|
||||
"Identifier",
|
||||
"Pattern",
|
||||
"RestElement",
|
||||
"TSParameterProperty",
|
||||
),
|
||||
),
|
||||
),
|
||||
},
|
||||
kind: {
|
||||
validate: assertOneOf("get", "set", "method", "constructor"),
|
||||
default: "method",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user