mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[estree] make function declaration id nullable (#24854)
* [estree] make function declaration id nullable * apply review feedback * [estree] make class declaration id nullable
This commit is contained in:
parent
5227ddf7d5
commit
8c3fdbcf02
@ -223,7 +223,8 @@ boolean = memberExpression.computed;
|
||||
|
||||
// Declarations
|
||||
var functionDeclaration: ESTree.FunctionDeclaration;
|
||||
identifier = functionDeclaration.id;
|
||||
var identifierOrNull: ESTree.Identifier | null = functionDeclaration.id;
|
||||
functionDeclaration.id = null;
|
||||
var params: Array<ESTree.Pattern> = functionDeclaration.params;
|
||||
blockStatement = functionDeclaration.body;
|
||||
booleanMaybe = functionDeclaration.generator;
|
||||
@ -237,6 +238,10 @@ var variableDeclarator: ESTree.VariableDeclarator;
|
||||
pattern = variableDeclarator.id; // Pattern
|
||||
expressionMaybe = variableDeclarator.init;
|
||||
|
||||
var classDeclaration: ESTree.ClassDeclaration;
|
||||
identifierOrNull = classDeclaration.id;
|
||||
classDeclaration.id = null;
|
||||
|
||||
// Clauses
|
||||
// SwitchCase
|
||||
string = switchCase.type;
|
||||
|
||||
6
types/estree/index.d.ts
vendored
6
types/estree/index.d.ts
vendored
@ -196,7 +196,8 @@ interface BaseDeclaration extends BaseStatement { }
|
||||
|
||||
export interface FunctionDeclaration extends BaseFunction, BaseDeclaration {
|
||||
type: "FunctionDeclaration";
|
||||
id: Identifier;
|
||||
/** It is null when a function declaration is a part of the `export default function` statement */
|
||||
id: Identifier | null;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
@ -473,7 +474,8 @@ export interface MethodDefinition extends BaseNode {
|
||||
|
||||
export interface ClassDeclaration extends BaseClass, BaseDeclaration {
|
||||
type: "ClassDeclaration";
|
||||
id: Identifier;
|
||||
/** It is null when a class declaration is a part of the `export default class` statement */
|
||||
id: Identifier | null;
|
||||
}
|
||||
|
||||
export interface ClassExpression extends BaseClass, BaseExpression {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user