use types from estree

This commit is contained in:
Tobias Koppers 2021-06-22 09:47:29 +02:00
parent 33b1fe2bc4
commit d09cc17cee
3 changed files with 10 additions and 93 deletions

17
declarations.d.ts vendored
View File

@ -371,23 +371,6 @@ declare module "browserslist" {
export = browserslist;
}
// TODO remove that when @types/estree is updated
declare type PrivateIdentifierNode = {
type: "PrivateIdentifier";
name: string;
loc?: import("estree").SourceLocation | null;
range?: [number, number];
};
declare type PropertyDefinitionNode = {
type: "PropertyDefinition";
key: import("estree").Expression | PrivateIdentifierNode;
value: import("estree").Expression | null;
computed: boolean;
static: boolean;
loc?: import("estree").SourceLocation | null;
range?: [number, number];
};
type TODO = any;
type RecursiveArrayOrRecord<T> =

View File

@ -25,6 +25,8 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
/** @typedef {import("estree").Comment} CommentNode */
/** @typedef {import("estree").ConditionalExpression} ConditionalExpressionNode */
/** @typedef {import("estree").Declaration} DeclarationNode */
/** @typedef {import("estree").PrivateIdentifier} PrivateIdentifierNode */
/** @typedef {import("estree").PropertyDefinition} PropertyDefinitionNode */
/** @typedef {import("estree").Expression} ExpressionNode */
/** @typedef {import("estree").Identifier} IdentifierNode */
/** @typedef {import("estree").IfStatement} IfStatementNode */

84
types.d.ts vendored
View File

@ -52,15 +52,16 @@ import {
NewExpression,
ObjectExpression,
ObjectPattern,
PrivateIdentifier,
Program,
Property,
PropertyDefinition,
RegExpLiteral,
RestElement,
ReturnStatement,
SequenceExpression,
SimpleCallExpression,
SimpleLiteral,
SourceLocation,
SpreadElement,
Super,
SwitchCase,
@ -4559,7 +4560,7 @@ declare class JavascriptParser extends Parser {
| FunctionDeclaration
| VariableDeclaration
| ClassDeclaration
| PrivateIdentifierNode
| PrivateIdentifier
),
number
],
@ -4663,7 +4664,7 @@ declare class JavascriptParser extends Parser {
>;
classBodyElement: SyncBailHook<
[
MethodDefinition | PropertyDefinitionNode,
MethodDefinition | PropertyDefinition,
ClassExpression | ClassDeclaration
],
boolean | void
@ -4671,7 +4672,7 @@ declare class JavascriptParser extends Parser {
classBodyValue: SyncBailHook<
[
Expression,
MethodDefinition | PropertyDefinitionNode,
MethodDefinition | PropertyDefinition,
ClassExpression | ClassDeclaration
],
boolean | void
@ -4987,7 +4988,7 @@ declare class JavascriptParser extends Parser {
| FunctionDeclaration
| VariableDeclaration
| ClassDeclaration
| PrivateIdentifierNode,
| PrivateIdentifier,
commentsStartPos: number
): boolean;
getComments(range?: any): any[];
@ -6922,6 +6923,7 @@ type NodeEstreeIndex =
| FunctionDeclaration
| VariableDeclaration
| ClassDeclaration
| PrivateIdentifier
| ExpressionStatement
| BlockStatement
| EmptyStatement
@ -6945,6 +6947,7 @@ type NodeEstreeIndex =
| ExportDefaultDeclaration
| ExportAllDeclaration
| MethodDefinition
| PropertyDefinition
| VariableDeclarator
| Program
| Super
@ -8411,12 +8414,6 @@ declare interface PrintedElement {
element: string;
content: string;
}
declare interface PrivateIdentifierNode {
type: "PrivateIdentifier";
name: string;
loc?: null | SourceLocation;
range?: [number, number];
}
declare interface Problem {
type: ProblemType;
path: string;
@ -8534,71 +8531,6 @@ declare interface ProgressPluginOptions {
*/
profile?: null | boolean;
}
declare interface PropertyDefinitionNode {
type: "PropertyDefinition";
key:
| UnaryExpression
| ThisExpression
| ArrayExpression
| ObjectExpression
| FunctionExpression
| ArrowFunctionExpression
| YieldExpression
| SimpleLiteral
| RegExpLiteral
| BigIntLiteral
| UpdateExpression
| BinaryExpression
| AssignmentExpression
| LogicalExpression
| MemberExpression
| ConditionalExpression
| SimpleCallExpression
| NewExpression
| SequenceExpression
| TemplateLiteral
| TaggedTemplateExpression
| ClassExpression
| MetaProperty
| Identifier
| AwaitExpression
| ImportExpression
| ChainExpression
| PrivateIdentifierNode;
value:
| null
| UnaryExpression
| ThisExpression
| ArrayExpression
| ObjectExpression
| FunctionExpression
| ArrowFunctionExpression
| YieldExpression
| SimpleLiteral
| RegExpLiteral
| BigIntLiteral
| UpdateExpression
| BinaryExpression
| AssignmentExpression
| LogicalExpression
| MemberExpression
| ConditionalExpression
| SimpleCallExpression
| NewExpression
| SequenceExpression
| TemplateLiteral
| TaggedTemplateExpression
| ClassExpression
| MetaProperty
| Identifier
| AwaitExpression
| ImportExpression
| ChainExpression;
computed: boolean;
static: boolean;
loc?: null | SourceLocation;
range?: [number, number];
}
declare class ProvidePlugin {
constructor(definitions: Record<string, string | string[]>);
definitions: Record<string, string | string[]>;