Created
February 9, 2024 08:08
-
-
Save H-Plus-Time/fef7b91f2742fc0aed3dc6722756bb22 to your computer and use it in GitHub Desktop.
Ezno generated types comparison.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* tslint:disable */ | |
/* eslint-disable */ | |
/** | |
* @returns {any} | |
*/ | |
export function get_version(): any; | |
export interface FailedBuildOutput { | |
diagnostics: DiagnosticsContainer; | |
} | |
export interface BuildOutput { | |
outputs: Output[]; | |
diagnostics: DiagnosticsContainer; | |
} | |
export interface Output { | |
output_path: string; | |
content: string; | |
mappings: string; | |
} | |
export function experimental_build( | |
entry_path: string, | |
fs_resolve_js: (path: string) => string | undefined, | |
minify: boolean, | |
): { Ok: BuildOutput } | { Err: FailedBuildOutput }; | |
interface WASMCheckOutput { | |
readonly diagnostics: DiagnosticsContainer; | |
} | |
export function check( | |
entry_path: string, | |
fs_resolver_js: (path: string) => string | undefined, | |
): WASMCheckOutput; | |
export function check_with_options( | |
entry_path: string, | |
fs_resolver_js: (path: string) => string | undefined, | |
options: TypeCheckOptions, | |
): WASMCheckOutput; | |
export function run_cli( | |
cli_arguments: string[], | |
read_from_file: (path: string) => string | undefined, | |
write_to_file: (path: string, content: string) => void, | |
cli_input_resolver: (prompt: string) => string | undefined, | |
): void; | |
export function parse_expression(input: string): Expression | [string, Span]; | |
export function parse_module(input: string): Module | [string, Span]; | |
export function parse_module_and_into_string( | |
input: string, | |
parse_options: ParseOptions, | |
to_string_options: ToStringOptions, | |
): string | [string, Span]; | |
export function just_imports(input: string): string | [string, Span]; | |
export interface TypeCheckOptions { | |
constant_parameters?: boolean; | |
allow_elided_arguments?: boolean; | |
allow_extra_arguments?: boolean; | |
constant_function_declarations?: boolean; | |
strict_casts?: boolean; | |
debug_types?: boolean; | |
store_expression_type_mappings?: boolean; | |
parse_comments?: boolean; | |
lsp_mode?: boolean; | |
} | |
export type DiagnosticsContainer = Diagnostic[]; | |
export type Diagnostic = { reason: string; kind: DiagnosticKind } | { | |
reason: string; | |
position: SpanWithSource; | |
kind: DiagnosticKind; | |
} | { | |
reason: string; | |
position: SpanWithSource; | |
labels: [string, SpanWithSource | null][]; | |
kind: DiagnosticKind; | |
}; | |
export type DiagnosticKind = "error" | "warning" | "info"; | |
export type SuperReference = { Call: { arguments: SpreadExpression[] } } | { | |
PropertyAccess: { property: string }; | |
} | { Index: { indexer: Expression } }; | |
export type SpecialOperators = | |
| { AsExpression: { value: Expression; type_annotation: TypeAnnotation } } | |
| { | |
SatisfiesExpression: { value: Expression; type_annotation: TypeAnnotation }; | |
} | |
| { InExpression: { lhs: InExpressionLHS; rhs: Expression } } | |
| { InstanceOfExpression: { lhs: Expression; rhs: Expression } } | |
| { IsExpression: { value: Expression; type_annotation: TypeAnnotation } }; | |
export type InExpressionLHS = { PrivateProperty: string } | { | |
Expression: Expression; | |
}; | |
export type MultipleExpression = { | |
lhs: MultipleExpression; | |
rhs: Expression; | |
position: Span; | |
} | Expression; | |
export type Expression = | |
| { NumberLiteral: [NumberRepresentation, Span] } | |
| { StringLiteral: [string, Quoted, Span] } | |
| { BooleanLiteral: [boolean, Span] } | |
| { RegexLiteral: { pattern: string; flags: string | null; position: Span } } | |
| { ArrayLiteral: [ArrayElement[], Span] } | |
| { ObjectLiteral: ObjectLiteral } | |
| { TemplateLiteral: TemplateLiteral } | |
| { ParenthesizedExpression: [MultipleExpression, Span] } | |
| { | |
BinaryOperation: { | |
lhs: Expression; | |
operator: BinaryOperator; | |
rhs: Expression; | |
position: Span; | |
}; | |
} | |
| { SpecialOperators: [SpecialOperators, Span] } | |
| { | |
UnaryOperation: { | |
operator: UnaryOperator; | |
operand: Expression; | |
position: Span; | |
}; | |
} | |
| { Assignment: { lhs: LHSOfAssignment; rhs: Expression; position: Span } } | |
| { | |
BinaryAssignmentOperation: { | |
lhs: VariableOrPropertyAccess; | |
operator: BinaryAssignmentOperator; | |
rhs: Expression; | |
position: Span; | |
}; | |
} | |
| { | |
UnaryPrefixAssignmentOperation: { | |
operator: UnaryPrefixAssignmentOperator; | |
operand: VariableOrPropertyAccess; | |
position: Span; | |
}; | |
} | |
| { | |
UnaryPostfixAssignmentOperation: { | |
operand: VariableOrPropertyAccess; | |
operator: UnaryPostfixAssignmentOperator; | |
position: Span; | |
}; | |
} | |
| { VariableReference: [string, Span] } | |
| { ThisReference: Span } | |
| { SuperExpression: [SuperReference, Span] } | |
| { NewTarget: Span } | |
| { | |
DynamicImport: { | |
path: Expression; | |
options: Expression | null; | |
position: Span; | |
}; | |
} | |
| { | |
PropertyAccess: { | |
parent: Expression; | |
property: PropertyReference; | |
is_optional: boolean; | |
position: Span; | |
}; | |
} | |
| { | |
Index: { | |
indexee: Expression; | |
indexer: MultipleExpression; | |
is_optional: boolean; | |
position: Span; | |
}; | |
} | |
| { | |
FunctionCall: { | |
function: Expression; | |
type_arguments: TypeAnnotation[] | null; | |
arguments: SpreadExpression[]; | |
is_optional: boolean; | |
position: Span; | |
}; | |
} | |
| { | |
ConstructorCall: { | |
constructor: Expression; | |
type_arguments: TypeAnnotation[] | null; | |
arguments: SpreadExpression[] | null; | |
position: Span; | |
}; | |
} | |
| { | |
ConditionalTernary: { | |
condition: Expression; | |
truthy_result: Expression; | |
falsy_result: Expression; | |
position: Span; | |
}; | |
} | |
| { ArrowFunction: ArrowFunction } | |
| { ExpressionFunction: ExpressionFunction } | |
| { ClassExpression: ClassDeclaration<ExpressionPosition> } | |
| { Null: Span } | |
| { | |
Comment: { | |
content: string; | |
on: Expression | null; | |
position: Span; | |
is_multiline: boolean; | |
prefix: boolean; | |
}; | |
} | |
| { JSXRoot: JSXRoot } | |
| { IsExpression: IsExpression } | |
| { Marker: { marker_id: Marker<Expression>; position: Span } }; | |
export type PropertyReference = { | |
Standard: { property: string; is_private: boolean }; | |
} | { Marker: Marker<PropertyReference> }; | |
export type SpreadExpression = { Spread: [Expression, Span] } | { | |
NonSpread: Expression; | |
}; | |
export type ArrayElement = SpreadExpression | null; | |
export type VariableKeyword = "Const" | "Let" | "Var"; | |
export type ExpressionPosition = VariableIdentifier | null; | |
export type StatementPosition = VariableIdentifier; | |
export type NumberRepresentation = | |
| "Infinity" | |
| "NegativeInfinity" | |
| "NaN" | |
| { Hex: { sign: NumberSign; value: number } } | |
| { Bin: { sign: NumberSign; value: number } } | |
| { Octal: { sign: NumberSign; value: number } } | |
| { Number: number } | |
| { Exponential: { sign: NumberSign; value: number; exponent: number } } | |
| { BigInt: [NumberSign, string] }; | |
export type NumberSign = "Positive" | "Negative"; | |
export type Comments = "All" | "JustDocumentation" | "None"; | |
export interface ToStringOptions { | |
pretty?: boolean; | |
trailing_semicolon?: boolean; | |
single_statement_on_new_line?: boolean; | |
include_types?: boolean; | |
include_decorators?: boolean; | |
comments?: Comments; | |
indent_with?: string; | |
expect_jsx?: boolean; | |
expect_markers?: boolean; | |
max_line_length?: number; | |
} | |
export interface ParseOptions { | |
jsx?: boolean; | |
type_annotations?: boolean; | |
special_jsx_attributes?: boolean; | |
decorators?: boolean; | |
comments?: Comments; | |
is_expressions?: boolean; | |
custom_function_headers?: boolean; | |
buffer_size?: number; | |
stack_size?: number | null; | |
record_keyword_positions?: boolean; | |
interpolation_points?: boolean; | |
partial_syntax?: boolean; | |
} | |
export type Quoted = "Single" | "Double"; | |
export type TypeAnnotation = | |
| { Name: [string, Span] } | |
| { CommonName: [CommonTypes, Span] } | |
| { NamespacedName: [string, string, Span] } | |
| { NameWithGenericArguments: [string, TypeAnnotation[], Span] } | |
| { Union: [TypeAnnotation[], Span] } | |
| { Intersection: [TypeAnnotation[], Span] } | |
| { StringLiteral: [string, Quoted, Span] } | |
| { NumberLiteral: [NumberRepresentation, Span] } | |
| { BooleanLiteral: [boolean, Span] } | |
| { ArrayLiteral: [TypeAnnotation, Span] } | |
| { | |
FunctionLiteral: { | |
type_parameters: GenericTypeConstraint[] | null; | |
parameters: TypeAnnotationFunctionParameters; | |
return_type: TypeAnnotation; | |
position: Span; | |
}; | |
} | |
| { | |
ConstructorLiteral: { | |
type_parameters: GenericTypeConstraint[] | null; | |
parameters: TypeAnnotationFunctionParameters; | |
return_type: TypeAnnotation; | |
position: Span; | |
}; | |
} | |
| { ObjectLiteral: [WithComment<Decorated<InterfaceMember>>[], Span] } | |
| { TupleLiteral: [[SpreadKind, AnnotationWithBinder][], Span] } | |
| { TemplateLiteral: [TemplateLiteralPart<AnnotationWithBinder>[], Span] } | |
| { Readonly: [TypeAnnotation, Span] } | |
| { Index: [TypeAnnotation, TypeAnnotation, Span] } | |
| { KeyOf: [TypeAnnotation, Span] } | |
| { ParenthesizedReference: [TypeAnnotation, Span] } | |
| { | |
Conditional: { | |
condition: TypeCondition; | |
resolve_true: TypeConditionResult; | |
resolve_false: TypeConditionResult; | |
position: Span; | |
}; | |
} | |
| { Decorated: [Decorator, TypeAnnotation, Span] } | |
| { Marker: [Marker<TypeAnnotation>, Span] }; | |
export type AnnotationWithBinder = { | |
Annotated: { name: string; ty: TypeAnnotation; position: Span }; | |
} | { NoAnnotation: TypeAnnotation }; | |
export type SpreadKind = "NonSpread" | "Spread"; | |
export type TypeCondition = { | |
Extends: { ty: TypeAnnotation; extends: TypeAnnotation; position: Span }; | |
} | { Is: { ty: TypeAnnotation; is: TypeAnnotation; position: Span } }; | |
export type CommonTypes = "String" | "Number" | "Boolean"; | |
export type TypeConditionResult = { Infer: [TypeAnnotation, Span] } | { | |
Reference: TypeAnnotation; | |
}; | |
export interface TypeAnnotationFunctionParameters { | |
parameters: TypeAnnotationFunctionParameter[]; | |
rest_parameter: TypeAnnotationSpreadFunctionParameter | null; | |
position: Span; | |
} | |
export interface TypeAnnotationFunctionParameter { | |
decorators: Decorator[]; | |
name: WithComment<VariableField<VariableFieldInTypeAnnotation>> | null; | |
type_annotation: TypeAnnotation; | |
is_optional: boolean; | |
position: Span; | |
} | |
export interface TypeAnnotationSpreadFunctionParameter { | |
decorators: Decorator[]; | |
name: string; | |
type_annotation: TypeAnnotation; | |
position: Span; | |
} | |
export type AlwaysPublic = false; | |
export type PublicOrPrivate = boolean; | |
export type PropertyKey<T> = | |
| { Ident: [string, Span, T] } | |
| { StringLiteral: [string, Quoted, Span] } | |
| { NumberLiteral: [NumberRepresentation, Span] } | |
| { Computed: [Expression, Span] }; | |
export type InterfaceMember = { | |
Method: { | |
header: MethodHeader; | |
name: PropertyKey<PublicOrPrivate>; | |
type_parameters: GenericTypeConstraint[] | null; | |
parameters: TypeAnnotationFunctionParameters; | |
return_type: TypeAnnotation | null; | |
is_optional: boolean; | |
performs: AnnotationPerforms | null; | |
position: Span; | |
}; | |
} | { | |
Property: { | |
name: PropertyKey<PublicOrPrivate>; | |
type_annotation: TypeAnnotation; | |
is_readonly: boolean; | |
is_optional: boolean; | |
position: Span; | |
}; | |
} | { | |
Indexer: { | |
name: string; | |
indexer_type: TypeAnnotation; | |
return_type: TypeAnnotation; | |
is_readonly: boolean; | |
position: Span; | |
}; | |
} | { | |
Constructor: { | |
parameters: TypeAnnotationFunctionParameters; | |
type_parameters: GenericTypeConstraint[] | null; | |
return_type: TypeAnnotation | null; | |
is_readonly: boolean; | |
performs: AnnotationPerforms | null; | |
position: Span; | |
}; | |
} | { | |
Caller: { | |
parameters: TypeAnnotationFunctionParameters; | |
type_parameters: GenericTypeConstraint[] | null; | |
return_type: TypeAnnotation | null; | |
is_readonly: boolean; | |
position: Span; | |
}; | |
} | { | |
Rule: { | |
parameter: string; | |
rule: TypeRule; | |
matching_type: TypeAnnotation; | |
optionality: Optionality; | |
is_readonly: boolean; | |
output_type: TypeAnnotation; | |
position: Span; | |
}; | |
} | { Comment: [string, boolean, Span] }; | |
export interface InterfaceDeclaration { | |
name: string; | |
is_nominal: boolean; | |
type_parameters: GenericTypeConstraint[] | null; | |
extends: TypeAnnotation[] | null; | |
members: WithComment<Decorated<InterfaceMember>>[]; | |
position: Span; | |
} | |
export interface ClassDeclaration<T> { | |
name: T; | |
type_parameters: GenericTypeConstraint[] | null; | |
extends: Expression | null; | |
implements: TypeAnnotation[] | null; | |
members: Decorated<ClassMember>[]; | |
position: Span; | |
} | |
export type Optionality = "Default" | "Optional" | "Required"; | |
export type TypeRule = "In" | "InKeyOf"; | |
export type AnnotationPerforms = { PerformsStatements: { body: Block } } | { | |
PerformsConst: { identifier: string }; | |
}; | |
export interface IfStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
else_conditions: ConditionalElseStatement[]; | |
trailing_else: UnconditionalElseStatement | null; | |
position: Span; | |
} | |
export interface ForLoopStatement { | |
condition: ForLoopCondition; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export type Block = [StatementOrDeclaration[], Span]; | |
export type StatementOrDeclaration = { Statement: Statement } | { | |
Declaration: Declaration; | |
} | { Marker: [Marker<Statement>, Span] }; | |
export type BlockOrSingleStatement = { Braced: Block } | { | |
SingleStatement: Statement; | |
}; | |
export type ForLoopStatementInitializer = | |
| { VariableDeclaration: VariableDeclaration } | |
| { VarStatement: VarVariableStatement } | |
| { Expression: MultipleExpression }; | |
export type ForLoopCondition = { | |
ForOf: { | |
keyword: VariableKeyword | null; | |
variable: WithComment<VariableField<VariableFieldInSourceCode>>; | |
of: Expression; | |
position: Span; | |
}; | |
} | { | |
ForIn: { | |
keyword: VariableKeyword | null; | |
variable: WithComment<VariableField<VariableFieldInSourceCode>>; | |
in: MultipleExpression; | |
position: Span; | |
}; | |
} | { | |
Statements: { | |
initialiser: ForLoopStatementInitializer | null; | |
condition: MultipleExpression | null; | |
afterthought: MultipleExpression | null; | |
position: Span; | |
}; | |
}; | |
export interface ConditionalElseStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface UnconditionalElseStatement { | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface FunctionBase { | |
type_parameters?: GenericTypeConstraint[]; | |
parameters: FunctionParameters; | |
return_type?: TypeAnnotation; | |
position: Span; | |
} | |
export interface ExpressionFunction extends FunctionBase { | |
header: FunctionHeader; | |
body: Block; | |
name: ExpressionPosition; | |
} | |
export interface TryCatchStatement { | |
try_inner: Block; | |
catch_inner: Block | null; | |
exception_var: [ExceptionVarField, TypeAnnotation | null] | null; | |
finally_inner: Block | null; | |
position: Span; | |
} | |
export type ExceptionVarField = WithComment< | |
VariableField<VariableFieldInSourceCode> | |
>; | |
export type FunctionLocationModifier = "Server" | "Worker"; | |
export type FunctionHeader = { | |
VirginFunctionHeader: { | |
is_async: boolean; | |
location: FunctionLocationModifier | null; | |
generator_star_token_position: Span | null; | |
position: Span; | |
}; | |
} | { | |
ChadFunctionHeader: { | |
is_async: boolean; | |
is_generator: boolean; | |
location: FunctionLocationModifier | null; | |
position: Span; | |
}; | |
}; | |
export type MethodHeader = "Get" | "Set" | { | |
Regular: { is_async: boolean; generator: GeneratorSpecifier | null }; | |
}; | |
export type GeneratorSpecifier = { Star: Span } | "Keyword"; | |
export interface StatementFunction extends FunctionBase { | |
header: FunctionHeader; | |
body: Block; | |
name: StatementPosition; | |
} | |
export interface VarVariableStatement { | |
declarations: VariableDeclarationItem<Expression | null>[]; | |
position: Span; | |
} | |
export type ThrowStatement = [MultipleExpression, Span]; | |
export type ReturnStatement = [MultipleExpression | null, Span]; | |
export type Statement = | |
| { Expression: MultipleExpression } | |
| { Block: Block } | |
| { Debugger: Span } | |
| { If: IfStatement } | |
| { ForLoop: ForLoopStatement } | |
| { Switch: SwitchStatement } | |
| { WhileLoop: WhileStatement } | |
| { DoWhileLoop: DoWhileStatement } | |
| { TryCatch: TryCatchStatement } | |
| { Return: ReturnStatement } | |
| { Continue: [string | null, Span] } | |
| { Break: [string | null, Span] } | |
| { Throw: ThrowStatement } | |
| { Comment: [string, Span] } | |
| { MultiLineComment: [string, Span] } | |
| { Labelled: { position: Span; name: string; statement: Statement } } | |
| { VarVariable: VarVariableStatement } | |
| { Empty: Span }; | |
export interface DoWhileStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface WhileStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface IsExpression { | |
matcher: MultipleExpression; | |
branches: [TypeAnnotation, ExpressionOrBlock][]; | |
position: Span; | |
} | |
export type ImportLocation = { Quoted: [string, Quoted] } | { | |
Marker: Marker<ImportLocation>; | |
}; | |
export type Declaration = | |
| { Variable: VariableDeclaration } | |
| { Function: Decorated<StatementFunction> } | |
| { Class: Decorated<ClassDeclaration<StatementPosition>> } | |
| { Enum: Decorated<EnumDeclaration> } | |
| { Interface: Decorated<InterfaceDeclaration> } | |
| { TypeAlias: TypeAlias } | |
| { DeclareVariable: DeclareVariableDeclaration } | |
| { DeclareFunction: DeclareFunctionDeclaration } | |
| { DeclareInterface: InterfaceDeclaration } | |
| { Import: ImportDeclaration } | |
| { Export: Decorated<ExportDeclaration> }; | |
type Marker<T> = number; | |
export type ObjectDestructuringField<T> = | |
| { Name: [VariableIdentifier, Expression | null, Span] } | |
| { Spread: [VariableIdentifier, Span] } | |
| { | |
Map: { | |
from: PropertyKey<AlwaysPublic>; | |
name: WithComment<VariableField<T>>; | |
default_value: Expression | null; | |
position: Span; | |
}; | |
}; | |
export type VariableField<T> = { Name: VariableIdentifier } | { | |
Array: [WithComment<ArrayDestructuringField<T>>[], Span]; | |
} | { Object: [WithComment<ObjectDestructuringField<T>>[], Span] }; | |
export type VariableIdentifier = { Standard: [string, Span] } | { | |
Marker: [VariableIdentifier, Span]; | |
}; | |
export type VariableDeclaration = { | |
ConstDeclaration: { | |
declarations: VariableDeclarationItem<Expression>[]; | |
position: Span; | |
}; | |
} | { | |
LetDeclaration: { | |
declarations: VariableDeclarationItem<Expression | null>[]; | |
position: Span; | |
}; | |
}; | |
export interface VariableDeclarationItem<TExpr> { | |
name: WithComment<VariableField<VariableFieldInSourceCode>>; | |
type_annotation: TypeAnnotation | null; | |
expression: TExpr; | |
position: Span; | |
} | |
export type VariableDeclarationKeyword = "Const" | "Let"; | |
export type VariableFieldInSourceCode = null; | |
export type VariableFieldInTypeAnnotation = null; | |
export type ArrayDestructuringField<T> = | |
| { Spread: [VariableIdentifier, Span] } | |
| { Name: [VariableField<T>, Expression?] } | |
| "None"; | |
export interface FunctionParameters { | |
this_type: [TypeAnnotation, Span] | null; | |
super_type: [TypeAnnotation, Span] | null; | |
parameters: Parameter[]; | |
rest_parameter: SpreadParameter | null; | |
position: Span; | |
} | |
export interface Parameter { | |
name: WithComment<VariableField<VariableFieldInSourceCode>>; | |
type_annotation: TypeAnnotation | null; | |
additionally: ParameterData | null; | |
position: Span; | |
} | |
export type ParameterData = "Optional" | { WithDefaultValue: Expression }; | |
export interface SpreadParameter { | |
name: VariableIdentifier; | |
type_annotation: TypeAnnotation | null; | |
position: Span; | |
} | |
export interface DeclareClassDeclaration { | |
name: string; | |
type_parameters: GenericTypeConstraint[] | null; | |
extends: TypeAnnotation | null; | |
} | |
export interface DeclareFunctionDeclaration { | |
name: string; | |
type_parameters: GenericTypeConstraint[] | null; | |
parameters: TypeAnnotationFunctionParameters; | |
return_type: TypeAnnotation | null; | |
performs: AnnotationPerforms | null; | |
decorators: Decorator[]; | |
position: Span; | |
} | |
export interface DeclareVariableDeclaration { | |
keyword: VariableKeyword; | |
declarations: VariableDeclarationItem<Expression | null>[]; | |
position: Span; | |
decorators: Decorator[]; | |
} | |
export type WithComment<T> = | |
| { None: T } | |
| { PrefixComment: [string, T, Span] } | |
| { PostfixComment: [T, string, Span] }; | |
export interface EnumDeclaration { | |
is_constant: boolean; | |
name: string; | |
members: EnumMember[]; | |
position: Span; | |
} | |
export type EnumMember = { | |
Variant: { name: string; value: Expression | null; position: Span }; | |
}; | |
export interface ObjectLiteralMethod extends FunctionBase { | |
header: MethodHeader; | |
body: Block; | |
name: WithComment<PropertyKey<AlwaysPublic>>; | |
} | |
export interface TypeAlias { | |
type_name: TypeDeclaration; | |
type_expression: TypeAnnotation; | |
position: Span; | |
} | |
export interface SwitchStatement { | |
case: MultipleExpression; | |
branches: SwitchBranch[]; | |
position: Span; | |
} | |
export interface JSXFragment { | |
children: JSXNode[]; | |
position: Span; | |
} | |
export interface JSXElement { | |
tag_name: string; | |
attributes: JSXAttribute[]; | |
children: JSXElementChildren; | |
position: Span; | |
} | |
export type JSXRoot = { Element: JSXElement } | { Fragment: JSXFragment }; | |
export type ObjectLiteralMember = | |
| { Spread: [Expression, Span] } | |
| { Shorthand: [string, Span] } | |
| { Property: [WithComment<PropertyKey<AlwaysPublic>>, Expression, Span] } | |
| { Method: ObjectLiteralMethod }; | |
export interface ObjectLiteral { | |
members: ObjectLiteralMember[]; | |
position: Span; | |
} | |
export type JSXElementChildren = { Children: JSXNode[] } | "SelfClosing"; | |
export type JSXNode = | |
| { TextNode: [string, Span] } | |
| { InterpolatedExpression: [Expression, Span] } | |
| { Element: JSXElement } | |
| "LineBreak"; | |
export type JSXAttribute = | |
| { Static: [string, string, Span] } | |
| { Dynamic: [string, Expression, Span] } | |
| { BooleanAttribute: [string, Span] } | |
| { Spread: [Expression, Span] } | |
| { Shorthand: Expression }; | |
export type BinaryOperator = | |
| "Add" | |
| "Subtract" | |
| "Multiply" | |
| "Divide" | |
| "Modulo" | |
| "Exponent" | |
| "BitwiseShiftLeft" | |
| "BitwiseShiftRight" | |
| "BitwiseShiftRightUnsigned" | |
| "BitwiseAnd" | |
| "BitwiseXOr" | |
| "BitwiseOr" | |
| "StrictEqual" | |
| "StrictNotEqual" | |
| "Equal" | |
| "NotEqual" | |
| "GreaterThan" | |
| "LessThan" | |
| "LessThanEqual" | |
| "GreaterThanEqual" | |
| "LogicalAnd" | |
| "LogicalOr" | |
| "NullCoalescing" | |
| "Divides" | |
| "Pipe" | |
| "Compose"; | |
export type BinaryAssignmentOperator = | |
| "LogicalNullishAssignment" | |
| "AddAssign" | |
| "SubtractAssign" | |
| "MultiplyAssign" | |
| "DivideAssign" | |
| "ModuloAssign" | |
| "ExponentAssign" | |
| "LogicalAndAssign" | |
| "LogicalOrAssign" | |
| "BitwiseShiftLeftAssign" | |
| "BitwiseShiftRightAssign" | |
| "BitwiseShiftRightUnsigned" | |
| "BitwiseAndAssign" | |
| "BitwiseXOrAssign" | |
| "BitwiseOrAssign"; | |
export type UnaryOperator = | |
| "Plus" | |
| "Negation" | |
| "BitwiseNot" | |
| "LogicalNot" | |
| "Await" | |
| "TypeOf" | |
| "Void" | |
| "Delete" | |
| "Yield" | |
| "DelegatedYield"; | |
export type IncrementOrDecrement = "Increment" | "Decrement"; | |
export type UnaryPrefixAssignmentOperator = "Invert" | { | |
IncrementOrDecrement: IncrementOrDecrement; | |
}; | |
export type UnaryPostfixAssignmentOperator = IncrementOrDecrement; | |
export type SwitchBranch = { Default: StatementOrDeclaration[] } | { | |
Case: [Expression, StatementOrDeclaration[]]; | |
}; | |
export interface ArrowFunction extends Omit<FunctionBase, "name"> { | |
header: IsAsync; | |
body: ExpressionOrBlock; | |
} | |
export interface Decorated<T> { | |
decorators: Decorator[]; | |
on: T; | |
position: Span; | |
} | |
export type IsAsync = boolean; | |
export type ImportPart = | |
| { Name: VariableIdentifier } | |
| { NameWithAlias: { name: string; alias: ImportExportName; position: Span } } | |
| { PrefixComment: [string, ImportPart | null, Span] } | |
| { PostfixComment: [ImportPart, string, Span] }; | |
export interface ImportDeclaration { | |
is_deferred: boolean; | |
is_type_annotation_import_only: boolean; | |
default: VariableIdentifier | null; | |
items: ImportedItems; | |
from: ImportLocation; | |
position: Span; | |
reversed: boolean; | |
} | |
export type ImportedItems = { Parts: ImportPart[] | null } | { | |
All: { under: VariableIdentifier }; | |
}; | |
export type ImportExportName = { Reference: string } | { | |
Quoted: [string, Quoted]; | |
} | { Marker: Marker<ImportExportName> }; | |
export type ExpressionOrBlock = { Expression: Expression } | { Block: Block }; | |
export interface Decorator { | |
name: string[]; | |
arguments: Expression[] | null; | |
position: Span; | |
} | |
export interface TypeDeclaration { | |
name: string; | |
type_parameters: GenericTypeConstraint[] | null; | |
position: Span; | |
} | |
export type GenericTypeConstraint = | |
| { Parameter: { name: string; default: TypeAnnotation | null } } | |
| { Extends: [string, TypeAnnotation] } | |
| { ExtendsKeyOf: [string, TypeAnnotation] } | |
| { Spread: { name: string; default: TypeAnnotation | null } }; | |
export interface ClassConstructor | |
extends Omit<FunctionBase, "header" | "name"> { | |
body: Block; | |
} | |
export interface ClassFunction extends FunctionBase { | |
header: MethodHeader; | |
body: Block; | |
name: WithComment<PropertyKey<PublicOrPrivate>>; | |
} | |
export interface Module { | |
items: StatementOrDeclaration[]; | |
span: Span; | |
} | |
export interface TemplateLiteral { | |
tag: Expression | null; | |
parts: TemplateLiteralPart<Expression>[]; | |
position: Span; | |
} | |
export type LHSOfAssignment = { | |
ObjectDestructuring: [ | |
WithComment<ObjectDestructuringField<VariableFieldInSourceCode>>[], | |
Span, | |
]; | |
} | { | |
ArrayDestructuring: [ | |
WithComment<ArrayDestructuringField<VariableFieldInSourceCode>>[], | |
Span, | |
]; | |
} | { VariableOrPropertyAccess: VariableOrPropertyAccess }; | |
export type VariableOrPropertyAccess = { Variable: [string, Span] } | { | |
PropertyAccess: { | |
parent: Expression; | |
property: PropertyReference; | |
position: Span; | |
}; | |
} | { | |
Index: { indexee: Expression; indexer: MultipleExpression; position: Span }; | |
}; | |
export type ExportPart = | |
| { Name: VariableIdentifier } | |
| { NameWithAlias: { name: string; alias: ImportExportName; position: Span } } | |
| { PrefixComment: [string, ExportPart | null, Span] } | |
| { PostfixComment: [ExportPart, string, Span] }; | |
export type ExportDeclaration = { | |
Variable: { exported: Exportable; position: Span }; | |
} | { Default: { expression: Expression; position: Span } }; | |
export type IsStatic = boolean; | |
export type ClassMember = | |
| { Constructor: ClassConstructor } | |
| { Method: [IsStatic, ClassFunction] } | |
| { Property: [IsStatic, ClassProperty] } | |
| { StaticBlock: Block } | |
| { Comment: [string, boolean, Span] }; | |
export interface ClassProperty { | |
is_readonly: boolean; | |
key: WithComment<PropertyKey<PublicOrPrivate>>; | |
type_annotation: TypeAnnotation | null; | |
value: Expression | null; | |
position: Span; | |
} | |
export type Exportable = | |
| { Class: ClassDeclaration<StatementPosition> } | |
| { Function: StatementFunction } | |
| { Variable: VariableDeclaration } | |
| { Interface: InterfaceDeclaration } | |
| { TypeAlias: TypeAlias } | |
| { Parts: ExportPart[] } | |
| { ImportAll: { as: VariableIdentifier | null; from: ImportLocation } } | |
| { | |
ImportParts: { | |
parts: ExportPart[]; | |
from: ImportLocation; | |
type_definitions_only: boolean; | |
}; | |
}; | |
export type TemplateLiteralPart<T> = { Static: string } | { Dynamic: T }; | |
export type SpanWithSource = BaseSpan<SourceId>; | |
export type Span = BaseSpan<null>; | |
export interface BaseSpan<T> { | |
start: number; | |
end: number; | |
source: T; | |
} | |
export type SourceId = number; | |
/** */ | |
export class CheckOptions { | |
free(): void; | |
/** */ | |
lsp_mode: boolean; | |
} | |
/** */ | |
export class WASMCheckOutput { | |
free(): void; | |
/** | |
* @param {string} path | |
* @param {number} pos | |
* @returns {string} | |
*/ | |
get_type_at_position(path: string, pos: number): string; | |
} | |
export type InitInput = | |
| RequestInfo | |
| URL | |
| Response | |
| BufferSource | |
| WebAssembly.Module; | |
export interface InitOutput { | |
readonly memory: WebAssembly.Memory; | |
readonly __wbg_checkoptions_free: (a: number) => void; | |
readonly __wbg_get_checkoptions_lsp_mode: (a: number) => number; | |
readonly __wbg_set_checkoptions_lsp_mode: (a: number, b: number) => void; | |
readonly experimental_build: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
) => number; | |
readonly __wbg_wasmcheckoutput_free: (a: number) => void; | |
readonly wasmcheckoutput_diagnostics: (a: number) => number; | |
readonly wasmcheckoutput_get_type_at_position: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
e: number, | |
) => void; | |
readonly check: (a: number, b: number, c: number) => number; | |
readonly check_with_options: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
) => number; | |
readonly run_cli: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
e: number, | |
) => void; | |
readonly parse_expression: (a: number, b: number) => number; | |
readonly parse_module: (a: number, b: number) => number; | |
readonly parse_module_and_into_string: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
) => number; | |
readonly just_imports: (a: number, b: number) => number; | |
readonly get_version: () => number; | |
readonly __wbindgen_malloc: (a: number, b: number) => number; | |
readonly __wbindgen_realloc: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
) => number; | |
readonly __wbindgen_add_to_stack_pointer: (a: number) => number; | |
readonly __wbindgen_free: (a: number, b: number, c: number) => void; | |
readonly __wbindgen_exn_store: (a: number) => void; | |
} | |
export type SyncInitInput = BufferSource | WebAssembly.Module; | |
/** | |
* Instantiates the given `module`, which can either be bytes or | |
* a precompiled `WebAssembly.Module`. | |
* | |
* @param {SyncInitInput} module | |
* | |
* @returns {InitOutput} | |
*/ | |
export function initSync(module: SyncInitInput): InitOutput; | |
/** | |
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and | |
* for everything else, calls `WebAssembly.instantiate` directly. | |
* | |
* @param {InitInput | Promise<InitInput>} module_or_path | |
* | |
* @returns {Promise<InitOutput>} | |
*/ | |
export default function __wbg_init( | |
module_or_path?: InitInput | Promise<InitInput>, | |
): Promise<InitOutput>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* tslint:disable */ | |
/* eslint-disable */ | |
/** | |
* @returns {any} | |
*/ | |
declare function get_version(): any; | |
export interface FailedBuildOutput { | |
diagnostics: DiagnosticsContainer; | |
} | |
export interface BuildOutput { | |
outputs: Output[]; | |
diagnostics: DiagnosticsContainer; | |
} | |
export interface Output { | |
output_path: string; | |
content: string; | |
mappings: string; | |
} | |
declare function experimental_build( | |
entry_path: string, | |
fs_resolve_js: (path: string) => string | undefined, | |
minify: boolean, | |
): { Ok: BuildOutput } | { Err: FailedBuildOutput }; | |
interface WASMCheckOutput { | |
readonly diagnostics: DiagnosticsContainer; | |
} | |
declare function check( | |
entry_path: string, | |
fs_resolver_js: (path: string) => string | undefined, | |
): WASMCheckOutput; | |
declare function check_with_options( | |
entry_path: string, | |
fs_resolver_js: (path: string) => string | undefined, | |
options: TypeCheckOptions, | |
): WASMCheckOutput; | |
declare function run_cli( | |
cli_arguments: string[], | |
read_from_file: (path: string) => string | undefined, | |
write_to_file: (path: string, content: string) => void, | |
cli_input_resolver: (prompt: string) => string | undefined, | |
): void; | |
declare function parse_expression(input: string): Expression | [string, Span]; | |
declare function parse_module(input: string): Module | [string, Span]; | |
declare function parse_module_and_into_string( | |
input: string, | |
parse_options: ParseOptions, | |
to_string_options: ToStringOptions, | |
): string | [string, Span]; | |
declare function just_imports(input: string): string | [string, Span]; | |
export interface TypeCheckOptions { | |
constant_parameters?: boolean; | |
allow_elided_arguments?: boolean; | |
allow_extra_arguments?: boolean; | |
constant_function_declarations?: boolean; | |
strict_casts?: boolean; | |
debug_types?: boolean; | |
store_expression_type_mappings?: boolean; | |
parse_comments?: boolean; | |
lsp_mode?: boolean; | |
} | |
export type DiagnosticsContainer = Diagnostic[]; | |
export type Diagnostic = { reason: string; kind: DiagnosticKind } | { | |
reason: string; | |
position: SpanWithSource; | |
kind: DiagnosticKind; | |
} | { | |
reason: string; | |
position: SpanWithSource; | |
labels: [string, SpanWithSource | null][]; | |
kind: DiagnosticKind; | |
}; | |
export type DiagnosticKind = "error" | "warning" | "info"; | |
export type SuperReference = { Call: { arguments: SpreadExpression[] } } | { | |
PropertyAccess: { property: string }; | |
} | { Index: { indexer: Expression } }; | |
export type SpecialOperators = { AsExpression: { value: Expression; type_annotation: TypeAnnotation } } | |
| { | |
SatisfiesExpression: { value: Expression; type_annotation: TypeAnnotation }; | |
} | |
| { InExpression: { lhs: InExpressionLHS; rhs: Expression } } | |
| { InstanceOfExpression: { lhs: Expression; rhs: Expression } } | |
| { IsExpression: { value: Expression; type_annotation: TypeAnnotation } }; | |
export type InExpressionLHS = { PrivateProperty: string } | { | |
Expression: Expression; | |
}; | |
export type MultipleExpression = { | |
lhs: MultipleExpression; | |
rhs: Expression; | |
position: Span; | |
} | Expression; | |
export type Expression = { NumberLiteral: [NumberRepresentation, Span] } | |
| { StringLiteral: [string, Quoted, Span] } | |
| { BooleanLiteral: [boolean, Span] } | |
| { RegexLiteral: { pattern: string; flags: string | null; position: Span } } | |
| { ArrayLiteral: [ArrayElement[], Span] } | |
| { ObjectLiteral: ObjectLiteral } | |
| { TemplateLiteral: TemplateLiteral } | |
| { ParenthesizedExpression: [MultipleExpression, Span] } | |
| { | |
BinaryOperation: { | |
lhs: Expression; | |
operator: BinaryOperator; | |
rhs: Expression; | |
position: Span; | |
}; | |
} | |
| { SpecialOperators: [SpecialOperators, Span] } | |
| { | |
UnaryOperation: { | |
operator: UnaryOperator; | |
operand: Expression; | |
position: Span; | |
}; | |
} | |
| { Assignment: { lhs: LHSOfAssignment; rhs: Expression; position: Span } } | |
| { | |
BinaryAssignmentOperation: { | |
lhs: VariableOrPropertyAccess; | |
operator: BinaryAssignmentOperator; | |
rhs: Expression; | |
position: Span; | |
}; | |
} | |
| { | |
UnaryPrefixAssignmentOperation: { | |
operator: UnaryPrefixAssignmentOperator; | |
operand: VariableOrPropertyAccess; | |
position: Span; | |
}; | |
} | |
| { | |
UnaryPostfixAssignmentOperation: { | |
operand: VariableOrPropertyAccess; | |
operator: UnaryPostfixAssignmentOperator; | |
position: Span; | |
}; | |
} | |
| { VariableReference: [string, Span] } | |
| { ThisReference: Span } | |
| { SuperExpression: [SuperReference, Span] } | |
| { NewTarget: Span } | |
| { | |
DynamicImport: { | |
path: Expression; | |
options: Expression | null; | |
position: Span; | |
}; | |
} | |
| { | |
PropertyAccess: { | |
parent: Expression; | |
property: PropertyReference; | |
is_optional: boolean; | |
position: Span; | |
}; | |
} | |
| { | |
Index: { | |
indexee: Expression; | |
indexer: MultipleExpression; | |
is_optional: boolean; | |
position: Span; | |
}; | |
} | |
| { | |
FunctionCall: { | |
function: Expression; | |
type_arguments: TypeAnnotation[] | null; | |
arguments: SpreadExpression[]; | |
is_optional: boolean; | |
position: Span; | |
}; | |
} | |
| { | |
ConstructorCall: { | |
constructor: Expression; | |
type_arguments: TypeAnnotation[] | null; | |
arguments: SpreadExpression[] | null; | |
position: Span; | |
}; | |
} | |
| { | |
ConditionalTernary: { | |
condition: Expression; | |
truthy_result: Expression; | |
falsy_result: Expression; | |
position: Span; | |
}; | |
} | |
| { ArrowFunction: ArrowFunction } | |
| { ExpressionFunction: ExpressionFunction } | |
| { ClassExpression: ClassDeclaration<ExpressionPosition> } | |
| { Null: Span } | |
| { | |
Comment: { | |
content: string; | |
on: Expression | null; | |
position: Span; | |
is_multiline: boolean; | |
prefix: boolean; | |
}; | |
} | |
| { JSXRoot: JSXRoot } | |
| { IsExpression: IsExpression } | |
| { Marker: { marker_id: Marker<Expression>; position: Span } }; | |
export type PropertyReference = { | |
Standard: { property: string; is_private: boolean }; | |
} | { Marker: Marker<PropertyReference> }; | |
export type SpreadExpression = { Spread: [Expression, Span] } | { | |
NonSpread: Expression; | |
}; | |
export type ArrayElement = SpreadExpression | null; | |
export type VariableKeyword = "Const" | "Let" | "Var"; | |
export type ExpressionPosition = VariableIdentifier | null; | |
export type StatementPosition = VariableIdentifier; | |
export type NumberRepresentation = "Infinity" | |
| "NegativeInfinity" | |
| "NaN" | |
| { Hex: { sign: NumberSign; value: number } } | |
| { Bin: { sign: NumberSign; value: number } } | |
| { Octal: { sign: NumberSign; value: number } } | |
| { Number: number } | |
| { Exponential: { sign: NumberSign; value: number; exponent: number } } | |
| { BigInt: [NumberSign, string] }; | |
export type NumberSign = "Positive" | "Negative"; | |
export type Comments = "All" | "JustDocumentation" | "None"; | |
export interface ToStringOptions { | |
pretty?: boolean; | |
trailing_semicolon?: boolean; | |
single_statement_on_new_line?: boolean; | |
include_types?: boolean; | |
include_decorators?: boolean; | |
comments?: Comments; | |
indent_with?: string; | |
expect_jsx?: boolean; | |
expect_markers?: boolean; | |
max_line_length?: number; | |
} | |
export interface ParseOptions { | |
jsx?: boolean; | |
type_annotations?: boolean; | |
special_jsx_attributes?: boolean; | |
decorators?: boolean; | |
comments?: Comments; | |
is_expressions?: boolean; | |
custom_function_headers?: boolean; | |
buffer_size?: number; | |
stack_size?: number | null; | |
record_keyword_positions?: boolean; | |
interpolation_points?: boolean; | |
partial_syntax?: boolean; | |
} | |
export type Quoted = "Single" | "Double"; | |
export type TypeAnnotation = { Name: [string, Span] } | |
| { CommonName: [CommonTypes, Span] } | |
| { NamespacedName: [string, string, Span] } | |
| { NameWithGenericArguments: [string, TypeAnnotation[], Span] } | |
| { Union: [TypeAnnotation[], Span] } | |
| { Intersection: [TypeAnnotation[], Span] } | |
| { StringLiteral: [string, Quoted, Span] } | |
| { NumberLiteral: [NumberRepresentation, Span] } | |
| { BooleanLiteral: [boolean, Span] } | |
| { ArrayLiteral: [TypeAnnotation, Span] } | |
| { FunctionLiteral: { | |
type_parameters: GenericTypeConstraint[] | null; | |
parameters: TypeAnnotationFunctionParameters; | |
return_type: TypeAnnotation; | |
position: Span; | |
} | |
} | { | |
ConstructorLiteral: { | |
type_parameters: GenericTypeConstraint[] | null; | |
parameters: TypeAnnotationFunctionParameters; | |
return_type: TypeAnnotation; | |
position: Span; | |
} | |
} | { TupleLiteral: [[SpreadKind, AnnotationWithBinder][], Span] } | |
// | { TemplateLiteral: [TemplateLiteralPart<AnnotationWithBinder>[], Span] } | |
| { Readonly: [TypeAnnotation, Span] } | |
| { Index: [TypeAnnotation, TypeAnnotation, Span] } | |
| { KeyOf: [TypeAnnotation, Span] } | |
| { ParenthesizedReference: [TypeAnnotation, Span] } | |
| { | |
Conditional: { | |
condition: TypeCondition; | |
resolve_true: TypeConditionResult; | |
resolve_false: TypeConditionResult; | |
position: Span; | |
} | |
} | |
| { Decorated: [Decorator, TypeAnnotation, Span] } | |
| { Marker: [Marker<TypeAnnotation>, Span] }; | |
export type AnnotationWithBinder = { | |
Annotated: { name: string; ty: TypeAnnotation; position: Span }; | |
} | { NoAnnotation: TypeAnnotation }; | |
export type SpreadKind = "NonSpread" | "Spread"; | |
export type TypeCondition = { | |
Extends: { ty: TypeAnnotation; extends: TypeAnnotation; position: Span }; | |
} | { Is: { ty: TypeAnnotation; is: TypeAnnotation; position: Span } }; | |
export type CommonTypes = "String" | "Number" | "Boolean"; | |
export type TypeConditionResult = { Infer: [TypeAnnotation, Span] } | { | |
Reference: TypeAnnotation; | |
}; | |
export interface TypeAnnotationFunctionParameters { | |
parameters: TypeAnnotationFunctionParameter[]; | |
rest_parameter: TypeAnnotationSpreadFunctionParameter | null; | |
position: Span; | |
} | |
export interface TypeAnnotationFunctionParameter { | |
decorators: Decorator[]; | |
// name: WithComment<VariableField<VariableFieldInTypeAnnotation>> | null; | |
type_annotation: TypeAnnotation; | |
is_optional: boolean; | |
position: Span; | |
} | |
export interface TypeAnnotationSpreadFunctionParameter { | |
decorators: Decorator[]; | |
name: string; | |
type_annotation: TypeAnnotation; | |
position: Span; | |
} | |
export type AlwaysPublic = false; | |
export type PublicOrPrivate = boolean; | |
export type PropertyKey<T> = { Ident: [string, Span, T] } | |
| { StringLiteral: [string, Quoted, Span] } | |
| { NumberLiteral: [NumberRepresentation, Span] } | |
| { Computed: [Expression, Span] }; | |
export type InterfaceMember = { | |
Method: { | |
header: MethodHeader; | |
name: PropertyKey<PublicOrPrivate>; | |
type_parameters: GenericTypeConstraint[] | null; | |
parameters: TypeAnnotationFunctionParameters; | |
return_type: TypeAnnotation | null; | |
is_optional: boolean; | |
performs: AnnotationPerforms | null; | |
position: Span; | |
}; | |
} | { | |
Property: { | |
name: PropertyKey<PublicOrPrivate>; | |
type_annotation: TypeAnnotation; | |
is_readonly: boolean; | |
is_optional: boolean; | |
position: Span; | |
}; | |
} | { | |
Indexer: { | |
name: string; | |
indexer_type: TypeAnnotation; | |
return_type: TypeAnnotation; | |
is_readonly: boolean; | |
position: Span; | |
}; | |
} | { | |
Constructor: { | |
parameters: TypeAnnotationFunctionParameters; | |
type_parameters: GenericTypeConstraint[] | null; | |
return_type: TypeAnnotation | null; | |
is_readonly: boolean; | |
performs: AnnotationPerforms | null; | |
position: Span; | |
}; | |
} | { | |
Caller: { | |
parameters: TypeAnnotationFunctionParameters; | |
type_parameters: GenericTypeConstraint[] | null; | |
return_type: TypeAnnotation | null; | |
is_readonly: boolean; | |
position: Span; | |
}; | |
} | { | |
Rule: { | |
parameter: string; | |
rule: TypeRule; | |
matching_type: TypeAnnotation; | |
optionality: Optionality; | |
is_readonly: boolean; | |
output_type: TypeAnnotation; | |
position: Span; | |
}; | |
} | { Comment: [string, boolean, Span] }; | |
export interface InterfaceDeclaration { | |
name: string; | |
is_nominal: boolean; | |
type_parameters: GenericTypeConstraint[] | null; | |
extends: TypeAnnotation[] | null; | |
// members: WithComment<Decorated<InterfaceMember>>[]; | |
position: Span; | |
} | |
export interface ClassDeclaration<T> { | |
name: T; | |
type_parameters: GenericTypeConstraint[] | null; | |
extends: Expression | null; | |
implements: TypeAnnotation[] | null; | |
// members: Decorated<ClassMember>[]; | |
position: Span; | |
} | |
export type Optionality = "Default" | "Optional" | "Required"; | |
export type TypeRule = "In" | "InKeyOf"; | |
export type AnnotationPerforms = { PerformsStatements: { body: Block } } | { | |
PerformsConst: { identifier: string }; | |
}; | |
export interface IfStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
else_conditions: ConditionalElseStatement[]; | |
trailing_else: UnconditionalElseStatement | null; | |
position: Span; | |
} | |
export interface ForLoopStatement { | |
condition: ForLoopCondition; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export type Block = [StatementOrDeclaration[], Span]; | |
export type StatementOrDeclaration = { Statement: Statement } | { | |
Declaration: Declaration; | |
} | { Marker: [Marker<Statement>, Span] }; | |
export type BlockOrSingleStatement = { Braced: Block } | { | |
SingleStatement: Statement; | |
}; | |
export type ForLoopStatementInitializer = { VariableDeclaration: VariableDeclaration } | |
| { VarStatement: VarVariableStatement } | |
| { Expression: MultipleExpression }; | |
export type ForLoopCondition = { | |
ForOf: { | |
keyword: VariableKeyword | null; | |
variable: WithComment<VariableField<VariableFieldInSourceCode>>; | |
of: Expression; | |
position: Span; | |
}; | |
} | { | |
ForIn: { | |
keyword: VariableKeyword | null; | |
variable: WithComment<VariableField<VariableFieldInSourceCode>>; | |
in: MultipleExpression; | |
position: Span; | |
}; | |
} | { | |
Statements: { | |
initialiser: ForLoopStatementInitializer | null; | |
condition: MultipleExpression | null; | |
afterthought: MultipleExpression | null; | |
position: Span; | |
}; | |
}; | |
export interface ConditionalElseStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface UnconditionalElseStatement { | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface FunctionBase { | |
type_parameters?: GenericTypeConstraint[]; | |
parameters: FunctionParameters; | |
return_type?: TypeAnnotation; | |
position: Span; | |
} | |
export interface ExpressionFunction extends FunctionBase { | |
header: FunctionHeader; | |
body: Block; | |
name: ExpressionPosition; | |
} | |
export interface TryCatchStatement { | |
try_inner: Block; | |
catch_inner: Block | null; | |
exception_var: [ExceptionVarField, TypeAnnotation | null] | null; | |
finally_inner: Block | null; | |
position: Span; | |
} | |
export type ExceptionVarField = WithComment< | |
VariableField<VariableFieldInSourceCode> | |
>; | |
export type FunctionLocationModifier = "Server" | "Worker"; | |
export type FunctionHeader = { | |
VirginFunctionHeader: { | |
is_async: boolean; | |
location: FunctionLocationModifier | null; | |
generator_star_token_position: Span | null; | |
position: Span; | |
}; | |
} | { | |
ChadFunctionHeader: { | |
is_async: boolean; | |
is_generator: boolean; | |
location: FunctionLocationModifier | null; | |
position: Span; | |
}; | |
}; | |
export type MethodHeader = "Get" | "Set" | { | |
Regular: { is_async: boolean; generator: GeneratorSpecifier | null }; | |
}; | |
export type GeneratorSpecifier = { Star: Span } | "Keyword"; | |
export interface StatementFunction extends FunctionBase { | |
header: FunctionHeader; | |
body: Block; | |
name: StatementPosition; | |
} | |
export interface VarVariableStatement { | |
// declarations: VariableDeclarationItem<Expression | null>[]; | |
position: Span; | |
} | |
export type ThrowStatement = [MultipleExpression, Span]; | |
export type ReturnStatement = [MultipleExpression | null, Span]; | |
export type Statement = { Expression: MultipleExpression } | |
| { Block: Block } | |
| { Debugger: Span } | |
| { If: IfStatement } | |
| { ForLoop: ForLoopStatement } | |
| { Switch: SwitchStatement } | |
| { WhileLoop: WhileStatement } | |
| { DoWhileLoop: DoWhileStatement } | |
| { TryCatch: TryCatchStatement } | |
| { Return: ReturnStatement } | |
| { Continue: [string | null, Span] } | |
| { Break: [string | null, Span] } | |
| { Throw: ThrowStatement } | |
| { Comment: [string, Span] } | |
| { MultiLineComment: [string, Span] } | |
| { Labelled: { position: Span; name: string; statement: Statement } } | |
| { VarVariable: VarVariableStatement } | |
| { Empty: Span }; | |
export interface DoWhileStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface WhileStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface IsExpression { | |
matcher: MultipleExpression; | |
branches: [TypeAnnotation, ExpressionOrBlock][]; | |
position: Span; | |
} | |
export type ImportLocation = { Quoted: [string, Quoted] } | { | |
Marker: Marker<ImportLocation>; | |
}; | |
export type Declaration = { Variable: VariableDeclaration } | |
| { Function: Decorated<StatementFunction> } | |
| { Class: Decorated<ClassDeclaration<StatementPosition>> } | |
| { Enum: Decorated<EnumDeclaration> } | |
| { Interface: Decorated<InterfaceDeclaration> } | |
| { TypeAlias: TypeAlias } | |
| { DeclareVariable: DeclareVariableDeclaration } | |
| { DeclareFunction: DeclareFunctionDeclaration } | |
| { DeclareInterface: InterfaceDeclaration } | |
| { Import: ImportDeclaration } | |
| { Export: Decorated<ExportDeclaration> }; | |
type Marker<T> = number; | |
export type ObjectDestructuringField<T> = { Name: [VariableIdentifier, Expression | null, Span] } | |
| { Spread: [VariableIdentifier, Span] } | |
| { | |
Map: { | |
from: PropertyKey<AlwaysPublic>; | |
name: WithComment<VariableField<T>>; | |
default_value: Expression | null; | |
position: Span; | |
}; | |
}; | |
export type VariableField<T> = { Name: VariableIdentifier } | { | |
Array: WithComment<ArrayDestructuringField<T>>; | |
} | { Object: WithComment<ObjectDestructuringField<T>> }; | |
export type VariableIdentifier = { Standard: [string, Span] } | { | |
Marker: [VariableIdentifier, Span]; | |
}; | |
export type VariableDeclaration = { | |
ConstDeclaration: { | |
declarations: VariableDeclarationItem<Expression>; | |
position: Span; | |
}; | |
} | { | |
LetDeclaration: { | |
declarations: VariableDeclarationItem<Expression | null>; | |
position: Span; | |
}; | |
}; | |
export interface VariableDeclarationItem<TExpr> { | |
name: WithComment<VariableField<VariableFieldInSourceCode>>; | |
type_annotation: TypeAnnotation | null; | |
expression: TExpr; | |
position: Span; | |
} | |
export type VariableDeclarationKeyword = "Const" | "Let"; | |
export type VariableFieldInSourceCode = null; | |
export type VariableFieldInTypeAnnotation = null; | |
export type ArrayDestructuringField<T> = { Spread: [VariableIdentifier, Span] } | |
| { Name: VariableField<T> } | |
| "None"; | |
export interface FunctionParameters { | |
this_type: [TypeAnnotation, Span] | null; | |
super_type: [TypeAnnotation, Span] | null; | |
parameters: Parameter[]; | |
rest_parameter: SpreadParameter | null; | |
position: Span; | |
} | |
export interface Parameter { | |
name: WithComment<VariableField<VariableFieldInSourceCode>>; | |
type_annotation: TypeAnnotation | null; | |
additionally: ParameterData | null; | |
position: Span; | |
} | |
export type ParameterData = "Optional" | { WithDefaultValue: Expression }; | |
export interface SpreadParameter { | |
name: VariableIdentifier; | |
type_annotation: TypeAnnotation | null; | |
position: Span; | |
} | |
export interface DeclareClassDeclaration { | |
name: string; | |
type_parameters: GenericTypeConstraint[] | null; | |
extends: TypeAnnotation | null; | |
} | |
export interface DeclareFunctionDeclaration { | |
name: string; | |
type_parameters: GenericTypeConstraint[] | null; | |
parameters: TypeAnnotationFunctionParameters; | |
return_type: TypeAnnotation | null; | |
performs: AnnotationPerforms | null; | |
decorators: Decorator[]; | |
position: Span; | |
} | |
export interface DeclareVariableDeclaration { | |
keyword: VariableKeyword; | |
declarations: VariableDeclarationItem<Expression | null>; | |
position: Span; | |
decorators: Decorator[]; | |
} | |
export type WithComment<T> = { None: T } | |
| { PrefixComment: [string, T, Span] } | |
| { PostfixComment: [T, string, Span] }; | |
export interface EnumDeclaration { | |
is_constant: boolean; | |
name: string; | |
members: EnumMember[]; | |
position: Span; | |
} | |
export type EnumMember = { | |
Variant: { name: string; value: Expression | null; position: Span }; | |
}; | |
export interface ObjectLiteralMethod extends FunctionBase { | |
header: MethodHeader; | |
body: Block; | |
name: WithComment<PropertyKey<AlwaysPublic>>; | |
} | |
export interface TypeAlias { | |
type_name: TypeDeclaration; | |
type_expression: TypeAnnotation; | |
position: Span; | |
} | |
export interface SwitchStatement { | |
case: MultipleExpression; | |
branches: SwitchBranch[]; | |
position: Span; | |
} | |
export interface JSXFragment { | |
children: JSXNode[]; | |
position: Span; | |
} | |
export interface JSXElement { | |
tag_name: string; | |
attributes: JSXAttribute[]; | |
children: JSXElementChildren; | |
position: Span; | |
} | |
export type JSXRoot = { Element: JSXElement } | { Fragment: JSXFragment }; | |
export type ObjectLiteralMember = { Spread: [Expression, Span] } | |
| { Shorthand: [string, Span] } | |
| { Property: [WithComment<PropertyKey<AlwaysPublic>>, Expression, Span] } | |
| { Method: ObjectLiteralMethod }; | |
export interface ObjectLiteral { | |
members: ObjectLiteralMember[]; | |
position: Span; | |
} | |
export type JSXElementChildren = { Children: JSXNode[] } | "SelfClosing"; | |
export type JSXNode = { TextNode: [string, Span] } | |
| { InterpolatedExpression: [Expression, Span] } | |
| { Element: JSXElement } | |
| "LineBreak"; | |
export type JSXAttribute = { Static: [string, string, Span] } | |
| { Dynamic: [string, Expression, Span] } | |
| { BooleanAttribute: [string, Span] } | |
| { Spread: [Expression, Span] } | |
| { Shorthand: Expression }; | |
export type BinaryOperator = "Add" | |
| "Subtract" | |
| "Multiply" | |
| "Divide" | |
| "Modulo" | |
| "Exponent" | |
| "BitwiseShiftLeft" | |
| "BitwiseShiftRight" | |
| "BitwiseShiftRightUnsigned" | |
| "BitwiseAnd" | |
| "BitwiseXOr" | |
| "BitwiseOr" | |
| "StrictEqual" | |
| "StrictNotEqual" | |
| "Equal" | |
| "NotEqual" | |
| "GreaterThan" | |
| "LessThan" | |
| "LessThanEqual" | |
| "GreaterThanEqual" | |
| "LogicalAnd" | |
| "LogicalOr" | |
| "NullCoalescing" | |
| "Divides" | |
| "Pipe" | |
| "Compose"; | |
export type BinaryAssignmentOperator = "LogicalNullishAssignment" | |
| "AddAssign" | |
| "SubtractAssign" | |
| "MultiplyAssign" | |
| "DivideAssign" | |
| "ModuloAssign" | |
| "ExponentAssign" | |
| "LogicalAndAssign" | |
| "LogicalOrAssign" | |
| "BitwiseShiftLeftAssign" | |
| "BitwiseShiftRightAssign" | |
| "BitwiseShiftRightUnsigned" | |
| "BitwiseAndAssign" | |
| "BitwiseXOrAssign" | |
| "BitwiseOrAssign"; | |
export type UnaryOperator = "Plus" | |
| "Negation" | |
| "BitwiseNot" | |
| "LogicalNot" | |
| "Await" | |
| "TypeOf" | |
| "Void" | |
| "Delete" | |
| "Yield" | |
| "DelegatedYield"; | |
export type IncrementOrDecrement = "Increment" | "Decrement"; | |
export type UnaryPrefixAssignmentOperator = "Invert" | { | |
IncrementOrDecrement: IncrementOrDecrement; | |
}; | |
export type UnaryPostfixAssignmentOperator = IncrementOrDecrement; | |
export type SwitchBranch = { Default: StatementOrDeclaration[] } | { | |
Case: [Expression, StatementOrDeclaration[]]; | |
}; | |
export interface ArrowFunction extends Omit<FunctionBase, "name"> { | |
header: IsAsync; | |
body: ExpressionOrBlock; | |
} | |
export interface Decorated<T> { | |
decorators: Decorator[]; | |
on: T; | |
position: Span; | |
} | |
export type IsAsync = boolean; | |
export type ImportPart = { Name: VariableIdentifier } | |
| { NameWithAlias: { name: string; alias: ImportExportName; position: Span } } | |
| { PrefixComment: [string, ImportPart | null, Span] } | |
| { PostfixComment: [ImportPart, string, Span] }; | |
export interface ImportDeclaration { | |
is_deferred: boolean; | |
is_type_annotation_import_only: boolean; | |
default: VariableIdentifier | null; | |
items: ImportedItems; | |
from: ImportLocation; | |
position: Span; | |
reversed: boolean; | |
} | |
export type ImportedItems = { Parts: ImportPart[] | null } | { | |
All: { under: VariableIdentifier }; | |
}; | |
export type ImportExportName = { Reference: string } | { | |
Quoted: [string, Quoted]; | |
} | { Marker: Marker<ImportExportName> }; | |
export type ExpressionOrBlock = { Expression: Expression } | { Block: Block }; | |
export interface Decorator { | |
name: string[]; | |
arguments: Expression[] | null; | |
position: Span; | |
} | |
export interface TypeDeclaration { | |
name: string; | |
type_parameters: GenericTypeConstraint[] | null; | |
position: Span; | |
} | |
export type GenericTypeConstraint = { Parameter: { name: string; default: TypeAnnotation | null } } | |
| { Extends: [string, TypeAnnotation] } | |
| { ExtendsKeyOf: [string, TypeAnnotation] } | |
| { Spread: { name: string; default: TypeAnnotation | null } }; | |
export interface ClassConstructor | |
extends Omit<FunctionBase, "header" | "name"> { | |
body: Block; | |
} | |
export interface ClassFunction extends FunctionBase { | |
header: MethodHeader; | |
body: Block; | |
name: WithComment<PropertyKey<PublicOrPrivate>>; | |
} | |
export interface Module { | |
items: StatementOrDeclaration[]; | |
span: Span; | |
} | |
export interface TemplateLiteral { | |
tag: Expression | null; | |
parts: TemplateLiteralPart<Expression>; | |
position: Span; | |
} | |
export type LHSOfAssignment = { | |
ObjectDestructuring: WithComment<ObjectDestructuringField<VariableFieldInSourceCode>>; | |
} | { | |
ArrayDestructuring: WithComment<ArrayDestructuringField<VariableFieldInSourceCode>>; | |
} | { VariableOrPropertyAccess: VariableOrPropertyAccess }; | |
export type VariableOrPropertyAccess = { Variable: [string, Span] } | { | |
PropertyAccess: { | |
parent: Expression; | |
property: PropertyReference; | |
position: Span; | |
}; | |
} | { | |
Index: { indexee: Expression; indexer: MultipleExpression; position: Span }; | |
}; | |
export type ExportPart = { Name: VariableIdentifier } | |
| { NameWithAlias: { name: string; alias: ImportExportName; position: Span } } | |
| { PrefixComment: [string, ExportPart | null, Span] } | |
| { PostfixComment: [ExportPart, string, Span] }; | |
export type ExportDeclaration = { | |
Variable: { exported: Exportable; position: Span }; | |
} | { Default: { expression: Expression; position: Span } }; | |
export type IsStatic = boolean; | |
export type ClassMember = { Constructor: ClassConstructor } | |
| { Method: [IsStatic, ClassFunction] } | |
| { Property: [IsStatic, ClassProperty] } | |
| { StaticBlock: Block } | |
| { Comment: [string, boolean, Span] }; | |
export interface ClassProperty { | |
is_readonly: boolean; | |
key: WithComment<PropertyKey<PublicOrPrivate>>; | |
type_annotation: TypeAnnotation | null; | |
value: Expression | null; | |
position: Span; | |
} | |
export type Exportable = { Class: ClassDeclaration<StatementPosition> } | |
| { Function: StatementFunction } | |
| { Variable: VariableDeclaration } | |
| { Interface: InterfaceDeclaration } | |
| { TypeAlias: TypeAlias } | |
| { Parts: ExportPart[] } | |
| { ImportAll: { as: VariableIdentifier | null; from: ImportLocation } } | |
| { | |
ImportParts: { | |
parts: ExportPart[]; | |
from: ImportLocation; | |
type_definitions_only: boolean; | |
}; | |
}; | |
export type TemplateLiteralPart<T> = { Static: string } | { Dynamic: T }; | |
export type SpanWithSource = BaseSpan<SourceId>; | |
export type Span = BaseSpan<null>; | |
export interface BaseSpan<T> { | |
start: number; | |
end: number; | |
source: T; | |
} | |
export type SourceId = number; | |
export type InitInput = RequestInfo | |
| URL | |
| Response | |
| BufferSource | |
| WebAssembly.Module; | |
export interface InitOutput { | |
readonly memory: WebAssembly.Memory; | |
readonly __wbg_checkoptions_free: (a: number) => void; | |
readonly __wbg_get_checkoptions_lsp_mode: (a: number) => number; | |
readonly __wbg_set_checkoptions_lsp_mode: (a: number, b: number) => void; | |
readonly experimental_build: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
) => number; | |
readonly __wbg_wasmcheckoutput_free: (a: number) => void; | |
readonly wasmcheckoutput_diagnostics: (a: number) => number; | |
readonly wasmcheckoutput_get_type_at_position: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
e: number, | |
) => void; | |
readonly check: (a: number, b: number, c: number) => number; | |
readonly check_with_options: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
) => number; | |
readonly run_cli: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
e: number, | |
) => void; | |
readonly parse_expression: (a: number, b: number) => number; | |
readonly parse_module: (a: number, b: number) => number; | |
readonly parse_module_and_into_string: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
) => number; | |
readonly just_imports: (a: number, b: number) => number; | |
readonly get_version: () => number; | |
readonly __wbindgen_malloc: (a: number, b: number) => number; | |
readonly __wbindgen_realloc: ( | |
a: number, | |
b: number, | |
c: number, | |
d: number, | |
) => number; | |
readonly __wbindgen_add_to_stack_pointer: (a: number) => number; | |
readonly __wbindgen_free: (a: number, b: number, c: number) => void; | |
readonly __wbindgen_exn_store: (a: number) => void; | |
} | |
export type SyncInitInput = BufferSource | WebAssembly.Module; | |
/** | |
* Instantiates the given `module`, which can either be bytes or | |
* a precompiled `WebAssembly.Module`. | |
* | |
* @param {SyncInitInput} module | |
* | |
* @returns {InitOutput} | |
*/ | |
declare function initSync(module: SyncInitInput): InitOutput; | |
/** | |
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and | |
* for everything else, calls `WebAssembly.instantiate` directly. | |
* | |
* @param {InitInput | Promise<InitInput>} module_or_path | |
* | |
* @returns {Promise<InitOutput>} | |
*/ | |
declare function __wbg_init( | |
module_or_path?: InitInput | Promise<InitInput>, | |
): Promise<InitOutput>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* tslint:disable */ | |
/* eslint-disable */ | |
/** | |
* @returns {any} | |
*/ | |
export function get_version(): any; | |
export interface FailedBuildOutput { | |
diagnostics: DiagnosticsContainer; | |
} | |
export interface BuildOutput { | |
outputs: Output[]; | |
diagnostics: DiagnosticsContainer; | |
} | |
export interface Output { | |
output_path: string; | |
content: string; | |
mappings: string; | |
} | |
export function experimental_build( | |
entry_path: string, fs_resolve_js: (path: string) => string | undefined, minify: boolean | |
): {Ok: BuildOutput} | {Err: FailedBuildOutput} | |
interface WASMCheckOutput { | |
readonly diagnostics: DiagnosticsContainer | |
} | |
export function check(entry_path: string, fs_resolver_js: (path: string) => string | undefined): WASMCheckOutput | |
export function check_with_options(entry_path: string, fs_resolver_js: (path: string) => string | undefined, options: TypeCheckOptions): WASMCheckOutput | |
export function run_cli( | |
cli_arguments: string[], | |
read_from_file: (path: string) => string | undefined, | |
write_to_file: (path: string, content: string) => void, | |
cli_input_resolver: (prompt: string) => string | undefined | |
): void | |
export function parse_expression(input: string): Expression | [string, Span] | |
export function parse_module(input: string): Module | [string, Span] | |
export function parse_module_and_into_string( | |
input: string, | |
parse_options: ParseOptions, | |
to_string_options: ToStringOptions | |
): string | [string, Span] | |
export function just_imports(input: string): string | [string, Span] | |
export interface TypeCheckOptions { | |
constant_parameters?: boolean; | |
allow_elided_arguments?: boolean; | |
allow_extra_arguments?: boolean; | |
constant_function_declarations?: boolean; | |
strict_casts?: boolean; | |
debug_types?: boolean; | |
store_expression_type_mappings?: boolean; | |
parse_comments?: boolean; | |
lsp_mode?: boolean; | |
} | |
export type DiagnosticsContainer = Diagnostic[]; | |
export type Diagnostic = { reason: string; kind: DiagnosticKind } | { reason: string; position: SpanWithSource; kind: DiagnosticKind } | { reason: string; position: SpanWithSource; labels: [string, SpanWithSource | null][]; kind: DiagnosticKind }; | |
export type DiagnosticKind = "error" | "warning" | "info"; | |
export type SuperReference = { Call: { arguments: SpreadExpression[] } } | { PropertyAccess: { property: string } } | { Index: { indexer: Expression } }; | |
export type SpecialOperators = { AsExpression: { value: Expression; type_annotation: TypeAnnotation } } | { SatisfiesExpression: { value: Expression; type_annotation: TypeAnnotation } } | { InExpression: { lhs: InExpressionLHS; rhs: Expression } } | { InstanceOfExpression: { lhs: Expression; rhs: Expression } } | { IsExpression: { value: Expression; type_annotation: TypeAnnotation } }; | |
export type InExpressionLHS = { PrivateProperty: string } | { Expression: Expression }; | |
export type MultipleExpression = { lhs: MultipleExpression; rhs: Expression; position: Span } | Expression; | |
export type Expression = { NumberLiteral: [NumberRepresentation, Span] } | { StringLiteral: [string, Quoted, Span] } | { BooleanLiteral: [boolean, Span] } | { RegexLiteral: { pattern: string; flags: string | null; position: Span } } | { ArrayLiteral: [ArrayElement[], Span] } | { ObjectLiteral: ObjectLiteral } | { TemplateLiteral: TemplateLiteral } | { ParenthesizedExpression: [MultipleExpression, Span] } | { BinaryOperation: { lhs: Expression; operator: BinaryOperator; rhs: Expression; position: Span } } | { SpecialOperators: [SpecialOperators, Span] } | { UnaryOperation: { operator: UnaryOperator; operand: Expression; position: Span } } | { Assignment: { lhs: LHSOfAssignment; rhs: Expression; position: Span } } | { BinaryAssignmentOperation: { lhs: VariableOrPropertyAccess; operator: BinaryAssignmentOperator; rhs: Expression; position: Span } } | { UnaryPrefixAssignmentOperation: { operator: UnaryPrefixAssignmentOperator; operand: VariableOrPropertyAccess; position: Span } } | { UnaryPostfixAssignmentOperation: { operand: VariableOrPropertyAccess; operator: UnaryPostfixAssignmentOperator; position: Span } } | { VariableReference: [string, Span] } | { ThisReference: Span } | { SuperExpression: [SuperReference, Span] } | { NewTarget: Span } | { DynamicImport: { path: Expression; options: Expression | null; position: Span } } | { PropertyAccess: { parent: Expression; property: PropertyReference; is_optional: boolean; position: Span } } | { Index: { indexee: Expression; indexer: MultipleExpression; is_optional: boolean; position: Span } } | { FunctionCall: { function: Expression; type_arguments: TypeAnnotation[] | null; arguments: SpreadExpression[]; is_optional: boolean; position: Span } } | { ConstructorCall: { constructor: Expression; type_arguments: TypeAnnotation[] | null; arguments: SpreadExpression[] | null; position: Span } } | { ConditionalTernary: { condition: Expression; truthy_result: Expression; falsy_result: Expression; position: Span } } | { ArrowFunction: ArrowFunction } | { ExpressionFunction: ExpressionFunction } | { ClassExpression: ClassDeclaration<ExpressionPosition> } | { Null: Span } | { Comment: { content: string; on: Expression | null; position: Span; is_multiline: boolean; prefix: boolean } } | { JSXRoot: JSXRoot } | { IsExpression: IsExpression } | { Marker: { marker_id: Marker<Expression>; position: Span } }; | |
export type PropertyReference = { Standard: { property: string; is_private: boolean } } | { Marker: Marker<PropertyReference> }; | |
export type SpreadExpression = { Spread: [Expression, Span] } | { NonSpread: Expression }; | |
export type ArrayElement = SpreadExpression | null; | |
export type VariableKeyword = "Const" | "Let" | "Var"; | |
export type ExpressionPosition = VariableIdentifier | null; | |
export type StatementPosition = VariableIdentifier; | |
export type NumberRepresentation = "Infinity" | "NegativeInfinity" | "NaN" | { Hex: { sign: NumberSign; value: number } } | { Bin: { sign: NumberSign; value: number } } | { Octal: { sign: NumberSign; value: number } } | { Number: number } | { Exponential: { sign: NumberSign; value: number; exponent: number } } | { BigInt: [NumberSign, string] }; | |
export type NumberSign = "Positive" | "Negative"; | |
export type Comments = "All" | "JustDocumentation" | "None"; | |
export interface ToStringOptions { | |
pretty?: boolean; | |
trailing_semicolon?: boolean; | |
single_statement_on_new_line?: boolean; | |
include_types?: boolean; | |
include_decorators?: boolean; | |
comments?: Comments; | |
indent_with?: string; | |
expect_jsx?: boolean; | |
expect_markers?: boolean; | |
max_line_length?: number; | |
} | |
export interface ParseOptions { | |
jsx?: boolean; | |
type_annotations?: boolean; | |
special_jsx_attributes?: boolean; | |
decorators?: boolean; | |
comments?: Comments; | |
is_expressions?: boolean; | |
custom_function_headers?: boolean; | |
buffer_size?: number; | |
stack_size?: number | null; | |
record_keyword_positions?: boolean; | |
interpolation_points?: boolean; | |
partial_syntax?: boolean; | |
} | |
export type Quoted = "Single" | "Double"; | |
export type TypeAnnotation = { Name: [string, Span] } | { CommonName: [CommonTypes, Span] } | { NamespacedName: [string, string, Span] } | { NameWithGenericArguments: [string, TypeAnnotation[], Span] } | { Union: [TypeAnnotation[], Span] } | { Intersection: [TypeAnnotation[], Span] } | { StringLiteral: [string, Quoted, Span] } | { NumberLiteral: [NumberRepresentation, Span] } | { BooleanLiteral: [boolean, Span] } | { ArrayLiteral: [TypeAnnotation, Span] } | { FunctionLiteral: { type_parameters: GenericTypeConstraint[] | null; parameters: TypeAnnotationFunctionParameters; return_type: TypeAnnotation; position: Span } } | { ConstructorLiteral: { type_parameters: GenericTypeConstraint[] | null; parameters: TypeAnnotationFunctionParameters; return_type: TypeAnnotation; position: Span } } | { ObjectLiteral: [WithComment<Decorated<InterfaceMember>>[], Span] } | { TupleLiteral: [[SpreadKind, AnnotationWithBinder][], Span] } | { TemplateLiteral: [TemplateLiteralPart<AnnotationWithBinder>[], Span] } | { Readonly: [TypeAnnotation, Span] } | { Index: [TypeAnnotation, TypeAnnotation, Span] } | { KeyOf: [TypeAnnotation, Span] } | { ParenthesizedReference: [TypeAnnotation, Span] } | { Conditional: { condition: TypeCondition; resolve_true: TypeConditionResult; resolve_false: TypeConditionResult; position: Span } } | { Decorated: [Decorator, TypeAnnotation, Span] } | { Marker: [Marker<TypeAnnotation>, Span] }; | |
export type AnnotationWithBinder = { Annotated: { name: string; ty: TypeAnnotation; position: Span } } | { NoAnnotation: TypeAnnotation }; | |
export type SpreadKind = "NonSpread" | "Spread"; | |
export type TypeCondition = { Extends: { ty: TypeAnnotation; extends: TypeAnnotation; position: Span } } | { Is: { ty: TypeAnnotation; is: TypeAnnotation; position: Span } }; | |
export type CommonTypes = "String" | "Number" | "Boolean"; | |
export type TypeConditionResult = { Infer: [TypeAnnotation, Span] } | { Reference: TypeAnnotation }; | |
export interface TypeAnnotationFunctionParameters { | |
parameters: TypeAnnotationFunctionParameter[]; | |
rest_parameter: TypeAnnotationSpreadFunctionParameter | null; | |
position: Span; | |
} | |
export interface TypeAnnotationFunctionParameter { | |
decorators: Decorator[]; | |
name: WithComment<VariableField<VariableFieldInTypeAnnotation>> | null; | |
type_annotation: TypeAnnotation; | |
is_optional: boolean; | |
position: Span; | |
} | |
export interface TypeAnnotationSpreadFunctionParameter { | |
decorators: Decorator[]; | |
name: string; | |
type_annotation: TypeAnnotation; | |
position: Span; | |
} | |
export type AlwaysPublic = false; | |
export type PublicOrPrivate = boolean; | |
export type PropertyKey<T> = | |
| { Ident: [string, Span, T] } | |
| { StringLiteral: [string, Quoted, Span] } | |
| { NumberLiteral: [NumberRepresentation, Span] } | |
| { Computed: [Expression, Span] }; | |
export type InterfaceMember = { Method: { header: MethodHeader; name: PropertyKey<PublicOrPrivate>; type_parameters: GenericTypeConstraint[] | null; parameters: TypeAnnotationFunctionParameters; return_type: TypeAnnotation | null; is_optional: boolean; performs: AnnotationPerforms | null; position: Span } } | { Property: { name: PropertyKey<PublicOrPrivate>; type_annotation: TypeAnnotation; is_readonly: boolean; is_optional: boolean; position: Span } } | { Indexer: { name: string; indexer_type: TypeAnnotation; return_type: TypeAnnotation; is_readonly: boolean; position: Span } } | { Constructor: { parameters: TypeAnnotationFunctionParameters; type_parameters: GenericTypeConstraint[] | null; return_type: TypeAnnotation | null; is_readonly: boolean; performs: AnnotationPerforms | null; position: Span } } | { Caller: { parameters: TypeAnnotationFunctionParameters; type_parameters: GenericTypeConstraint[] | null; return_type: TypeAnnotation | null; is_readonly: boolean; position: Span } } | { Rule: { parameter: string; rule: TypeRule; matching_type: TypeAnnotation; optionality: Optionality; is_readonly: boolean; output_type: TypeAnnotation; position: Span } } | { Comment: [string, boolean, Span] }; | |
export interface InterfaceDeclaration { | |
name: string; | |
is_nominal: boolean; | |
type_parameters: GenericTypeConstraint[] | null; | |
extends: TypeAnnotation[] | null; | |
members: WithComment<Decorated<InterfaceMember>>[]; | |
position: Span; | |
} | |
export interface ClassDeclaration<T> { | |
name: T; | |
type_parameters: GenericTypeConstraint[] | null; | |
extends: Expression | null; | |
implements: TypeAnnotation[] | null; | |
members: Decorated<ClassMember>[]; | |
position: Span; | |
} | |
export type Optionality = "Default" | "Optional" | "Required"; | |
export type TypeRule = "In" | "InKeyOf"; | |
export type AnnotationPerforms = { PerformsStatements: { body: Block } } | { PerformsConst: { identifier: string } }; | |
export interface IfStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
else_conditions: ConditionalElseStatement[]; | |
trailing_else: UnconditionalElseStatement | null; | |
position: Span; | |
} | |
export interface ForLoopStatement { | |
condition: ForLoopCondition; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export type Block = [StatementOrDeclaration[], Span]; | |
export type StatementOrDeclaration = { Statement: Statement } | { Declaration: Declaration } | { Marker: [Marker<Statement>, Span] }; | |
export type BlockOrSingleStatement = { Braced: Block } | { SingleStatement: Statement }; | |
export type ForLoopStatementInitializer = { VariableDeclaration: VariableDeclaration } | { VarStatement: VarVariableStatement } | { Expression: MultipleExpression }; | |
export type ForLoopCondition = { ForOf: { keyword: VariableKeyword | null; variable: WithComment<VariableField<VariableFieldInSourceCode>>; of: Expression; position: Span } } | { ForIn: { keyword: VariableKeyword | null; variable: WithComment<VariableField<VariableFieldInSourceCode>>; in: MultipleExpression; position: Span } } | { Statements: { initialiser: ForLoopStatementInitializer | null; condition: MultipleExpression | null; afterthought: MultipleExpression | null; position: Span } }; | |
export interface ConditionalElseStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface UnconditionalElseStatement { | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface FunctionBase { | |
type_parameters?: GenericTypeConstraint[], | |
parameters: FunctionParameters, | |
return_type?: TypeAnnotation, | |
position: Span | |
} | |
export interface ExpressionFunction extends FunctionBase { | |
header: FunctionHeader, | |
body: Block, | |
name: ExpressionPosition | |
} | |
export interface TryCatchStatement { | |
try_inner: Block; | |
catch_inner: Block | null; | |
exception_var: [ExceptionVarField, TypeAnnotation | null] | null; | |
finally_inner: Block | null; | |
position: Span; | |
} | |
export type ExceptionVarField = WithComment<VariableField<VariableFieldInSourceCode>>; | |
export type FunctionLocationModifier = "Server" | "Worker"; | |
export type FunctionHeader = { VirginFunctionHeader: { is_async: boolean; location: FunctionLocationModifier | null; generator_star_token_position: Span | null; position: Span } } | { ChadFunctionHeader: { is_async: boolean; is_generator: boolean; location: FunctionLocationModifier | null; position: Span } }; | |
export type MethodHeader = "Get" | "Set" | { Regular: { is_async: boolean; generator: GeneratorSpecifier | null } }; | |
export type GeneratorSpecifier = { Star: Span } | "Keyword"; | |
export interface StatementFunction extends FunctionBase { | |
header: FunctionHeader, | |
body: Block, | |
name: StatementPosition | |
} | |
export interface VarVariableStatement { | |
declarations: VariableDeclarationItem<Expression | null>[]; | |
position: Span; | |
} | |
export type ThrowStatement = [MultipleExpression, Span]; | |
export type ReturnStatement = [MultipleExpression | null, Span]; | |
export type Statement = { Expression: MultipleExpression } | { Block: Block } | { Debugger: Span } | { If: IfStatement } | { ForLoop: ForLoopStatement } | { Switch: SwitchStatement } | { WhileLoop: WhileStatement } | { DoWhileLoop: DoWhileStatement } | { TryCatch: TryCatchStatement } | { Return: ReturnStatement } | { Continue: [string | null, Span] } | { Break: [string | null, Span] } | { Throw: ThrowStatement } | { Comment: [string, Span] } | { MultiLineComment: [string, Span] } | { Labelled: { position: Span; name: string; statement: Statement } } | { VarVariable: VarVariableStatement } | { Empty: Span }; | |
export interface DoWhileStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface WhileStatement { | |
condition: MultipleExpression; | |
inner: BlockOrSingleStatement; | |
position: Span; | |
} | |
export interface IsExpression { | |
matcher: MultipleExpression; | |
branches: [TypeAnnotation, ExpressionOrBlock][]; | |
position: Span; | |
} | |
export type ImportLocation = { Quoted: [string, Quoted] } | { Marker: Marker<ImportLocation> }; | |
export type Declaration = { Variable: VariableDeclaration } | { Function: Decorated<StatementFunction> } | { Class: Decorated<ClassDeclaration<StatementPosition>> } | { Enum: Decorated<EnumDeclaration> } | { Interface: Decorated<InterfaceDeclaration> } | { TypeAlias: TypeAlias } | { DeclareVariable: DeclareVariableDeclaration } | { DeclareFunction: DeclareFunctionDeclaration } | { DeclareInterface: InterfaceDeclaration } | { Import: ImportDeclaration } | { Export: Decorated<ExportDeclaration> }; | |
type Marker<T> = number; | |
export type ObjectDestructuringField<T> = { Name: [VariableIdentifier, Expression | null, Span] } | { Spread: [VariableIdentifier, Span] } | { Map: { from: PropertyKey<AlwaysPublic>; name: WithComment<VariableField<T>>; default_value: Expression | null; position: Span } }; | |
export type VariableField<T> = { Name: VariableIdentifier } | { Array: [WithComment<ArrayDestructuringField<T>>[], Span] } | { Object: [WithComment<ObjectDestructuringField<T>>[], Span] }; | |
export type VariableIdentifier = { Standard: [string, Span] } | { Marker: [VariableIdentifier, Span] }; | |
export type VariableDeclaration = { ConstDeclaration: { declarations: VariableDeclarationItem<Expression>[]; position: Span } } | { LetDeclaration: { declarations: VariableDeclarationItem<Expression | null>[]; position: Span } }; | |
export interface VariableDeclarationItem<TExpr> { | |
name: WithComment<VariableField<VariableFieldInSourceCode>>; | |
type_annotation: TypeAnnotation | null; | |
expression: TExpr; | |
position: Span; | |
} | |
export type VariableDeclarationKeyword = "Const" | "Let"; | |
export type VariableFieldInSourceCode = null; | |
export type VariableFieldInTypeAnnotation = null; | |
export type ArrayDestructuringField<T> = { Spread: [VariableIdentifier, Span] } | { Name: [VariableField<T>, Expression?] } | "None"; | |
export interface FunctionParameters { | |
this_type: [TypeAnnotation, Span] | null; | |
super_type: [TypeAnnotation, Span] | null; | |
parameters: Parameter[]; | |
rest_parameter: SpreadParameter | null; | |
position: Span; | |
} | |
export interface Parameter { | |
name: WithComment<VariableField<VariableFieldInSourceCode>>; | |
type_annotation: TypeAnnotation | null; | |
additionally: ParameterData | null; | |
position: Span; | |
} | |
export type ParameterData = "Optional" | { WithDefaultValue: Expression }; | |
export interface SpreadParameter { | |
name: VariableIdentifier; | |
type_annotation: TypeAnnotation | null; | |
position: Span; | |
} | |
export interface DeclareClassDeclaration { | |
name: string; | |
type_parameters: GenericTypeConstraint[] | null; | |
extends: TypeAnnotation | null; | |
} | |
export interface DeclareFunctionDeclaration { | |
name: string; | |
type_parameters: GenericTypeConstraint[] | null; | |
parameters: TypeAnnotationFunctionParameters; | |
return_type: TypeAnnotation | null; | |
performs: AnnotationPerforms | null; | |
decorators: Decorator[]; | |
position: Span; | |
} | |
export interface DeclareVariableDeclaration { | |
keyword: VariableKeyword; | |
declarations: VariableDeclarationItem<Expression | null>[]; | |
position: Span; | |
decorators: Decorator[]; | |
} | |
export type WithComment<T> = { None: T } | { PrefixComment: [string, T, Span] } | { PostfixComment: [T, string, Span] }; | |
export interface EnumDeclaration { | |
is_constant: boolean; | |
name: string; | |
members: EnumMember[]; | |
position: Span; | |
} | |
export type EnumMember = { Variant: { name: string; value: Expression | null; position: Span } }; | |
export interface ObjectLiteralMethod extends FunctionBase { | |
header: MethodHeader, | |
body: Block, | |
name: WithComment<PropertyKey<AlwaysPublic>> | |
} | |
export interface TypeAlias { | |
type_name: TypeDeclaration; | |
type_expression: TypeAnnotation; | |
position: Span; | |
} | |
export interface SwitchStatement { | |
case: MultipleExpression; | |
branches: SwitchBranch[]; | |
position: Span; | |
} | |
export interface JSXFragment { | |
children: JSXNode[]; | |
position: Span; | |
} | |
export interface JSXElement { | |
tag_name: string; | |
attributes: JSXAttribute[]; | |
children: JSXElementChildren; | |
position: Span; | |
} | |
export type JSXRoot = { Element: JSXElement } | { Fragment: JSXFragment }; | |
export type ObjectLiteralMember = { Spread: [Expression, Span] } | { Shorthand: [string, Span] } | { Property: [WithComment<PropertyKey<AlwaysPublic>>, Expression, Span] } | { Method: ObjectLiteralMethod }; | |
export interface ObjectLiteral { | |
members: ObjectLiteralMember[]; | |
position: Span; | |
} | |
export type JSXElementChildren = { Children: JSXNode[] } | "SelfClosing"; | |
export type JSXNode = { TextNode: [string, Span] } | { InterpolatedExpression: [Expression, Span] } | { Element: JSXElement } | "LineBreak"; | |
export type JSXAttribute = { Static: [string, string, Span] } | { Dynamic: [string, Expression, Span] } | { BooleanAttribute: [string, Span] } | { Spread: [Expression, Span] } | { Shorthand: Expression }; | |
export type BinaryOperator = "Add" | "Subtract" | "Multiply" | "Divide" | "Modulo" | "Exponent" | "BitwiseShiftLeft" | "BitwiseShiftRight" | "BitwiseShiftRightUnsigned" | "BitwiseAnd" | "BitwiseXOr" | "BitwiseOr" | "StrictEqual" | "StrictNotEqual" | "Equal" | "NotEqual" | "GreaterThan" | "LessThan" | "LessThanEqual" | "GreaterThanEqual" | "LogicalAnd" | "LogicalOr" | "NullCoalescing" | "Divides" | "Pipe" | "Compose"; | |
export type BinaryAssignmentOperator = "LogicalNullishAssignment" | "AddAssign" | "SubtractAssign" | "MultiplyAssign" | "DivideAssign" | "ModuloAssign" | "ExponentAssign" | "LogicalAndAssign" | "LogicalOrAssign" | "BitwiseShiftLeftAssign" | "BitwiseShiftRightAssign" | "BitwiseShiftRightUnsigned" | "BitwiseAndAssign" | "BitwiseXOrAssign" | "BitwiseOrAssign"; | |
export type UnaryOperator = "Plus" | "Negation" | "BitwiseNot" | "LogicalNot" | "Await" | "TypeOf" | "Void" | "Delete" | "Yield" | "DelegatedYield"; | |
export type IncrementOrDecrement = "Increment" | "Decrement"; | |
export type UnaryPrefixAssignmentOperator = "Invert" | { IncrementOrDecrement: IncrementOrDecrement }; | |
export type UnaryPostfixAssignmentOperator = IncrementOrDecrement; | |
export type SwitchBranch = { Default: StatementOrDeclaration[] } | { Case: [Expression, StatementOrDeclaration[]] }; | |
export interface ArrowFunction extends Omit<FunctionBase, 'name'> { | |
header: IsAsync, | |
body: ExpressionOrBlock | |
} | |
export interface Decorated<T> { | |
decorators: Decorator[]; | |
on: T; | |
position: Span; | |
} | |
export type IsAsync = boolean; | |
export type ImportPart = { Name: VariableIdentifier } | { NameWithAlias: { name: string; alias: ImportExportName; position: Span } } | { PrefixComment: [string, ImportPart | null, Span] } | { PostfixComment: [ImportPart, string, Span] }; | |
export interface ImportDeclaration { | |
is_deferred: boolean; | |
is_type_annotation_import_only: boolean; | |
default: VariableIdentifier | null; | |
items: ImportedItems; | |
from: ImportLocation; | |
position: Span; | |
reversed: boolean; | |
} | |
export type ImportedItems = { Parts: ImportPart[] | null } | { All: { under: VariableIdentifier } }; | |
export type ImportExportName = { Reference: string } | { Quoted: [string, Quoted] } | { Marker: Marker<ImportExportName> }; | |
export type ExpressionOrBlock = { Expression: Expression } | { Block: Block }; | |
export interface Decorator { | |
name: string[]; | |
arguments: Expression[] | null; | |
position: Span; | |
} | |
export interface TypeDeclaration { | |
name: string; | |
type_parameters: GenericTypeConstraint[] | null; | |
position: Span; | |
} | |
export type GenericTypeConstraint = { Parameter: { name: string; default: TypeAnnotation | null } } | { Extends: [string, TypeAnnotation] } | { ExtendsKeyOf: [string, TypeAnnotation] } | { Spread: { name: string; default: TypeAnnotation | null } }; | |
export interface ClassConstructor extends Omit<FunctionBase, 'header' | 'name'> { | |
body: Block | |
} | |
export interface ClassFunction extends FunctionBase { | |
header: MethodHeader, | |
body: Block, | |
name: WithComment<PropertyKey<PublicOrPrivate>> | |
} | |
export interface Module { | |
items: StatementOrDeclaration[]; | |
span: Span; | |
} | |
export interface TemplateLiteral { | |
tag: Expression | null; | |
parts: TemplateLiteralPart<Expression>[]; | |
position: Span; | |
} | |
export type LHSOfAssignment = { ObjectDestructuring: [WithComment<ObjectDestructuringField<VariableFieldInSourceCode>>[], Span] } | { ArrayDestructuring: [WithComment<ArrayDestructuringField<VariableFieldInSourceCode>>[], Span] } | { VariableOrPropertyAccess: VariableOrPropertyAccess }; | |
export type VariableOrPropertyAccess = { Variable: [string, Span] } | { PropertyAccess: { parent: Expression; property: PropertyReference; position: Span } } | { Index: { indexee: Expression; indexer: MultipleExpression; position: Span } }; | |
export type ExportPart = { Name: VariableIdentifier } | { NameWithAlias: { name: string; alias: ImportExportName; position: Span } } | { PrefixComment: [string, ExportPart | null, Span] } | { PostfixComment: [ExportPart, string, Span] }; | |
export type ExportDeclaration = { Variable: { exported: Exportable; position: Span } } | { Default: { expression: Expression; position: Span } }; | |
export type IsStatic = boolean; | |
export type ClassMember = { Constructor: ClassConstructor } | { Method: [IsStatic, ClassFunction] } | { Property: [IsStatic, ClassProperty] } | { StaticBlock: Block } | { Comment: [string, boolean, Span] }; | |
export interface ClassProperty { | |
is_readonly: boolean; | |
key: WithComment<PropertyKey<PublicOrPrivate>>; | |
type_annotation: TypeAnnotation | null; | |
value: Expression | null; | |
position: Span; | |
} | |
export type Exportable = { Class: ClassDeclaration<StatementPosition> } | { Function: StatementFunction } | { Variable: VariableDeclaration } | { Interface: InterfaceDeclaration } | { TypeAlias: TypeAlias } | { Parts: ExportPart[] } | { ImportAll: { as: VariableIdentifier | null; from: ImportLocation } } | { ImportParts: { parts: ExportPart[]; from: ImportLocation; type_definitions_only: boolean } }; | |
export type TemplateLiteralPart<T> = { Static: string } | { Dynamic: T }; | |
export type SpanWithSource = BaseSpan<SourceId>; | |
export type Span = BaseSpan<null>; | |
export interface BaseSpan<T> { | |
start: number; | |
end: number; | |
source: T; | |
} | |
export type SourceId = number; | |
/** | |
*/ | |
export class CheckOptions { | |
free(): void; | |
/** | |
*/ | |
lsp_mode: boolean; | |
} | |
/** | |
*/ | |
export class WASMCheckOutput { | |
free(): void; | |
/** | |
* @param {string} path | |
* @param {number} pos | |
* @returns {string} | |
*/ | |
get_type_at_position(path: string, pos: number): string; | |
} | |
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | |
export interface InitOutput { | |
readonly memory: WebAssembly.Memory; | |
readonly __wbg_checkoptions_free: (a: number) => void; | |
readonly __wbg_get_checkoptions_lsp_mode: (a: number) => number; | |
readonly __wbg_set_checkoptions_lsp_mode: (a: number, b: number) => void; | |
readonly experimental_build: (a: number, b: number, c: number, d: number) => number; | |
readonly __wbg_wasmcheckoutput_free: (a: number) => void; | |
readonly wasmcheckoutput_diagnostics: (a: number) => number; | |
readonly wasmcheckoutput_get_type_at_position: (a: number, b: number, c: number, d: number, e: number) => void; | |
readonly check: (a: number, b: number, c: number) => number; | |
readonly check_with_options: (a: number, b: number, c: number, d: number) => number; | |
readonly run_cli: (a: number, b: number, c: number, d: number, e: number) => void; | |
readonly parse_expression: (a: number, b: number) => number; | |
readonly parse_module: (a: number, b: number) => number; | |
readonly parse_module_and_into_string: (a: number, b: number, c: number, d: number) => number; | |
readonly just_imports: (a: number, b: number) => number; | |
readonly get_version: () => number; | |
readonly __wbindgen_malloc: (a: number, b: number) => number; | |
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; | |
readonly __wbindgen_add_to_stack_pointer: (a: number) => number; | |
readonly __wbindgen_free: (a: number, b: number, c: number) => void; | |
readonly __wbindgen_exn_store: (a: number) => void; | |
} | |
export type SyncInitInput = BufferSource | WebAssembly.Module; | |
/** | |
* Instantiates the given `module`, which can either be bytes or | |
* a precompiled `WebAssembly.Module`. | |
* | |
* @param {SyncInitInput} module | |
* | |
* @returns {InitOutput} | |
*/ | |
export function initSync(module: SyncInitInput): InitOutput; | |
/** | |
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and | |
* for everything else, calls `WebAssembly.instantiate` directly. | |
* | |
* @param {InitInput | Promise<InitInput>} module_or_path | |
* | |
* @returns {Promise<InitOutput>} | |
*/ | |
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Findings so far:
Apparently TS is... fine with using the union operator like this (effectively as a unary operator, or perhaps with an implicit
never
), and it's even part of the docs 😱 .2. Tuple types with at least one member being a parameterized generic gets you 'Expected CloseBracket found OpenBracket', e.g.:
This is presumably because it's kind of ambiguous what the intention is (everything up to and including
void
looks like you're about to write a function implementation). Very much illegal in a .ts file, apparently legal in a .d.ts file (the file name is the one indicator the compiler has for determining this).4. Variations on 3 - declaration-style class methods (part of a class that's exported in a .d.ts file, but not using the declare keyword).