From c2ce6e245da78d43fd26a067ee9dbf1eda1a14ce Mon Sep 17 00:00:00 2001 From: cannorin Date: Thu, 5 May 2022 18:06:08 +0900 Subject: [PATCH 01/17] Update TypeScript.fs --- lib/Bindings/TypeScript.fs | 3561 ++++++++++++++++++++++-------------- lib/Extensions.fs | 2 + lib/Parser.fs | 239 ++- lib/TypeScriptHelper.fs | 4 +- 4 files changed, 2311 insertions(+), 1495 deletions(-) diff --git a/lib/Bindings/TypeScript.fs b/lib/Bindings/TypeScript.fs index 1b2c5c06..20425670 100644 --- a/lib/Bindings/TypeScript.fs +++ b/lib/Bindings/TypeScript.fs @@ -1,5 +1,9 @@ -// ts2fable 0.7.1 +// ts2fable 0.0.0 module rec TypeScript + +#nowarn "3390" // disable warnings for invalid XML comments +#nowarn "0044" // disable warnings for `Obsolete` usage + open System open Fable.Core open Fable.Core.JS @@ -9,10 +13,10 @@ type ReadonlyArray<'T> = System.Collections.Generic.IReadOnlyList<'T> type ReadonlySet<'T> = Set<'T> type Symbol = obj -let [] ts: Ts.IExports = jsNative +let [] ts: Ts.IExports = jsNative type [] IExports = - abstract setTimeout: handler: (ResizeArray -> unit) * timeout: float -> obj option + abstract setTimeout: handler: (obj option[] -> unit) * timeout: float -> obj option abstract clearTimeout: handle: obj option -> unit module Ts = @@ -20,10 +24,11 @@ module Ts = type [] IExports = abstract versionMajorMinor: obj + /// The version of the TypeScript compiler release abstract version: string abstract OperationCanceledException: OperationCanceledExceptionStatic abstract getNodeMajorVersion: unit -> float option - abstract sys: System + abstract sys: System with get, set abstract tokenToString: t: SyntaxKind -> string option abstract getPositionOfLineAndCharacter: sourceFile: SourceFileLike * line: float * character: float -> float abstract getLineAndCharacterOfPosition: sourceFile: SourceFileLike * position: float -> LineAndCharacter @@ -38,15 +43,15 @@ module Ts = abstract forEachTrailingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'T -> 'U) * state: 'T -> 'U option abstract reduceEachLeadingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'T -> 'U -> 'U) * state: 'T * initial: 'U -> 'U option abstract reduceEachTrailingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'T -> 'U -> 'U) * state: 'T * initial: 'U -> 'U option - abstract getLeadingCommentRanges: text: string * pos: float -> ResizeArray option - abstract getTrailingCommentRanges: text: string * pos: float -> ResizeArray option + abstract getLeadingCommentRanges: text: string * pos: float -> CommentRange[] option + abstract getTrailingCommentRanges: text: string * pos: float -> CommentRange[] option /// Optionally, get the shebang abstract getShebang: text: string -> string option abstract isIdentifierStart: ch: float * languageVersion: ScriptTarget option -> bool abstract isIdentifierPart: ch: float * languageVersion: ScriptTarget option * ?identifierVariant: LanguageVariant -> bool abstract createScanner: languageVersion: ScriptTarget * skipTrivia: bool * ?languageVariant: LanguageVariant * ?textInitial: string * ?onError: ErrorCallback * ?start: float * ?length: float -> Scanner abstract isExternalModuleNameRelative: moduleName: string -> bool - abstract sortAndDeduplicateDiagnostics: diagnostics: ResizeArray<'T> -> SortedReadonlyArray<'T> + abstract sortAndDeduplicateDiagnostics: diagnostics: 'T[] -> SortedReadonlyArray<'T> abstract getDefaultLibFileName: options: CompilerOptions -> string abstract textSpanEnd: span: TextSpan -> float abstract textSpanIsEmpty: span: TextSpan -> bool @@ -64,14 +69,14 @@ module Ts = abstract textChangeRangeNewSpan: range: TextChangeRange -> TextSpan abstract textChangeRangeIsUnchanged: range: TextChangeRange -> bool abstract createTextChangeRange: span: TextSpan * newLength: float -> TextChangeRange - abstract unchangedTextChangeRange: TextChangeRange + abstract unchangedTextChangeRange: TextChangeRange with get, set /// Called to merge all the changes that occurred across several versions of a script snapshot /// into a single change. i.e. if a user keeps making successive edits to a script we will /// have a text change from V1 to V2, V2 to V3, ..., Vn. /// /// This function will then merge those changes into a single change range valid between V1 and /// Vn. - abstract collapseTextChangeRangesAcrossMultipleVersions: changes: ResizeArray -> TextChangeRange + abstract collapseTextChangeRangesAcrossMultipleVersions: changes: TextChangeRange[] -> TextChangeRange abstract getTypeParameterOwner: d: Declaration -> Declaration option abstract isParameterPropertyDeclaration: node: Node * parent: Node -> bool abstract isEmptyBindingPattern: node: BindingName -> bool @@ -81,7 +86,7 @@ module Ts = abstract getCombinedNodeFlags: node: Node -> NodeFlags /// Checks to see if the locale is in the appropriate format, /// and if it is, attempts to set the appropriate language. - abstract validateLocaleAndSetLanguage: locale: string * sys: ValidateLocaleAndSetLanguageSys * ?errors: Push -> unit + abstract validateLocaleAndSetLanguage: locale: string * sys: {| getExecutingFilePath: unit -> string; resolvePath: string -> string; fileExists: string -> bool; readFile: string -> string option |} * ?errors: Push -> unit abstract getOriginalNode: node: Node -> Node abstract getOriginalNode: node: Node * nodeTest: (Node -> bool) -> 'T abstract getOriginalNode: node: Node option -> Node option @@ -97,30 +102,55 @@ module Ts = abstract isParseTreeNode: node: Node -> bool /// Gets the original parse tree node for a node. /// The original node. + /// The original parse tree node if found; otherwise, undefined. abstract getParseTreeNode: node: Node option -> Node option /// Gets the original parse tree node for a node. /// The original node. /// A callback used to ensure the correct type of parse tree node is returned. + /// The original parse tree node if found; otherwise, undefined. abstract getParseTreeNode: node: 'T option * ?nodeTest: (Node -> bool) -> 'T option /// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' abstract escapeLeadingUnderscores: identifier: string -> __String /// Remove extra underscore from escaped identifier text content. /// The escaped identifier text. + /// The unescaped identifier text. abstract unescapeLeadingUnderscores: identifier: __String -> string abstract idText: identifierOrPrivateName: U2 -> string abstract symbolName: symbol: Symbol -> string abstract getNameOfJSDocTypedef: declaration: JSDocTypedefTag -> U2 option abstract getNameOfDeclaration: declaration: U2 option -> DeclarationName option - /// Gets the JSDoc parameter tags for the node if present. - abstract getJSDocParameterTags: param: ParameterDeclaration -> ResizeArray - /// Gets the JSDoc type parameter tags for the node if present. - abstract getJSDocTypeParameterTags: param: TypeParameterDeclaration -> ResizeArray - /// Return true if the node has JSDoc parameter tags. + /// Gets the JSDoc parameter tags for the node if present. + /// + /// Returns any JSDoc param tag whose name matches the provided + /// parameter, whether a param tag on a containing function + /// expression, or a param tag on a variable declaration whose + /// initializer is the containing function. The tags closest to the + /// node are returned first, so in the previous example, the param + /// tag on the containing function expression would be first. + /// + /// For binding patterns, parameter tags are matched by position. + /// + abstract getJSDocParameterTags: param: ParameterDeclaration -> JSDocParameterTag[] + /// Gets the JSDoc type parameter tags for the node if present. + /// + /// Returns any JSDoc template tag whose names match the provided + /// parameter, whether a template tag on a containing function + /// expression, or a template tag on a variable declaration whose + /// initializer is the containing function. The tags closest to the + /// node are returned first, so in the previous example, the template + /// tag on the containing function expression would be first. + /// + abstract getJSDocTypeParameterTags: param: TypeParameterDeclaration -> JSDocTemplateTag[] + /// Return true if the node has JSDoc parameter tags. + /// + /// Includes parameter tags that are not directly on the node, + /// for example on a variable declaration whose initializer is a function expression. + /// abstract hasJSDocParameterTags: node: U2 -> bool /// Gets the JSDoc augments tag for the node if present abstract getJSDocAugmentsTag: node: Node -> JSDocAugmentsTag option /// Gets the JSDoc implements tags for the node if present - abstract getJSDocImplementsTags: node: Node -> ResizeArray + abstract getJSDocImplementsTags: node: Node -> JSDocImplementsTag[] /// Gets the JSDoc class tag for the node if present abstract getJSDocClassTag: node: Node -> JSDocClassTag option /// Gets the JSDoc public tag for the node if present @@ -144,21 +174,36 @@ module Ts = abstract getJSDocTemplateTag: node: Node -> JSDocTemplateTag option /// Gets the JSDoc type tag for the node if present and valid abstract getJSDocTypeTag: node: Node -> JSDocTypeTag option - /// Gets the type node for the node if provided via JSDoc. + /// Gets the type node for the node if provided via JSDoc. + /// + /// The search includes any JSDoc param tag that relates + /// to the provided parameter, for example a type tag on the + /// parameter itself, or a param tag on a containing function + /// expression, or a param tag on a variable declaration whose + /// initializer is the containing function. The tags closest to the + /// node are examined first, so in the previous example, the type + /// tag directly on the node would be returned. + /// abstract getJSDocType: node: Node -> TypeNode option - /// Gets the return type node for the node if provided via JSDoc return tag or type tag. + /// Gets the return type node for the node if provided via JSDoc return tag or type tag. + /// + /// getJSDocReturnTag just gets the whole JSDoc tag. This function + /// gets the type from inside the braces, after the fat arrow, etc. + /// abstract getJSDocReturnType: node: Node -> TypeNode option /// Get all JSDoc tags related to a node, including those on parent nodes. - abstract getJSDocTags: node: Node -> ResizeArray + abstract getJSDocTags: node: Node -> JSDocTag[] /// Gets all JSDoc tags that match a specified predicate - abstract getAllJSDocTags: node: Node * predicate: (JSDocTag -> bool) -> ResizeArray<'T> + abstract getAllJSDocTags: node: Node * predicate: (JSDocTag -> bool) -> 'T[] /// Gets all JSDoc tags of a specified kind - abstract getAllJSDocTagsOfKind: node: Node * kind: SyntaxKind -> ResizeArray + abstract getAllJSDocTagsOfKind: node: Node * kind: SyntaxKind -> JSDocTag[] /// Gets the text of a jsdoc comment, flattening links to their text. - abstract getTextOfJSDocComment: ?comment: U2> -> string option + abstract getTextOfJSDocComment: ?comment: U2 -> string option + /// /// Gets the effective type parameters. If the node was parsed in a - /// JavaScript file, gets the type parameters from the `@template` tag from JSDoc. - abstract getEffectiveTypeParameterDeclarations: node: DeclarationWithTypeParameters -> ResizeArray + /// JavaScript file, gets the type parameters from the @template tag from JSDoc. + /// + abstract getEffectiveTypeParameterDeclarations: node: DeclarationWithTypeParameters -> TypeParameterDeclaration[] abstract getEffectiveConstraintOfTypeParameter: node: TypeParameterDeclaration -> TypeNode option abstract isMemberName: node: Node -> bool abstract isPropertyAccessChain: node: Node -> bool @@ -201,9 +246,11 @@ module Ts = abstract isTypeElement: node: Node -> bool abstract isClassOrTypeElement: node: Node -> bool abstract isObjectLiteralElementLike: node: Node -> bool + /// /// Node test that determines whether a node is a valid type node. - /// This differs from the `isPartOfTypeNode` function which determines whether a node is *part* + /// This differs from the isPartOfTypeNode function which determines whether a node is *part* /// of a TypeNode. + /// abstract isTypeNode: node: Node -> bool abstract isFunctionOrConstructorTypeNode: node: Node -> bool abstract isPropertyAccessOrQualifiedName: node: Node -> bool @@ -211,7 +258,6 @@ module Ts = abstract isCallOrNewExpression: node: Node -> bool abstract isTemplateLiteral: node: Node -> bool abstract isAssertionExpression: node: Node -> bool - abstract isIterationStatement: node: Node * lookInLabeledStatements: obj -> bool abstract isIterationStatement: node: Node * lookInLabeledStatements: bool -> bool abstract isJsxOpeningLikeElement: node: Node -> bool abstract isCaseOrDefaultClause: node: Node -> bool @@ -226,7 +272,7 @@ module Ts = abstract isJSDocLinkLike: node: Node -> bool abstract factory: NodeFactory abstract createUnparsedSourceFile: text: string -> UnparsedSource - abstract createUnparsedSourceFile: inputFile: InputFiles * ``type``: CreateUnparsedSourceFileType * ?stripInternal: bool -> UnparsedSource + abstract createUnparsedSourceFile: inputFile: InputFiles * ``type``: IExportsCreateUnparsedSourceFile * ?stripInternal: bool -> UnparsedSource abstract createUnparsedSourceFile: text: string * mapPath: string option * map: string option -> UnparsedSource abstract createInputFiles: javascriptText: string * declarationText: string -> InputFiles abstract createInputFiles: readFileText: (string -> string option) * javascriptPath: string * javascriptMapPath: string option * declarationPath: string * declarationMapPath: string option * buildInfoPath: string option -> InputFiles @@ -234,7 +280,7 @@ module Ts = /// Create an external source map source file reference abstract createSourceMapSource: fileName: string * text: string * ?skipTrivia: (float -> float) -> SourceMapSource abstract setOriginalNode: node: 'T * original: Node option -> 'T - /// Clears any `EmitNode` entries from parse-tree nodes. + /// Clears any EmitNode entries from parse-tree nodes. /// A source file. abstract disposeEmitNodes: sourceFile: SourceFile option -> unit /// Sets flags that control emit behavior of a node. @@ -251,11 +297,11 @@ module Ts = abstract getCommentRange: node: Node -> TextRange /// Sets a custom text range to use when emitting comments. abstract setCommentRange: node: 'T * range: TextRange -> 'T - abstract getSyntheticLeadingComments: node: Node -> ResizeArray option - abstract setSyntheticLeadingComments: node: 'T * comments: ResizeArray option -> 'T + abstract getSyntheticLeadingComments: node: Node -> SynthesizedComment[] option + abstract setSyntheticLeadingComments: node: 'T * comments: SynthesizedComment[] option -> 'T abstract addSyntheticLeadingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T - abstract getSyntheticTrailingComments: node: Node -> ResizeArray option - abstract setSyntheticTrailingComments: node: 'T * comments: ResizeArray option -> 'T + abstract getSyntheticTrailingComments: node: Node -> SynthesizedComment[] option + abstract setSyntheticTrailingComments: node: 'T * comments: SynthesizedComment[] option -> 'T abstract addSyntheticTrailingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T abstract moveSyntheticComments: node: 'T * original: Node -> 'T /// Gets the constant value to emit for an expression representing an enum. @@ -265,11 +311,11 @@ module Ts = /// Adds an EmitHelper to a node. abstract addEmitHelper: node: 'T * helper: EmitHelper -> 'T /// Add EmitHelpers to a node. - abstract addEmitHelpers: node: 'T * helpers: ResizeArray option -> 'T + abstract addEmitHelpers: node: 'T * helpers: EmitHelper[] option -> 'T /// Removes an EmitHelper from a node. abstract removeEmitHelper: node: Node * helper: EmitHelper -> bool /// Gets the EmitHelpers of a node. - abstract getEmitHelpers: node: Node -> ResizeArray option + abstract getEmitHelpers: node: Node -> EmitHelper[] option /// Moves matching emit helpers from a source node to a target node. abstract moveEmitHelpers: source: Node * target: Node * predicate: (EmitHelper -> bool) -> unit abstract isNumericLiteral: node: Node -> bool @@ -471,30 +517,38 @@ module Ts = abstract isJSDocPropertyTag: node: Node -> bool abstract isJSDocImplementsTag: node: Node -> bool abstract setTextRange: range: 'T * location: TextRange option -> 'T - /// Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes + /// + /// Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes /// stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, /// embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns - /// a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned. + /// a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned. + /// /// a given node to visit its children /// a callback to be invoked for all child nodes /// a callback to be invoked for embedded array - abstract forEachChild: node: Node * cbNode: (Node -> 'T option) * ?cbNodes: (ResizeArray -> 'T option) -> 'T option + /// + /// forEachChild must visit the children of a node in the order + /// that they appear in the source code. The language service depends on this property to locate nodes by position. + /// + abstract forEachChild: node: Node * cbNode: (Node -> 'T option) * ?cbNodes: (Node[] -> 'T option) -> 'T option abstract createSourceFile: fileName: string * sourceText: string * languageVersion: ScriptTarget * ?setParentNodes: bool * ?scriptKind: ScriptKind -> SourceFile abstract parseIsolatedEntityName: text: string * languageVersion: ScriptTarget -> EntityName option - /// Parse json text into SyntaxTree and return node and parse errors if any + /// Parse json text into SyntaxTree and return node and parse errors if any + /// + /// abstract parseJsonText: fileName: string * sourceText: string -> JsonSourceFile abstract isExternalModule: file: SourceFile -> bool abstract updateSourceFile: sourceFile: SourceFile * newText: string * textChangeRange: TextChangeRange * ?aggressiveChecks: bool -> SourceFile - abstract parseCommandLine: commandLine: ResizeArray * ?readFile: (string -> string option) -> ParsedCommandLine + abstract parseCommandLine: commandLine: string[] * ?readFile: (string -> string option) -> ParsedCommandLine /// Reads the config file, reports errors if any and exits if the config file cannot be found - abstract getParsedCommandLineOfConfigFile: configFileName: string * optionsToExtend: CompilerOptions option * host: ParseConfigFileHost * ?extendedConfigCache: Map * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: ResizeArray -> ParsedCommandLine option + abstract getParsedCommandLineOfConfigFile: configFileName: string * optionsToExtend: CompilerOptions option * host: ParseConfigFileHost * ?extendedConfigCache: Map * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> ParsedCommandLine option /// Read tsconfig.json file /// The path to the config file - abstract readConfigFile: fileName: string * readFile: (string -> string option) -> ReadConfigFileReturn + abstract readConfigFile: fileName: string * readFile: (string -> string option) -> {| config: obj option; error: Diagnostic option |} /// Parse the text of the tsconfig.json file /// The path to the config file /// The text of the config file - abstract parseConfigFileTextToJson: fileName: string * jsonText: string -> ParseConfigFileTextToJsonReturn + abstract parseConfigFileTextToJson: fileName: string * jsonText: string -> {| config: obj option; error: Diagnostic option |} /// Read tsconfig.json file /// The path to the config file abstract readJsonConfigFile: fileName: string * readFile: (string -> string option) -> TsConfigSourceFile @@ -503,20 +557,27 @@ module Ts = /// Parse the contents of a config file (tsconfig.json). /// The contents of the config file to parse /// Instance of ParseConfigHost used to enumerate files in folder. - /// A root directory to resolve relative path entries in the config - /// file to. e.g. outDir - abstract parseJsonConfigFileContent: json: obj option * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: ResizeArray * ?extraFileExtensions: ResizeArray * ?extendedConfigCache: Map * ?existingWatchOptions: WatchOptions -> ParsedCommandLine + /// + /// A root directory to resolve relative path entries in the config + /// file to. e.g. outDir + /// + abstract parseJsonConfigFileContent: json: obj option * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: Path[] * ?extraFileExtensions: FileExtensionInfo[] * ?extendedConfigCache: Map * ?existingWatchOptions: WatchOptions -> ParsedCommandLine /// Parse the contents of a config file (tsconfig.json). + /// The contents of the config file to parse /// Instance of ParseConfigHost used to enumerate files in folder. - /// A root directory to resolve relative path entries in the config - /// file to. e.g. outDir - abstract parseJsonSourceFileConfigFileContent: sourceFile: TsConfigSourceFile * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: ResizeArray * ?extraFileExtensions: ResizeArray * ?extendedConfigCache: Map * ?existingWatchOptions: WatchOptions -> ParsedCommandLine - abstract convertCompilerOptionsFromJson: jsonOptions: obj option * basePath: string * ?configFileName: string -> ConvertCompilerOptionsFromJsonReturn - abstract convertTypeAcquisitionFromJson: jsonOptions: obj option * basePath: string * ?configFileName: string -> ConvertTypeAcquisitionFromJsonReturn - abstract getEffectiveTypeRoots: options: CompilerOptions * host: GetEffectiveTypeRootsHost -> ResizeArray option - /// - file that contains type reference directive, can be undefined if containing file is unknown. + /// + /// A root directory to resolve relative path entries in the config + /// file to. e.g. outDir + /// + abstract parseJsonSourceFileConfigFileContent: sourceFile: TsConfigSourceFile * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: Path[] * ?extraFileExtensions: FileExtensionInfo[] * ?extendedConfigCache: Map * ?existingWatchOptions: WatchOptions -> ParsedCommandLine + abstract convertCompilerOptionsFromJson: jsonOptions: obj option * basePath: string * ?configFileName: string -> {| options: CompilerOptions; errors: Diagnostic[] |} + abstract convertTypeAcquisitionFromJson: jsonOptions: obj option * basePath: string * ?configFileName: string -> {| options: TypeAcquisition; errors: Diagnostic[] |} + abstract getEffectiveTypeRoots: options: CompilerOptions * host: GetEffectiveTypeRootsHost -> string[] option + /// + /// file that contains type reference directive, can be undefined if containing file is unknown. /// This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups - /// is assumed to be the same as root directory of the project. + /// is assumed to be the same as root directory of the project. + /// abstract resolveTypeReferenceDirective: typeReferenceDirectiveName: string * containingFile: string option * options: CompilerOptions * host: ModuleResolutionHost * ?redirectedReference: ResolvedProjectReference * ?cache: TypeReferenceDirectiveResolutionCache -> ResolvedTypeReferenceDirectiveWithFailedLookupLocations /// Given a set of options, returns the set of type directive names /// that should be included for this program automatically. @@ -524,7 +585,7 @@ module Ts = /// or from enumerating the types root + initial secondary types lookup location. /// More type directives might appear in the program later as a result of loading actual source files; /// this list is only the set of defaults that are implicitly included. - abstract getAutomaticTypeDirectiveNames: options: CompilerOptions * host: ModuleResolutionHost -> ResizeArray + abstract getAutomaticTypeDirectiveNames: options: CompilerOptions * host: ModuleResolutionHost -> string[] abstract createModuleResolutionCache: currentDirectory: string * getCanonicalFileName: (string -> string) * ?options: CompilerOptions -> ModuleResolutionCache abstract createTypeReferenceDirectiveResolutionCache: currentDirectory: string * getCanonicalFileName: (string -> string) * ?options: CompilerOptions * ?packageJsonInfoCache: PackageJsonInfoCache -> TypeReferenceDirectiveResolutionCache abstract resolveModuleNameFromCache: moduleName: string * containingFile: string * cache: ModuleResolutionCache * ?mode: ModuleKind -> ResolvedModuleWithFailedLookupLocations option @@ -536,34 +597,34 @@ module Ts = /// The callback used to visit the Node. /// A callback to execute to verify the Node is valid. /// An optional callback to execute to lift a NodeArray into a valid Node. - abstract visitNode: node: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (ResizeArray -> 'T) -> 'T + abstract visitNode: node: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. /// The Node to visit. /// The callback used to visit the Node. /// A callback to execute to verify the Node is valid. /// An optional callback to execute to lift a NodeArray into a valid Node. - abstract visitNode: node: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (ResizeArray -> 'T) -> 'T option + abstract visitNode: node: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. /// The NodeArray to visit. /// The callback used to visit a Node. /// A node test to execute for each node. /// An optional value indicating the starting offset at which to start visiting. /// An optional value indicating the maximum number of nodes to visit. - abstract visitNodes: nodes: ResizeArray<'T> * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> ResizeArray<'T> + abstract visitNodes: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. /// The NodeArray to visit. /// The callback used to visit a Node. /// A node test to execute for each node. /// An optional value indicating the starting offset at which to start visiting. /// An optional value indicating the maximum number of nodes to visit. - abstract visitNodes: nodes: ResizeArray<'T> option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> ResizeArray<'T> option + abstract visitNodes: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option /// Starts a new lexical environment and visits a statement list, ending the lexical environment /// and merging hoisted declarations upon completion. - abstract visitLexicalEnvironment: statements: ResizeArray * visitor: Visitor * context: TransformationContext * ?start: float * ?ensureUseStrict: bool * ?nodesVisitor: NodesVisitor -> ResizeArray + abstract visitLexicalEnvironment: statements: Statement[] * visitor: Visitor * context: TransformationContext * ?start: float * ?ensureUseStrict: bool * ?nodesVisitor: NodesVisitor -> Statement[] /// Starts a new lexical environment and visits a parameter list, suspending the lexical /// environment upon completion. - abstract visitParameterList: nodes: ResizeArray * visitor: Visitor * context: TransformationContext * ?nodesVisitor: NodesVisitor -> ResizeArray - abstract visitParameterList: nodes: ResizeArray option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: NodesVisitor -> ResizeArray option + abstract visitParameterList: nodes: ParameterDeclaration[] * visitor: Visitor * context: TransformationContext * ?nodesVisitor: NodesVisitor -> ParameterDeclaration[] + abstract visitParameterList: nodes: ParameterDeclaration[] option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: NodesVisitor -> ParameterDeclaration[] option /// Resumes a suspended lexical environment and visits a function body, ending the lexical /// environment and merging hoisted declarations upon completion. abstract visitFunctionBody: node: FunctionBody * visitor: Visitor * context: TransformationContext -> FunctionBody @@ -586,62 +647,72 @@ module Ts = /// A lexical environment context for the visitor. abstract visitEachChild: node: 'T option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: obj * ?tokenVisitor: Visitor -> 'T option abstract getTsBuildInfoEmitOutputFilePath: options: CompilerOptions -> string option - abstract getOutputFileNames: commandLine: ParsedCommandLine * inputFileName: string * ignoreCase: bool -> ResizeArray + abstract getOutputFileNames: commandLine: ParsedCommandLine * inputFileName: string * ignoreCase: bool -> string[] abstract createPrinter: ?printerOptions: PrinterOptions * ?handlers: PrintHandlers -> Printer abstract findConfigFile: searchPath: string * fileExists: (string -> bool) * ?configName: string -> string option abstract resolveTripleslashReference: moduleName: string * containingFile: string -> string abstract createCompilerHost: options: CompilerOptions * ?setParentNodes: bool -> CompilerHost - abstract getPreEmitDiagnostics: program: Program * ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> ResizeArray - abstract formatDiagnostics: diagnostics: ResizeArray * host: FormatDiagnosticsHost -> string + abstract getPreEmitDiagnostics: program: Program * ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> Diagnostic[] + abstract formatDiagnostics: diagnostics: Diagnostic[] * host: FormatDiagnosticsHost -> string abstract formatDiagnostic: diagnostic: Diagnostic * host: FormatDiagnosticsHost -> string - abstract formatDiagnosticsWithColorAndContext: diagnostics: ResizeArray * host: FormatDiagnosticsHost -> string + abstract formatDiagnosticsWithColorAndContext: diagnostics: Diagnostic[] * host: FormatDiagnosticsHost -> string abstract flattenDiagnosticMessageText: diag: U2 option * newLine: string * ?indent: float -> string - abstract getConfigFileParsingDiagnostics: configFileParseResult: ParsedCommandLine -> ResizeArray - /// A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the - /// `options` parameter. + abstract getConfigFileParsingDiagnostics: configFileParseResult: ParsedCommandLine -> Diagnostic[] + /// + /// A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the + /// options parameter. + /// /// The normalized absolute path to check the format of (it need not exist on disk) /// A cache for package file lookups - it's best to have a cache when this function is called often /// The ModuleResolutionHost which can perform the filesystem lookups for package json data - /// The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution` + /// The compiler options to perform the analysis under - relevant options are moduleResolution and traceResolution + /// undefined if the path has no relevant implied format, ModuleKind.ESNext for esm format, and ModuleKind.CommonJS for cjs format abstract getImpliedNodeFormatForFile: fileName: Path * packageJsonInfoCache: PackageJsonInfoCache option * host: ModuleResolutionHost * options: CompilerOptions -> ModuleKind option - /// Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' + /// + /// Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' /// that represent a compilation unit. /// /// Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and - /// triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. - /// - The options for creating a program. + /// triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. + /// + /// The options for creating a program. + /// A 'Program' object. abstract createProgram: createProgramOptions: CreateProgramOptions -> Program - /// Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' + /// + /// Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' /// that represent a compilation unit. /// /// Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and - /// triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. - /// - A set of root files. - /// - The compiler options which should be used. - /// - The host interacts with the underlying file system. - /// - Reuses an old program structure. - /// - error during config file parsing - abstract createProgram: rootNames: ResizeArray * options: CompilerOptions * ?host: CompilerHost * ?oldProgram: Program * ?configFileParsingDiagnostics: ResizeArray -> Program + /// triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. + /// + /// A set of root files. + /// The compiler options which should be used. + /// The host interacts with the underlying file system. + /// Reuses an old program structure. + /// error during config file parsing + /// A 'Program' object. + abstract createProgram: rootNames: string[] * options: CompilerOptions * ?host: CompilerHost * ?oldProgram: Program * ?configFileParsingDiagnostics: Diagnostic[] -> Program /// Returns the target config filename of a project reference. /// Note: The file might not exist. abstract resolveProjectReferencePath: ref: ProjectReference -> ResolvedConfigFileName + [] abstract resolveProjectReferencePath: host: ResolveProjectReferencePathHost * ref: ProjectReference -> ResolvedConfigFileName /// Create the builder to manage semantic diagnostics and cache them - abstract createSemanticDiagnosticsBuilderProgram: newProgram: Program * host: BuilderProgramHost * ?oldProgram: SemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: ResizeArray -> SemanticDiagnosticsBuilderProgram - abstract createSemanticDiagnosticsBuilderProgram: rootNames: ResizeArray option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: SemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: ResizeArray * ?projectReferences: ResizeArray -> SemanticDiagnosticsBuilderProgram + abstract createSemanticDiagnosticsBuilderProgram: newProgram: Program * host: BuilderProgramHost * ?oldProgram: SemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] -> SemanticDiagnosticsBuilderProgram + abstract createSemanticDiagnosticsBuilderProgram: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: SemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> SemanticDiagnosticsBuilderProgram /// Create the builder that can handle the changes in program and iterate through changed files /// to emit the those files and manage semantic diagnostics cache as well - abstract createEmitAndSemanticDiagnosticsBuilderProgram: newProgram: Program * host: BuilderProgramHost * ?oldProgram: EmitAndSemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: ResizeArray -> EmitAndSemanticDiagnosticsBuilderProgram - abstract createEmitAndSemanticDiagnosticsBuilderProgram: rootNames: ResizeArray option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: EmitAndSemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: ResizeArray * ?projectReferences: ResizeArray -> EmitAndSemanticDiagnosticsBuilderProgram + abstract createEmitAndSemanticDiagnosticsBuilderProgram: newProgram: Program * host: BuilderProgramHost * ?oldProgram: EmitAndSemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] -> EmitAndSemanticDiagnosticsBuilderProgram + abstract createEmitAndSemanticDiagnosticsBuilderProgram: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: EmitAndSemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> EmitAndSemanticDiagnosticsBuilderProgram /// Creates a builder thats just abstraction over program and can be used with watch - abstract createAbstractBuilder: newProgram: Program * host: BuilderProgramHost * ?oldProgram: BuilderProgram * ?configFileParsingDiagnostics: ResizeArray -> BuilderProgram - abstract createAbstractBuilder: rootNames: ResizeArray option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: BuilderProgram * ?configFileParsingDiagnostics: ResizeArray * ?projectReferences: ResizeArray -> BuilderProgram + abstract createAbstractBuilder: newProgram: Program * host: BuilderProgramHost * ?oldProgram: BuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] -> BuilderProgram + abstract createAbstractBuilder: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: BuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> BuilderProgram abstract readBuilderProgram: compilerOptions: CompilerOptions * host: ReadBuildProgramHost -> EmitAndSemanticDiagnosticsBuilderProgram option abstract createIncrementalCompilerHost: options: CompilerOptions * ?system: System -> CompilerHost abstract createIncrementalProgram: p0: IncrementalProgramOptions<'T> -> 'T /// Create the watch compiler host for either configFile or fileNames and its options - abstract createWatchCompilerHost: configFileName: string * optionsToExtend: CompilerOptions option * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: ResizeArray -> WatchCompilerHostOfConfigFile<'T> - abstract createWatchCompilerHost: rootFiles: ResizeArray * options: CompilerOptions * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?projectReferences: ResizeArray * ?watchOptions: WatchOptions -> WatchCompilerHostOfFilesAndCompilerOptions<'T> + abstract createWatchCompilerHost: configFileName: string * optionsToExtend: CompilerOptions option * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> WatchCompilerHostOfConfigFile<'T> + abstract createWatchCompilerHost: rootFiles: string[] * options: CompilerOptions * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?projectReferences: ProjectReference[] * ?watchOptions: WatchOptions -> WatchCompilerHostOfFilesAndCompilerOptions<'T> /// Creates the watch from the host for root files and compiler options abstract createWatchProgram: host: WatchCompilerHostOfFilesAndCompilerOptions<'T> -> WatchOfFilesAndCompilerOptions<'T> /// Creates the watch from the host for config file @@ -650,20 +721,21 @@ module Ts = abstract createBuilderStatusReporter: system: System * ?pretty: bool -> DiagnosticReporter abstract createSolutionBuilderHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportErrorSummary: ReportEmitErrorSummary -> SolutionBuilderHost<'T> abstract createSolutionBuilderWithWatchHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter -> SolutionBuilderWithWatchHost<'T> - abstract createSolutionBuilder: host: SolutionBuilderHost<'T> * rootNames: ResizeArray * defaultOptions: BuildOptions -> SolutionBuilder<'T> - abstract createSolutionBuilderWithWatch: host: SolutionBuilderWithWatchHost<'T> * rootNames: ResizeArray * defaultOptions: BuildOptions * ?baseWatchOptions: WatchOptions -> SolutionBuilder<'T> + abstract createSolutionBuilder: host: SolutionBuilderHost<'T> * rootNames: string[] * defaultOptions: BuildOptions -> SolutionBuilder<'T> + abstract createSolutionBuilderWithWatch: host: SolutionBuilderWithWatchHost<'T> * rootNames: string[] * defaultOptions: BuildOptions * ?baseWatchOptions: WatchOptions -> SolutionBuilder<'T> abstract getDefaultFormatCodeSettings: ?newLineCharacter: string -> FormatCodeSettings /// The classifier is used for syntactic highlighting in editors via the TSServer abstract createClassifier: unit -> Classifier abstract createDocumentRegistry: ?useCaseSensitiveFileNames: bool * ?currentDirectory: string -> DocumentRegistry abstract preProcessFile: sourceText: string * ?readImportFiles: bool * ?detectJavaScriptImports: bool -> PreProcessedFileInfo abstract transpileModule: input: string * transpileOptions: TranspileOptions -> TranspileOutput - abstract transpile: input: string * ?compilerOptions: CompilerOptions * ?fileName: string * ?diagnostics: ResizeArray * ?moduleName: string -> string + abstract transpile: input: string * ?compilerOptions: CompilerOptions * ?fileName: string * ?diagnostics: Diagnostic[] * ?moduleName: string -> string + /// The version of the language service API abstract servicesVersion: obj abstract toEditorSettings: options: U2 -> EditorSettings - abstract displayPartsToString: displayParts: ResizeArray option -> string + abstract displayPartsToString: displayParts: SymbolDisplayPart[] option -> string abstract getDefaultCompilerOptions: unit -> CompilerOptions - abstract getSupportedCodeFixes: unit -> ResizeArray + abstract getSupportedCodeFixes: unit -> string[] abstract createLanguageServiceSourceFile: fileName: string * scriptSnapshot: IScriptSnapshot * scriptTarget: ScriptTarget * version: string * setNodeParents: bool * ?scriptKind: ScriptKind -> SourceFile abstract updateLanguageServiceSourceFile: sourceFile: SourceFile * scriptSnapshot: IScriptSnapshot * version: string * textChangeRange: TextChangeRange option * ?aggressiveChecks: bool -> SourceFile abstract createLanguageService: host: LanguageServiceHost * ?documentRegistry: DocumentRegistry * ?syntaxOnlyOrLanguageServiceMode: U2 -> LanguageService @@ -672,388 +744,716 @@ module Ts = /// The functionality is not supported if the ts module is consumed outside of a node module. abstract getDefaultLibFilePath: options: CompilerOptions -> string /// Transform one or more nodes using the supplied transformers. - /// A single `Node` or an array of `Node` objects. - /// An array of `TransformerFactory` callbacks used to process the transformation. + /// A single Node or an array of Node objects. + /// An array of TransformerFactory callbacks used to process the transformation. /// Optional compiler options. - abstract transform: source: U2<'T, ResizeArray<'T>> * transformers: ResizeArray> * ?compilerOptions: CompilerOptions -> TransformationResult<'T> - abstract createNodeArray: ResizeArray<'T> -> bool -> ResizeArray<'T> - abstract createNumericLiteral: (U2 -> TokenFlags -> NumericLiteral) - abstract createBigIntLiteral: (U2 -> BigIntLiteral) - abstract createStringLiteral: IExportsCreateStringLiteral - abstract createStringLiteralFromNode: (PropertyNameLiteral -> bool -> StringLiteral) - abstract createRegularExpressionLiteral: (string -> RegularExpressionLiteral) - abstract createLoopVariable: (bool -> Identifier) - abstract createUniqueName: (string -> GeneratedIdentifierFlags -> Identifier) - abstract createPrivateIdentifier: (string -> PrivateIdentifier) - abstract createSuper: (unit -> SuperExpression) - abstract createThis: (unit -> ThisExpression) - abstract createNull: (unit -> NullLiteral) - abstract createTrue: (unit -> TrueLiteral) - abstract createFalse: (unit -> FalseLiteral) + abstract transform: source: U2<'T, 'T[]> * transformers: TransformerFactory<'T>[] * ?compilerOptions: CompilerOptions -> TransformationResult<'T> + [] + abstract createNodeArray: ('T[]) option -> (bool) option -> 'T[] + [] + abstract createNumericLiteral: U2 -> (TokenFlags) option -> NumericLiteral + [] + abstract createBigIntLiteral: U2 -> BigIntLiteral + [] + abstract createStringLiteral: {| Invoke: string -> bool option -> StringLiteral; Invoke: string -> bool option -> bool option -> StringLiteral |} + [] + abstract createStringLiteralFromNode: PropertyNameLiteral -> (bool) option -> StringLiteral + [] + abstract createRegularExpressionLiteral: string -> RegularExpressionLiteral + [] + abstract createLoopVariable: (bool) option -> Identifier + [] + abstract createUniqueName: string -> (GeneratedIdentifierFlags) option -> Identifier + [] + abstract createPrivateIdentifier: string -> PrivateIdentifier + [] + abstract createSuper: unit -> SuperExpression + [] + abstract createThis: unit -> ThisExpression + [] + abstract createNull: unit -> NullLiteral + [] + abstract createTrue: unit -> TrueLiteral + [] + abstract createFalse: unit -> FalseLiteral + [] abstract createModifier: 'T -> ModifierToken<'T> - abstract createModifiersFromModifierFlags: (ModifierFlags -> ResizeArray) - abstract createQualifiedName: (EntityName -> U2 -> QualifiedName) - abstract updateQualifiedName: (QualifiedName -> EntityName -> Identifier -> QualifiedName) - abstract createComputedPropertyName: (Expression -> ComputedPropertyName) - abstract updateComputedPropertyName: (ComputedPropertyName -> Expression -> ComputedPropertyName) - abstract createTypeParameterDeclaration: (U2 -> TypeNode -> TypeNode -> TypeParameterDeclaration) - abstract updateTypeParameterDeclaration: (TypeParameterDeclaration -> Identifier -> TypeNode option -> TypeNode option -> TypeParameterDeclaration) - abstract createParameter: (ResizeArray option -> ResizeArray option -> DotDotDotToken option -> U2 -> QuestionToken -> TypeNode -> Expression -> ParameterDeclaration) - abstract updateParameter: (ParameterDeclaration -> ResizeArray option -> ResizeArray option -> DotDotDotToken option -> U2 -> QuestionToken option -> TypeNode option -> Expression option -> ParameterDeclaration) - abstract createDecorator: (Expression -> Decorator) - abstract updateDecorator: (Decorator -> Expression -> Decorator) - abstract createProperty: (ResizeArray option -> ResizeArray option -> U2 -> U2 option -> TypeNode option -> Expression option -> PropertyDeclaration) - abstract updateProperty: (PropertyDeclaration -> ResizeArray option -> ResizeArray option -> U2 -> U2 option -> TypeNode option -> Expression option -> PropertyDeclaration) - abstract createMethod: (ResizeArray option -> ResizeArray option -> AsteriskToken option -> U2 -> QuestionToken option -> ResizeArray option -> ResizeArray -> TypeNode option -> Block option -> MethodDeclaration) - abstract updateMethod: (MethodDeclaration -> ResizeArray option -> ResizeArray option -> AsteriskToken option -> PropertyName -> QuestionToken option -> ResizeArray option -> ResizeArray -> TypeNode option -> Block option -> MethodDeclaration) - abstract createConstructor: (ResizeArray option -> ResizeArray option -> ResizeArray -> Block option -> ConstructorDeclaration) - abstract updateConstructor: (ConstructorDeclaration -> ResizeArray option -> ResizeArray option -> ResizeArray -> Block option -> ConstructorDeclaration) - abstract createGetAccessor: (ResizeArray option -> ResizeArray option -> U2 -> ResizeArray -> TypeNode option -> Block option -> GetAccessorDeclaration) - abstract updateGetAccessor: (GetAccessorDeclaration -> ResizeArray option -> ResizeArray option -> PropertyName -> ResizeArray -> TypeNode option -> Block option -> GetAccessorDeclaration) - abstract createSetAccessor: (ResizeArray option -> ResizeArray option -> U2 -> ResizeArray -> Block option -> SetAccessorDeclaration) - abstract updateSetAccessor: (SetAccessorDeclaration -> ResizeArray option -> ResizeArray option -> PropertyName -> ResizeArray -> Block option -> SetAccessorDeclaration) - abstract createCallSignature: (ResizeArray option -> ResizeArray -> TypeNode option -> CallSignatureDeclaration) - abstract updateCallSignature: (CallSignatureDeclaration -> ResizeArray option -> ResizeArray -> TypeNode option -> CallSignatureDeclaration) - abstract createConstructSignature: (ResizeArray option -> ResizeArray -> TypeNode option -> ConstructSignatureDeclaration) - abstract updateConstructSignature: (ConstructSignatureDeclaration -> ResizeArray option -> ResizeArray -> TypeNode option -> ConstructSignatureDeclaration) - abstract updateIndexSignature: (IndexSignatureDeclaration -> ResizeArray option -> ResizeArray option -> ResizeArray -> TypeNode -> IndexSignatureDeclaration) + [] + abstract createModifiersFromModifierFlags: ModifierFlags -> Modifier[] option + [] + abstract createQualifiedName: EntityName -> U2 -> QualifiedName + [] + abstract updateQualifiedName: QualifiedName -> EntityName -> Identifier -> QualifiedName + [] + abstract createComputedPropertyName: Expression -> ComputedPropertyName + [] + abstract updateComputedPropertyName: ComputedPropertyName -> Expression -> ComputedPropertyName + [] + abstract createTypeParameterDeclaration: U2 -> (TypeNode) option -> (TypeNode) option -> TypeParameterDeclaration + [] + abstract updateTypeParameterDeclaration: TypeParameterDeclaration -> Identifier -> TypeNode option -> TypeNode option -> TypeParameterDeclaration + [] + abstract createParameter: Decorator[] option -> Modifier[] option -> DotDotDotToken option -> U2 -> (QuestionToken) option -> (TypeNode) option -> (Expression) option -> ParameterDeclaration + [] + abstract updateParameter: ParameterDeclaration -> Decorator[] option -> Modifier[] option -> DotDotDotToken option -> U2 -> QuestionToken option -> TypeNode option -> Expression option -> ParameterDeclaration + [] + abstract createDecorator: Expression -> Decorator + [] + abstract updateDecorator: Decorator -> Expression -> Decorator + [] + abstract createProperty: Decorator[] option -> Modifier[] option -> U2 -> U2 option -> TypeNode option -> Expression option -> PropertyDeclaration + [] + abstract updateProperty: PropertyDeclaration -> Decorator[] option -> Modifier[] option -> U2 -> U2 option -> TypeNode option -> Expression option -> PropertyDeclaration + [] + abstract createMethod: Decorator[] option -> Modifier[] option -> AsteriskToken option -> U2 -> QuestionToken option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block option -> MethodDeclaration + [] + abstract updateMethod: MethodDeclaration -> Decorator[] option -> Modifier[] option -> AsteriskToken option -> PropertyName -> QuestionToken option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block option -> MethodDeclaration + [] + abstract createConstructor: Decorator[] option -> Modifier[] option -> ParameterDeclaration[] -> Block option -> ConstructorDeclaration + [] + abstract updateConstructor: ConstructorDeclaration -> Decorator[] option -> Modifier[] option -> ParameterDeclaration[] -> Block option -> ConstructorDeclaration + [] + abstract createGetAccessor: Decorator[] option -> Modifier[] option -> U2 -> ParameterDeclaration[] -> TypeNode option -> Block option -> GetAccessorDeclaration + [] + abstract updateGetAccessor: GetAccessorDeclaration -> Decorator[] option -> Modifier[] option -> PropertyName -> ParameterDeclaration[] -> TypeNode option -> Block option -> GetAccessorDeclaration + [] + abstract createSetAccessor: Decorator[] option -> Modifier[] option -> U2 -> ParameterDeclaration[] -> Block option -> SetAccessorDeclaration + [] + abstract updateSetAccessor: SetAccessorDeclaration -> Decorator[] option -> Modifier[] option -> PropertyName -> ParameterDeclaration[] -> Block option -> SetAccessorDeclaration + [] + abstract createCallSignature: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> CallSignatureDeclaration + [] + abstract updateCallSignature: CallSignatureDeclaration -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> CallSignatureDeclaration + [] + abstract createConstructSignature: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> ConstructSignatureDeclaration + [] + abstract updateConstructSignature: ConstructSignatureDeclaration -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> ConstructSignatureDeclaration + [] + abstract updateIndexSignature: IndexSignatureDeclaration -> Decorator[] option -> Modifier[] option -> ParameterDeclaration[] -> TypeNode -> IndexSignatureDeclaration + [] abstract createKeywordTypeNode: 'TKind -> KeywordTypeNode<'TKind> - abstract createTypePredicateNodeWithModifier: (AssertsKeyword option -> U3 -> TypeNode option -> TypePredicateNode) - abstract updateTypePredicateNodeWithModifier: (TypePredicateNode -> AssertsKeyword option -> U2 -> TypeNode option -> TypePredicateNode) - abstract createTypeReferenceNode: (U2 -> ResizeArray -> TypeReferenceNode) - abstract updateTypeReferenceNode: (TypeReferenceNode -> EntityName -> ResizeArray option -> TypeReferenceNode) - abstract createFunctionTypeNode: (ResizeArray option -> ResizeArray -> TypeNode -> FunctionTypeNode) - abstract updateFunctionTypeNode: (FunctionTypeNode -> ResizeArray option -> ResizeArray -> TypeNode -> FunctionTypeNode) - abstract createConstructorTypeNode: (ResizeArray option -> ResizeArray -> TypeNode -> ConstructorTypeNode) - abstract updateConstructorTypeNode: (ConstructorTypeNode -> ResizeArray option -> ResizeArray -> TypeNode -> ConstructorTypeNode) - abstract createTypeQueryNode: (EntityName -> TypeQueryNode) - abstract updateTypeQueryNode: (TypeQueryNode -> EntityName -> TypeQueryNode) - abstract createTypeLiteralNode: (ResizeArray option -> TypeLiteralNode) - abstract updateTypeLiteralNode: (TypeLiteralNode -> ResizeArray -> TypeLiteralNode) - abstract createArrayTypeNode: (TypeNode -> ArrayTypeNode) - abstract updateArrayTypeNode: (ArrayTypeNode -> TypeNode -> ArrayTypeNode) - abstract createTupleTypeNode: (ResizeArray> -> TupleTypeNode) - abstract updateTupleTypeNode: (TupleTypeNode -> ResizeArray> -> TupleTypeNode) - abstract createOptionalTypeNode: (TypeNode -> OptionalTypeNode) - abstract updateOptionalTypeNode: (OptionalTypeNode -> TypeNode -> OptionalTypeNode) - abstract createRestTypeNode: (TypeNode -> RestTypeNode) - abstract updateRestTypeNode: (RestTypeNode -> TypeNode -> RestTypeNode) - abstract createUnionTypeNode: (ResizeArray -> UnionTypeNode) - abstract updateUnionTypeNode: (UnionTypeNode -> ResizeArray -> UnionTypeNode) - abstract createIntersectionTypeNode: (ResizeArray -> IntersectionTypeNode) - abstract updateIntersectionTypeNode: (IntersectionTypeNode -> ResizeArray -> IntersectionTypeNode) - abstract createConditionalTypeNode: (TypeNode -> TypeNode -> TypeNode -> TypeNode -> ConditionalTypeNode) - abstract updateConditionalTypeNode: (ConditionalTypeNode -> TypeNode -> TypeNode -> TypeNode -> TypeNode -> ConditionalTypeNode) - abstract createInferTypeNode: (TypeParameterDeclaration -> InferTypeNode) - abstract updateInferTypeNode: (InferTypeNode -> TypeParameterDeclaration -> InferTypeNode) - abstract createImportTypeNode: (TypeNode -> EntityName -> ResizeArray -> bool -> ImportTypeNode) - abstract updateImportTypeNode: (ImportTypeNode -> TypeNode -> EntityName option -> ResizeArray option -> bool -> ImportTypeNode) - abstract createParenthesizedType: (TypeNode -> ParenthesizedTypeNode) - abstract updateParenthesizedType: (ParenthesizedTypeNode -> TypeNode -> ParenthesizedTypeNode) - abstract createThisTypeNode: (unit -> ThisTypeNode) - abstract updateTypeOperatorNode: (TypeOperatorNode -> TypeNode -> TypeOperatorNode) - abstract createIndexedAccessTypeNode: (TypeNode -> TypeNode -> IndexedAccessTypeNode) - abstract updateIndexedAccessTypeNode: (IndexedAccessTypeNode -> TypeNode -> TypeNode -> IndexedAccessTypeNode) - abstract createMappedTypeNode: (U3 option -> TypeParameterDeclaration -> TypeNode option -> U3 option -> TypeNode option -> ResizeArray option -> MappedTypeNode) - abstract updateMappedTypeNode: (MappedTypeNode -> U3 option -> TypeParameterDeclaration -> TypeNode option -> U3 option -> TypeNode option -> ResizeArray option -> MappedTypeNode) - abstract createLiteralTypeNode: (U4 -> LiteralTypeNode) - abstract updateLiteralTypeNode: (LiteralTypeNode -> U4 -> LiteralTypeNode) - abstract createObjectBindingPattern: (ResizeArray -> ObjectBindingPattern) - abstract updateObjectBindingPattern: (ObjectBindingPattern -> ResizeArray -> ObjectBindingPattern) - abstract createArrayBindingPattern: (ResizeArray -> ArrayBindingPattern) - abstract updateArrayBindingPattern: (ArrayBindingPattern -> ResizeArray -> ArrayBindingPattern) - abstract createBindingElement: (DotDotDotToken option -> U2 option -> U2 -> Expression -> BindingElement) - abstract updateBindingElement: (BindingElement -> DotDotDotToken option -> PropertyName option -> BindingName -> Expression option -> BindingElement) - abstract createArrayLiteral: (ResizeArray -> bool -> ArrayLiteralExpression) - abstract updateArrayLiteral: (ArrayLiteralExpression -> ResizeArray -> ArrayLiteralExpression) - abstract createObjectLiteral: (ResizeArray -> bool -> ObjectLiteralExpression) - abstract updateObjectLiteral: (ObjectLiteralExpression -> ResizeArray -> ObjectLiteralExpression) - abstract createPropertyAccess: (Expression -> U2 -> PropertyAccessExpression) - abstract updatePropertyAccess: (PropertyAccessExpression -> Expression -> MemberName -> PropertyAccessExpression) - abstract createPropertyAccessChain: (Expression -> QuestionDotToken option -> U2 -> PropertyAccessChain) - abstract updatePropertyAccessChain: (PropertyAccessChain -> Expression -> QuestionDotToken option -> MemberName -> PropertyAccessChain) - abstract createElementAccess: (Expression -> U2 -> ElementAccessExpression) - abstract updateElementAccess: (ElementAccessExpression -> Expression -> Expression -> ElementAccessExpression) - abstract createElementAccessChain: (Expression -> QuestionDotToken option -> U2 -> ElementAccessChain) - abstract updateElementAccessChain: (ElementAccessChain -> Expression -> QuestionDotToken option -> Expression -> ElementAccessChain) - abstract createCall: (Expression -> ResizeArray option -> ResizeArray option -> CallExpression) - abstract updateCall: (CallExpression -> Expression -> ResizeArray option -> ResizeArray -> CallExpression) - abstract createCallChain: (Expression -> QuestionDotToken option -> ResizeArray option -> ResizeArray option -> CallChain) - abstract updateCallChain: (CallChain -> Expression -> QuestionDotToken option -> ResizeArray option -> ResizeArray -> CallChain) - abstract createNew: (Expression -> ResizeArray option -> ResizeArray option -> NewExpression) - abstract updateNew: (NewExpression -> Expression -> ResizeArray option -> ResizeArray option -> NewExpression) - abstract createTypeAssertion: (TypeNode -> Expression -> TypeAssertion) - abstract updateTypeAssertion: (TypeAssertion -> TypeNode -> Expression -> TypeAssertion) - abstract createParen: (Expression -> ParenthesizedExpression) - abstract updateParen: (ParenthesizedExpression -> Expression -> ParenthesizedExpression) - abstract createFunctionExpression: (ResizeArray option -> AsteriskToken option -> U2 option -> ResizeArray option -> ResizeArray option -> TypeNode option -> Block -> FunctionExpression) - abstract updateFunctionExpression: (FunctionExpression -> ResizeArray option -> AsteriskToken option -> Identifier option -> ResizeArray option -> ResizeArray -> TypeNode option -> Block -> FunctionExpression) - abstract createDelete: (Expression -> DeleteExpression) - abstract updateDelete: (DeleteExpression -> Expression -> DeleteExpression) - abstract createTypeOf: (Expression -> TypeOfExpression) - abstract updateTypeOf: (TypeOfExpression -> Expression -> TypeOfExpression) - abstract createVoid: (Expression -> VoidExpression) - abstract updateVoid: (VoidExpression -> Expression -> VoidExpression) - abstract createAwait: (Expression -> AwaitExpression) - abstract updateAwait: (AwaitExpression -> Expression -> AwaitExpression) - abstract createPrefix: (PrefixUnaryOperator -> Expression -> PrefixUnaryExpression) - abstract updatePrefix: (PrefixUnaryExpression -> Expression -> PrefixUnaryExpression) - abstract createPostfix: (Expression -> PostfixUnaryOperator -> PostfixUnaryExpression) - abstract updatePostfix: (PostfixUnaryExpression -> Expression -> PostfixUnaryExpression) - abstract createBinary: (Expression -> U2 -> Expression -> BinaryExpression) - abstract updateConditional: (ConditionalExpression -> Expression -> QuestionToken -> Expression -> ColonToken -> Expression -> ConditionalExpression) - abstract createTemplateExpression: (TemplateHead -> ResizeArray -> TemplateExpression) - abstract updateTemplateExpression: (TemplateExpression -> TemplateHead -> ResizeArray -> TemplateExpression) - abstract createTemplateHead: IExportsCreateTemplateHead - abstract createTemplateMiddle: IExportsCreateTemplateMiddle - abstract createTemplateTail: IExportsCreateTemplateTail - abstract createNoSubstitutionTemplateLiteral: IExportsCreateNoSubstitutionTemplateLiteral - abstract updateYield: (YieldExpression -> AsteriskToken option -> Expression option -> YieldExpression) - abstract createSpread: (Expression -> SpreadElement) - abstract updateSpread: (SpreadElement -> Expression -> SpreadElement) - abstract createOmittedExpression: (unit -> OmittedExpression) - abstract createAsExpression: (Expression -> TypeNode -> AsExpression) - abstract updateAsExpression: (AsExpression -> Expression -> TypeNode -> AsExpression) - abstract createNonNullExpression: (Expression -> NonNullExpression) - abstract updateNonNullExpression: (NonNullExpression -> Expression -> NonNullExpression) - abstract createNonNullChain: (Expression -> NonNullChain) - abstract updateNonNullChain: (NonNullChain -> Expression -> NonNullChain) - abstract createMetaProperty: (SyntaxKind -> Identifier -> MetaProperty) - abstract updateMetaProperty: (MetaProperty -> Identifier -> MetaProperty) - abstract createTemplateSpan: (Expression -> U2 -> TemplateSpan) - abstract updateTemplateSpan: (TemplateSpan -> Expression -> U2 -> TemplateSpan) - abstract createSemicolonClassElement: (unit -> SemicolonClassElement) - abstract createBlock: (ResizeArray -> bool -> Block) - abstract updateBlock: (Block -> ResizeArray -> Block) - abstract createVariableStatement: (ResizeArray option -> U2> -> VariableStatement) - abstract updateVariableStatement: (VariableStatement -> ResizeArray option -> VariableDeclarationList -> VariableStatement) - abstract createEmptyStatement: (unit -> EmptyStatement) - abstract createExpressionStatement: (Expression -> ExpressionStatement) - abstract updateExpressionStatement: (ExpressionStatement -> Expression -> ExpressionStatement) - abstract createStatement: (Expression -> ExpressionStatement) - abstract updateStatement: (ExpressionStatement -> Expression -> ExpressionStatement) - abstract createIf: (Expression -> Statement -> Statement -> IfStatement) - abstract updateIf: (IfStatement -> Expression -> Statement -> Statement option -> IfStatement) - abstract createDo: (Statement -> Expression -> DoStatement) - abstract updateDo: (DoStatement -> Statement -> Expression -> DoStatement) - abstract createWhile: (Expression -> Statement -> WhileStatement) - abstract updateWhile: (WhileStatement -> Expression -> Statement -> WhileStatement) - abstract createFor: (ForInitializer option -> Expression option -> Expression option -> Statement -> ForStatement) - abstract updateFor: (ForStatement -> ForInitializer option -> Expression option -> Expression option -> Statement -> ForStatement) - abstract createForIn: (ForInitializer -> Expression -> Statement -> ForInStatement) - abstract updateForIn: (ForInStatement -> ForInitializer -> Expression -> Statement -> ForInStatement) - abstract createForOf: (AwaitKeyword option -> ForInitializer -> Expression -> Statement -> ForOfStatement) - abstract updateForOf: (ForOfStatement -> AwaitKeyword option -> ForInitializer -> Expression -> Statement -> ForOfStatement) - abstract createContinue: (U2 -> ContinueStatement) - abstract updateContinue: (ContinueStatement -> Identifier option -> ContinueStatement) - abstract createBreak: (U2 -> BreakStatement) - abstract updateBreak: (BreakStatement -> Identifier option -> BreakStatement) - abstract createReturn: (Expression -> ReturnStatement) - abstract updateReturn: (ReturnStatement -> Expression option -> ReturnStatement) - abstract createWith: (Expression -> Statement -> WithStatement) - abstract updateWith: (WithStatement -> Expression -> Statement -> WithStatement) - abstract createSwitch: (Expression -> CaseBlock -> SwitchStatement) - abstract updateSwitch: (SwitchStatement -> Expression -> CaseBlock -> SwitchStatement) - abstract createLabel: (U2 -> Statement -> LabeledStatement) - abstract updateLabel: (LabeledStatement -> Identifier -> Statement -> LabeledStatement) - abstract createThrow: (Expression -> ThrowStatement) - abstract updateThrow: (ThrowStatement -> Expression -> ThrowStatement) - abstract createTry: (Block -> CatchClause option -> Block option -> TryStatement) - abstract updateTry: (TryStatement -> Block -> CatchClause option -> Block option -> TryStatement) - abstract createDebuggerStatement: (unit -> DebuggerStatement) - abstract createVariableDeclarationList: (ResizeArray -> NodeFlags -> VariableDeclarationList) - abstract updateVariableDeclarationList: (VariableDeclarationList -> ResizeArray -> VariableDeclarationList) - abstract createFunctionDeclaration: (ResizeArray option -> ResizeArray option -> AsteriskToken option -> U2 option -> ResizeArray option -> ResizeArray -> TypeNode option -> Block option -> FunctionDeclaration) - abstract updateFunctionDeclaration: (FunctionDeclaration -> ResizeArray option -> ResizeArray option -> AsteriskToken option -> Identifier option -> ResizeArray option -> ResizeArray -> TypeNode option -> Block option -> FunctionDeclaration) - abstract createClassDeclaration: (ResizeArray option -> ResizeArray option -> U2 option -> ResizeArray option -> ResizeArray option -> ResizeArray -> ClassDeclaration) - abstract updateClassDeclaration: (ClassDeclaration -> ResizeArray option -> ResizeArray option -> Identifier option -> ResizeArray option -> ResizeArray option -> ResizeArray -> ClassDeclaration) - abstract createInterfaceDeclaration: (ResizeArray option -> ResizeArray option -> U2 -> ResizeArray option -> ResizeArray option -> ResizeArray -> InterfaceDeclaration) - abstract updateInterfaceDeclaration: (InterfaceDeclaration -> ResizeArray option -> ResizeArray option -> Identifier -> ResizeArray option -> ResizeArray option -> ResizeArray -> InterfaceDeclaration) - abstract createTypeAliasDeclaration: (ResizeArray option -> ResizeArray option -> U2 -> ResizeArray option -> TypeNode -> TypeAliasDeclaration) - abstract updateTypeAliasDeclaration: (TypeAliasDeclaration -> ResizeArray option -> ResizeArray option -> Identifier -> ResizeArray option -> TypeNode -> TypeAliasDeclaration) - abstract createEnumDeclaration: (ResizeArray option -> ResizeArray option -> U2 -> ResizeArray -> EnumDeclaration) - abstract updateEnumDeclaration: (EnumDeclaration -> ResizeArray option -> ResizeArray option -> Identifier -> ResizeArray -> EnumDeclaration) - abstract createModuleDeclaration: (ResizeArray option -> ResizeArray option -> ModuleName -> ModuleBody option -> NodeFlags -> ModuleDeclaration) - abstract updateModuleDeclaration: (ModuleDeclaration -> ResizeArray option -> ResizeArray option -> ModuleName -> ModuleBody option -> ModuleDeclaration) - abstract createModuleBlock: (ResizeArray -> ModuleBlock) - abstract updateModuleBlock: (ModuleBlock -> ResizeArray -> ModuleBlock) - abstract createCaseBlock: (ResizeArray -> CaseBlock) - abstract updateCaseBlock: (CaseBlock -> ResizeArray -> CaseBlock) - abstract createNamespaceExportDeclaration: (U2 -> NamespaceExportDeclaration) - abstract updateNamespaceExportDeclaration: (NamespaceExportDeclaration -> Identifier -> NamespaceExportDeclaration) - abstract createImportEqualsDeclaration: (ResizeArray option -> ResizeArray option -> bool -> U2 -> ModuleReference -> ImportEqualsDeclaration) - abstract updateImportEqualsDeclaration: (ImportEqualsDeclaration -> ResizeArray option -> ResizeArray option -> bool -> Identifier -> ModuleReference -> ImportEqualsDeclaration) - abstract createImportDeclaration: (ResizeArray option -> ResizeArray option -> ImportClause option -> Expression -> AssertClause -> ImportDeclaration) - abstract updateImportDeclaration: (ImportDeclaration -> ResizeArray option -> ResizeArray option -> ImportClause option -> Expression -> AssertClause option -> ImportDeclaration) - abstract createNamespaceImport: (Identifier -> NamespaceImport) - abstract updateNamespaceImport: (NamespaceImport -> Identifier -> NamespaceImport) - abstract createNamedImports: (ResizeArray -> NamedImports) - abstract updateNamedImports: (NamedImports -> ResizeArray -> NamedImports) - abstract createImportSpecifier: (bool -> Identifier option -> Identifier -> ImportSpecifier) - abstract updateImportSpecifier: (ImportSpecifier -> bool -> Identifier option -> Identifier -> ImportSpecifier) - abstract createExportAssignment: (ResizeArray option -> ResizeArray option -> bool option -> Expression -> ExportAssignment) - abstract updateExportAssignment: (ExportAssignment -> ResizeArray option -> ResizeArray option -> Expression -> ExportAssignment) - abstract createNamedExports: (ResizeArray -> NamedExports) - abstract updateNamedExports: (NamedExports -> ResizeArray -> NamedExports) - abstract createExportSpecifier: (bool -> U2 option -> U2 -> ExportSpecifier) - abstract updateExportSpecifier: (ExportSpecifier -> bool -> Identifier option -> Identifier -> ExportSpecifier) - abstract createExternalModuleReference: (Expression -> ExternalModuleReference) - abstract updateExternalModuleReference: (ExternalModuleReference -> Expression -> ExternalModuleReference) - abstract createJSDocTypeExpression: (TypeNode -> JSDocTypeExpression) - abstract createJSDocTypeTag: (Identifier option -> JSDocTypeExpression -> U2> -> JSDocTypeTag) - abstract createJSDocReturnTag: (Identifier option -> JSDocTypeExpression -> U2> -> JSDocReturnTag) - abstract createJSDocThisTag: (Identifier option -> JSDocTypeExpression -> U2> -> JSDocThisTag) - abstract createJSDocComment: (U2> -> ResizeArray -> JSDoc) - abstract createJSDocParameterTag: (Identifier option -> EntityName -> bool -> JSDocTypeExpression -> bool -> U2> -> JSDocParameterTag) - abstract createJSDocClassTag: (Identifier option -> U2> -> JSDocClassTag) - abstract createJSDocAugmentsTag: (Identifier option -> obj -> U2> -> JSDocAugmentsTag) - abstract createJSDocEnumTag: (Identifier option -> JSDocTypeExpression -> U2> -> JSDocEnumTag) - abstract createJSDocTemplateTag: (Identifier option -> JSDocTypeExpression option -> ResizeArray -> U2> -> JSDocTemplateTag) - abstract createJSDocTypedefTag: (Identifier option -> U2 -> U2 -> U2> -> JSDocTypedefTag) - abstract createJSDocCallbackTag: (Identifier option -> JSDocSignature -> U2 -> U2> -> JSDocCallbackTag) - abstract createJSDocSignature: (ResizeArray option -> ResizeArray -> JSDocReturnTag -> JSDocSignature) - abstract createJSDocPropertyTag: (Identifier option -> EntityName -> bool -> JSDocTypeExpression -> bool -> U2> -> JSDocPropertyTag) - abstract createJSDocTypeLiteral: (ResizeArray -> bool -> JSDocTypeLiteral) - abstract createJSDocImplementsTag: (Identifier option -> obj -> U2> -> JSDocImplementsTag) - abstract createJSDocAuthorTag: (Identifier option -> U2> -> JSDocAuthorTag) - abstract createJSDocPublicTag: (Identifier option -> U2> -> JSDocPublicTag) - abstract createJSDocPrivateTag: (Identifier option -> U2> -> JSDocPrivateTag) - abstract createJSDocProtectedTag: (Identifier option -> U2> -> JSDocProtectedTag) - abstract createJSDocReadonlyTag: (Identifier option -> U2> -> JSDocReadonlyTag) - abstract createJSDocTag: (Identifier -> U2> -> JSDocUnknownTag) - abstract createJsxElement: (JsxOpeningElement -> ResizeArray -> JsxClosingElement -> JsxElement) - abstract updateJsxElement: (JsxElement -> JsxOpeningElement -> ResizeArray -> JsxClosingElement -> JsxElement) - abstract createJsxSelfClosingElement: (JsxTagNameExpression -> ResizeArray option -> JsxAttributes -> JsxSelfClosingElement) - abstract updateJsxSelfClosingElement: (JsxSelfClosingElement -> JsxTagNameExpression -> ResizeArray option -> JsxAttributes -> JsxSelfClosingElement) - abstract createJsxOpeningElement: (JsxTagNameExpression -> ResizeArray option -> JsxAttributes -> JsxOpeningElement) - abstract updateJsxOpeningElement: (JsxOpeningElement -> JsxTagNameExpression -> ResizeArray option -> JsxAttributes -> JsxOpeningElement) - abstract createJsxClosingElement: (JsxTagNameExpression -> JsxClosingElement) - abstract updateJsxClosingElement: (JsxClosingElement -> JsxTagNameExpression -> JsxClosingElement) - abstract createJsxFragment: (JsxOpeningFragment -> ResizeArray -> JsxClosingFragment -> JsxFragment) - abstract createJsxText: (string -> bool -> JsxText) - abstract updateJsxText: (JsxText -> string -> bool -> JsxText) - abstract createJsxOpeningFragment: (unit -> JsxOpeningFragment) - abstract createJsxJsxClosingFragment: (unit -> JsxClosingFragment) - abstract updateJsxFragment: (JsxFragment -> JsxOpeningFragment -> ResizeArray -> JsxClosingFragment -> JsxFragment) - abstract createJsxAttribute: (Identifier -> U2 option -> JsxAttribute) - abstract updateJsxAttribute: (JsxAttribute -> Identifier -> U2 option -> JsxAttribute) - abstract createJsxAttributes: (ResizeArray -> JsxAttributes) - abstract updateJsxAttributes: (JsxAttributes -> ResizeArray -> JsxAttributes) - abstract createJsxSpreadAttribute: (Expression -> JsxSpreadAttribute) - abstract updateJsxSpreadAttribute: (JsxSpreadAttribute -> Expression -> JsxSpreadAttribute) - abstract createJsxExpression: (DotDotDotToken option -> Expression option -> JsxExpression) - abstract updateJsxExpression: (JsxExpression -> Expression option -> JsxExpression) - abstract createCaseClause: (Expression -> ResizeArray -> CaseClause) - abstract updateCaseClause: (CaseClause -> Expression -> ResizeArray -> CaseClause) - abstract createDefaultClause: (ResizeArray -> DefaultClause) - abstract updateDefaultClause: (DefaultClause -> ResizeArray -> DefaultClause) - abstract createHeritageClause: (SyntaxKind -> ResizeArray -> HeritageClause) - abstract updateHeritageClause: (HeritageClause -> ResizeArray -> HeritageClause) - abstract createCatchClause: (U3 option -> Block -> CatchClause) - abstract updateCatchClause: (CatchClause -> VariableDeclaration option -> Block -> CatchClause) - abstract createPropertyAssignment: (U2 -> Expression -> PropertyAssignment) - abstract updatePropertyAssignment: (PropertyAssignment -> PropertyName -> Expression -> PropertyAssignment) - abstract createShorthandPropertyAssignment: (U2 -> Expression -> ShorthandPropertyAssignment) - abstract updateShorthandPropertyAssignment: (ShorthandPropertyAssignment -> Identifier -> Expression option -> ShorthandPropertyAssignment) - abstract createSpreadAssignment: (Expression -> SpreadAssignment) - abstract updateSpreadAssignment: (SpreadAssignment -> Expression -> SpreadAssignment) - abstract createEnumMember: (U2 -> Expression -> EnumMember) - abstract updateEnumMember: (EnumMember -> PropertyName -> Expression option -> EnumMember) - abstract updateSourceFileNode: (SourceFile -> ResizeArray -> bool -> ResizeArray -> ResizeArray -> bool -> ResizeArray -> SourceFile) - abstract createNotEmittedStatement: (Node -> NotEmittedStatement) - abstract createPartiallyEmittedExpression: (Expression -> Node -> PartiallyEmittedExpression) - abstract updatePartiallyEmittedExpression: (PartiallyEmittedExpression -> Expression -> PartiallyEmittedExpression) - abstract createCommaList: (ResizeArray -> CommaListExpression) - abstract updateCommaList: (CommaListExpression -> ResizeArray -> CommaListExpression) - abstract createBundle: (ResizeArray -> ResizeArray> -> Bundle) - abstract updateBundle: (Bundle -> ResizeArray -> ResizeArray> -> Bundle) - abstract createImmediatelyInvokedFunctionExpression: IExportsCreateImmediatelyInvokedFunctionExpression - abstract createImmediatelyInvokedArrowFunction: IExportsCreateImmediatelyInvokedFunctionExpression - abstract createVoidZero: (unit -> VoidExpression) - abstract createExportDefault: (Expression -> ExportAssignment) - abstract createExternalModuleExport: (Identifier -> ExportDeclaration) - abstract createNamespaceExport: (Identifier -> NamespaceExport) - abstract updateNamespaceExport: (NamespaceExport -> Identifier -> NamespaceExport) + [] + abstract createTypePredicateNodeWithModifier: AssertsKeyword option -> U3 -> TypeNode option -> TypePredicateNode + [] + abstract updateTypePredicateNodeWithModifier: TypePredicateNode -> AssertsKeyword option -> U2 -> TypeNode option -> TypePredicateNode + [] + abstract createTypeReferenceNode: U2 -> (TypeNode[]) option -> TypeReferenceNode + [] + abstract updateTypeReferenceNode: TypeReferenceNode -> EntityName -> TypeNode[] option -> TypeReferenceNode + [] + abstract createFunctionTypeNode: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode -> FunctionTypeNode + [] + abstract updateFunctionTypeNode: FunctionTypeNode -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode -> FunctionTypeNode + [] + abstract createConstructorTypeNode: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode -> ConstructorTypeNode + [] + abstract updateConstructorTypeNode: ConstructorTypeNode -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode -> ConstructorTypeNode + [] + abstract createTypeQueryNode: EntityName -> TypeQueryNode + [] + abstract updateTypeQueryNode: TypeQueryNode -> EntityName -> TypeQueryNode + [] + abstract createTypeLiteralNode: TypeElement[] option -> TypeLiteralNode + [] + abstract updateTypeLiteralNode: TypeLiteralNode -> TypeElement[] -> TypeLiteralNode + [] + abstract createArrayTypeNode: TypeNode -> ArrayTypeNode + [] + abstract updateArrayTypeNode: ArrayTypeNode -> TypeNode -> ArrayTypeNode + [] + abstract createTupleTypeNode: U2[] -> TupleTypeNode + [] + abstract updateTupleTypeNode: TupleTypeNode -> U2[] -> TupleTypeNode + [] + abstract createOptionalTypeNode: TypeNode -> OptionalTypeNode + [] + abstract updateOptionalTypeNode: OptionalTypeNode -> TypeNode -> OptionalTypeNode + [] + abstract createRestTypeNode: TypeNode -> RestTypeNode + [] + abstract updateRestTypeNode: RestTypeNode -> TypeNode -> RestTypeNode + [] + abstract createUnionTypeNode: TypeNode[] -> UnionTypeNode + [] + abstract updateUnionTypeNode: UnionTypeNode -> TypeNode[] -> UnionTypeNode + [] + abstract createIntersectionTypeNode: TypeNode[] -> IntersectionTypeNode + [] + abstract updateIntersectionTypeNode: IntersectionTypeNode -> TypeNode[] -> IntersectionTypeNode + [] + abstract createConditionalTypeNode: TypeNode -> TypeNode -> TypeNode -> TypeNode -> ConditionalTypeNode + [] + abstract updateConditionalTypeNode: ConditionalTypeNode -> TypeNode -> TypeNode -> TypeNode -> TypeNode -> ConditionalTypeNode + [] + abstract createInferTypeNode: TypeParameterDeclaration -> InferTypeNode + [] + abstract updateInferTypeNode: InferTypeNode -> TypeParameterDeclaration -> InferTypeNode + [] + abstract createImportTypeNode: TypeNode -> (EntityName) option -> (TypeNode[]) option -> (bool) option -> ImportTypeNode + [] + abstract updateImportTypeNode: ImportTypeNode -> TypeNode -> EntityName option -> TypeNode[] option -> (bool) option -> ImportTypeNode + [] + abstract createParenthesizedType: TypeNode -> ParenthesizedTypeNode + [] + abstract updateParenthesizedType: ParenthesizedTypeNode -> TypeNode -> ParenthesizedTypeNode + [] + abstract createThisTypeNode: unit -> ThisTypeNode + [] + abstract updateTypeOperatorNode: TypeOperatorNode -> TypeNode -> TypeOperatorNode + [] + abstract createIndexedAccessTypeNode: TypeNode -> TypeNode -> IndexedAccessTypeNode + [] + abstract updateIndexedAccessTypeNode: IndexedAccessTypeNode -> TypeNode -> TypeNode -> IndexedAccessTypeNode + [] + abstract createMappedTypeNode: U3 option -> TypeParameterDeclaration -> TypeNode option -> U3 option -> TypeNode option -> TypeElement[] option -> MappedTypeNode + [] + abstract updateMappedTypeNode: MappedTypeNode -> U3 option -> TypeParameterDeclaration -> TypeNode option -> U3 option -> TypeNode option -> TypeElement[] option -> MappedTypeNode + [] + abstract createLiteralTypeNode: U4 -> LiteralTypeNode + [] + abstract updateLiteralTypeNode: LiteralTypeNode -> U4 -> LiteralTypeNode + [] + abstract createObjectBindingPattern: BindingElement[] -> ObjectBindingPattern + [] + abstract updateObjectBindingPattern: ObjectBindingPattern -> BindingElement[] -> ObjectBindingPattern + [] + abstract createArrayBindingPattern: ArrayBindingElement[] -> ArrayBindingPattern + [] + abstract updateArrayBindingPattern: ArrayBindingPattern -> ArrayBindingElement[] -> ArrayBindingPattern + [] + abstract createBindingElement: DotDotDotToken option -> U2 option -> U2 -> (Expression) option -> BindingElement + [] + abstract updateBindingElement: BindingElement -> DotDotDotToken option -> PropertyName option -> BindingName -> Expression option -> BindingElement + [] + abstract createArrayLiteral: (Expression[]) option -> (bool) option -> ArrayLiteralExpression + [] + abstract updateArrayLiteral: ArrayLiteralExpression -> Expression[] -> ArrayLiteralExpression + [] + abstract createObjectLiteral: (ObjectLiteralElementLike[]) option -> (bool) option -> ObjectLiteralExpression + [] + abstract updateObjectLiteral: ObjectLiteralExpression -> ObjectLiteralElementLike[] -> ObjectLiteralExpression + [] + abstract createPropertyAccess: Expression -> U2 -> PropertyAccessExpression + [] + abstract updatePropertyAccess: PropertyAccessExpression -> Expression -> MemberName -> PropertyAccessExpression + [] + abstract createPropertyAccessChain: Expression -> QuestionDotToken option -> U2 -> PropertyAccessChain + [] + abstract updatePropertyAccessChain: PropertyAccessChain -> Expression -> QuestionDotToken option -> MemberName -> PropertyAccessChain + [] + abstract createElementAccess: Expression -> U2 -> ElementAccessExpression + [] + abstract updateElementAccess: ElementAccessExpression -> Expression -> Expression -> ElementAccessExpression + [] + abstract createElementAccessChain: Expression -> QuestionDotToken option -> U2 -> ElementAccessChain + [] + abstract updateElementAccessChain: ElementAccessChain -> Expression -> QuestionDotToken option -> Expression -> ElementAccessChain + [] + abstract createCall: Expression -> TypeNode[] option -> Expression[] option -> CallExpression + [] + abstract updateCall: CallExpression -> Expression -> TypeNode[] option -> Expression[] -> CallExpression + [] + abstract createCallChain: Expression -> QuestionDotToken option -> TypeNode[] option -> Expression[] option -> CallChain + [] + abstract updateCallChain: CallChain -> Expression -> QuestionDotToken option -> TypeNode[] option -> Expression[] -> CallChain + [] + abstract createNew: Expression -> TypeNode[] option -> Expression[] option -> NewExpression + [] + abstract updateNew: NewExpression -> Expression -> TypeNode[] option -> Expression[] option -> NewExpression + [] + abstract createTypeAssertion: TypeNode -> Expression -> TypeAssertion + [] + abstract updateTypeAssertion: TypeAssertion -> TypeNode -> Expression -> TypeAssertion + [] + abstract createParen: Expression -> ParenthesizedExpression + [] + abstract updateParen: ParenthesizedExpression -> Expression -> ParenthesizedExpression + [] + abstract createFunctionExpression: Modifier[] option -> AsteriskToken option -> U2 option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] option -> TypeNode option -> Block -> FunctionExpression + [] + abstract updateFunctionExpression: FunctionExpression -> Modifier[] option -> AsteriskToken option -> Identifier option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block -> FunctionExpression + [] + abstract createDelete: Expression -> DeleteExpression + [] + abstract updateDelete: DeleteExpression -> Expression -> DeleteExpression + [] + abstract createTypeOf: Expression -> TypeOfExpression + [] + abstract updateTypeOf: TypeOfExpression -> Expression -> TypeOfExpression + [] + abstract createVoid: Expression -> VoidExpression + [] + abstract updateVoid: VoidExpression -> Expression -> VoidExpression + [] + abstract createAwait: Expression -> AwaitExpression + [] + abstract updateAwait: AwaitExpression -> Expression -> AwaitExpression + [] + abstract createPrefix: PrefixUnaryOperator -> Expression -> PrefixUnaryExpression + [] + abstract updatePrefix: PrefixUnaryExpression -> Expression -> PrefixUnaryExpression + [] + abstract createPostfix: Expression -> PostfixUnaryOperator -> PostfixUnaryExpression + [] + abstract updatePostfix: PostfixUnaryExpression -> Expression -> PostfixUnaryExpression + [] + abstract createBinary: Expression -> U2 -> Expression -> BinaryExpression + [] + abstract updateConditional: ConditionalExpression -> Expression -> QuestionToken -> Expression -> ColonToken -> Expression -> ConditionalExpression + [] + abstract createTemplateExpression: TemplateHead -> TemplateSpan[] -> TemplateExpression + [] + abstract updateTemplateExpression: TemplateExpression -> TemplateHead -> TemplateSpan[] -> TemplateExpression + [] + abstract createTemplateHead: {| Invoke: string -> string option -> TokenFlags option -> TemplateHead; Invoke: string option -> string -> TokenFlags option -> TemplateHead |} + [] + abstract createTemplateMiddle: {| Invoke: string -> string option -> TokenFlags option -> TemplateMiddle; Invoke: string option -> string -> TokenFlags option -> TemplateMiddle |} + [] + abstract createTemplateTail: {| Invoke: string -> string option -> TokenFlags option -> TemplateTail; Invoke: string option -> string -> TokenFlags option -> TemplateTail |} + [] + abstract createNoSubstitutionTemplateLiteral: {| Invoke: string -> string option -> NoSubstitutionTemplateLiteral; Invoke: string option -> string -> NoSubstitutionTemplateLiteral |} + [] + abstract updateYield: YieldExpression -> AsteriskToken option -> Expression option -> YieldExpression + [] + abstract createSpread: Expression -> SpreadElement + [] + abstract updateSpread: SpreadElement -> Expression -> SpreadElement + [] + abstract createOmittedExpression: unit -> OmittedExpression + [] + abstract createAsExpression: Expression -> TypeNode -> AsExpression + [] + abstract updateAsExpression: AsExpression -> Expression -> TypeNode -> AsExpression + [] + abstract createNonNullExpression: Expression -> NonNullExpression + [] + abstract updateNonNullExpression: NonNullExpression -> Expression -> NonNullExpression + [] + abstract createNonNullChain: Expression -> NonNullChain + [] + abstract updateNonNullChain: NonNullChain -> Expression -> NonNullChain + [] + abstract createMetaProperty: SyntaxKind -> Identifier -> MetaProperty + [] + abstract updateMetaProperty: MetaProperty -> Identifier -> MetaProperty + [] + abstract createTemplateSpan: Expression -> U2 -> TemplateSpan + [] + abstract updateTemplateSpan: TemplateSpan -> Expression -> U2 -> TemplateSpan + [] + abstract createSemicolonClassElement: unit -> SemicolonClassElement + [] + abstract createBlock: Statement[] -> (bool) option -> Block + [] + abstract updateBlock: Block -> Statement[] -> Block + [] + abstract createVariableStatement: Modifier[] option -> U2 -> VariableStatement + [] + abstract updateVariableStatement: VariableStatement -> Modifier[] option -> VariableDeclarationList -> VariableStatement + [] + abstract createEmptyStatement: unit -> EmptyStatement + [] + abstract createExpressionStatement: Expression -> ExpressionStatement + [] + abstract updateExpressionStatement: ExpressionStatement -> Expression -> ExpressionStatement + [] + abstract createStatement: Expression -> ExpressionStatement + [] + abstract updateStatement: ExpressionStatement -> Expression -> ExpressionStatement + [] + abstract createIf: Expression -> Statement -> (Statement) option -> IfStatement + [] + abstract updateIf: IfStatement -> Expression -> Statement -> Statement option -> IfStatement + [] + abstract createDo: Statement -> Expression -> DoStatement + [] + abstract updateDo: DoStatement -> Statement -> Expression -> DoStatement + [] + abstract createWhile: Expression -> Statement -> WhileStatement + [] + abstract updateWhile: WhileStatement -> Expression -> Statement -> WhileStatement + [] + abstract createFor: ForInitializer option -> Expression option -> Expression option -> Statement -> ForStatement + [] + abstract updateFor: ForStatement -> ForInitializer option -> Expression option -> Expression option -> Statement -> ForStatement + [] + abstract createForIn: ForInitializer -> Expression -> Statement -> ForInStatement + [] + abstract updateForIn: ForInStatement -> ForInitializer -> Expression -> Statement -> ForInStatement + [] + abstract createForOf: AwaitKeyword option -> ForInitializer -> Expression -> Statement -> ForOfStatement + [] + abstract updateForOf: ForOfStatement -> AwaitKeyword option -> ForInitializer -> Expression -> Statement -> ForOfStatement + [] + abstract createContinue: (U2) option -> ContinueStatement + [] + abstract updateContinue: ContinueStatement -> Identifier option -> ContinueStatement + [] + abstract createBreak: (U2) option -> BreakStatement + [] + abstract updateBreak: BreakStatement -> Identifier option -> BreakStatement + [] + abstract createReturn: (Expression) option -> ReturnStatement + [] + abstract updateReturn: ReturnStatement -> Expression option -> ReturnStatement + [] + abstract createWith: Expression -> Statement -> WithStatement + [] + abstract updateWith: WithStatement -> Expression -> Statement -> WithStatement + [] + abstract createSwitch: Expression -> CaseBlock -> SwitchStatement + [] + abstract updateSwitch: SwitchStatement -> Expression -> CaseBlock -> SwitchStatement + [] + abstract createLabel: U2 -> Statement -> LabeledStatement + [] + abstract updateLabel: LabeledStatement -> Identifier -> Statement -> LabeledStatement + [] + abstract createThrow: Expression -> ThrowStatement + [] + abstract updateThrow: ThrowStatement -> Expression -> ThrowStatement + [] + abstract createTry: Block -> CatchClause option -> Block option -> TryStatement + [] + abstract updateTry: TryStatement -> Block -> CatchClause option -> Block option -> TryStatement + [] + abstract createDebuggerStatement: unit -> DebuggerStatement + [] + abstract createVariableDeclarationList: VariableDeclaration[] -> (NodeFlags) option -> VariableDeclarationList + [] + abstract updateVariableDeclarationList: VariableDeclarationList -> VariableDeclaration[] -> VariableDeclarationList + [] + abstract createFunctionDeclaration: Decorator[] option -> Modifier[] option -> AsteriskToken option -> U2 option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block option -> FunctionDeclaration + [] + abstract updateFunctionDeclaration: FunctionDeclaration -> Decorator[] option -> Modifier[] option -> AsteriskToken option -> Identifier option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block option -> FunctionDeclaration + [] + abstract createClassDeclaration: Decorator[] option -> Modifier[] option -> U2 option -> TypeParameterDeclaration[] option -> HeritageClause[] option -> ClassElement[] -> ClassDeclaration + [] + abstract updateClassDeclaration: ClassDeclaration -> Decorator[] option -> Modifier[] option -> Identifier option -> TypeParameterDeclaration[] option -> HeritageClause[] option -> ClassElement[] -> ClassDeclaration + [] + abstract createInterfaceDeclaration: Decorator[] option -> Modifier[] option -> U2 -> TypeParameterDeclaration[] option -> HeritageClause[] option -> TypeElement[] -> InterfaceDeclaration + [] + abstract updateInterfaceDeclaration: InterfaceDeclaration -> Decorator[] option -> Modifier[] option -> Identifier -> TypeParameterDeclaration[] option -> HeritageClause[] option -> TypeElement[] -> InterfaceDeclaration + [] + abstract createTypeAliasDeclaration: Decorator[] option -> Modifier[] option -> U2 -> TypeParameterDeclaration[] option -> TypeNode -> TypeAliasDeclaration + [] + abstract updateTypeAliasDeclaration: TypeAliasDeclaration -> Decorator[] option -> Modifier[] option -> Identifier -> TypeParameterDeclaration[] option -> TypeNode -> TypeAliasDeclaration + [] + abstract createEnumDeclaration: Decorator[] option -> Modifier[] option -> U2 -> EnumMember[] -> EnumDeclaration + [] + abstract updateEnumDeclaration: EnumDeclaration -> Decorator[] option -> Modifier[] option -> Identifier -> EnumMember[] -> EnumDeclaration + [] + abstract createModuleDeclaration: Decorator[] option -> Modifier[] option -> ModuleName -> ModuleBody option -> (NodeFlags) option -> ModuleDeclaration + [] + abstract updateModuleDeclaration: ModuleDeclaration -> Decorator[] option -> Modifier[] option -> ModuleName -> ModuleBody option -> ModuleDeclaration + [] + abstract createModuleBlock: Statement[] -> ModuleBlock + [] + abstract updateModuleBlock: ModuleBlock -> Statement[] -> ModuleBlock + [] + abstract createCaseBlock: CaseOrDefaultClause[] -> CaseBlock + [] + abstract updateCaseBlock: CaseBlock -> CaseOrDefaultClause[] -> CaseBlock + [] + abstract createNamespaceExportDeclaration: U2 -> NamespaceExportDeclaration + [] + abstract updateNamespaceExportDeclaration: NamespaceExportDeclaration -> Identifier -> NamespaceExportDeclaration + [] + abstract createImportEqualsDeclaration: Decorator[] option -> Modifier[] option -> bool -> U2 -> ModuleReference -> ImportEqualsDeclaration + [] + abstract updateImportEqualsDeclaration: ImportEqualsDeclaration -> Decorator[] option -> Modifier[] option -> bool -> Identifier -> ModuleReference -> ImportEqualsDeclaration + [] + abstract createImportDeclaration: Decorator[] option -> Modifier[] option -> ImportClause option -> Expression -> (AssertClause) option -> ImportDeclaration + [] + abstract updateImportDeclaration: ImportDeclaration -> Decorator[] option -> Modifier[] option -> ImportClause option -> Expression -> AssertClause option -> ImportDeclaration + [] + abstract createNamespaceImport: Identifier -> NamespaceImport + [] + abstract updateNamespaceImport: NamespaceImport -> Identifier -> NamespaceImport + [] + abstract createNamedImports: ImportSpecifier[] -> NamedImports + [] + abstract updateNamedImports: NamedImports -> ImportSpecifier[] -> NamedImports + [] + abstract createImportSpecifier: bool -> Identifier option -> Identifier -> ImportSpecifier + [] + abstract updateImportSpecifier: ImportSpecifier -> bool -> Identifier option -> Identifier -> ImportSpecifier + [] + abstract createExportAssignment: Decorator[] option -> Modifier[] option -> bool option -> Expression -> ExportAssignment + [] + abstract updateExportAssignment: ExportAssignment -> Decorator[] option -> Modifier[] option -> Expression -> ExportAssignment + [] + abstract createNamedExports: ExportSpecifier[] -> NamedExports + [] + abstract updateNamedExports: NamedExports -> ExportSpecifier[] -> NamedExports + [] + abstract createExportSpecifier: bool -> U2 option -> U2 -> ExportSpecifier + [] + abstract updateExportSpecifier: ExportSpecifier -> bool -> Identifier option -> Identifier -> ExportSpecifier + [] + abstract createExternalModuleReference: Expression -> ExternalModuleReference + [] + abstract updateExternalModuleReference: ExternalModuleReference -> Expression -> ExternalModuleReference + [] + abstract createJSDocTypeExpression: TypeNode -> JSDocTypeExpression + [] + abstract createJSDocTypeTag: Identifier option -> JSDocTypeExpression -> (U2) option -> JSDocTypeTag + [] + abstract createJSDocReturnTag: Identifier option -> (JSDocTypeExpression) option -> (U2) option -> JSDocReturnTag + [] + abstract createJSDocThisTag: Identifier option -> JSDocTypeExpression -> (U2) option -> JSDocThisTag + [] + abstract createJSDocComment: (U2) option -> (JSDocTag[]) option -> JSDoc + [] + abstract createJSDocParameterTag: Identifier option -> EntityName -> bool -> (JSDocTypeExpression) option -> (bool) option -> (U2) option -> JSDocParameterTag + [] + abstract createJSDocClassTag: Identifier option -> (U2) option -> JSDocClassTag + [] + abstract createJSDocAugmentsTag: Identifier option -> obj -> (U2) option -> JSDocAugmentsTag + [] + abstract createJSDocEnumTag: Identifier option -> JSDocTypeExpression -> (U2) option -> JSDocEnumTag + [] + abstract createJSDocTemplateTag: Identifier option -> JSDocTypeExpression option -> TypeParameterDeclaration[] -> (U2) option -> JSDocTemplateTag + [] + abstract createJSDocTypedefTag: Identifier option -> (U2) option -> (U2) option -> (U2) option -> JSDocTypedefTag + [] + abstract createJSDocCallbackTag: Identifier option -> JSDocSignature -> (U2) option -> (U2) option -> JSDocCallbackTag + [] + abstract createJSDocSignature: JSDocTemplateTag[] option -> JSDocParameterTag[] -> (JSDocReturnTag) option -> JSDocSignature + [] + abstract createJSDocPropertyTag: Identifier option -> EntityName -> bool -> (JSDocTypeExpression) option -> (bool) option -> (U2) option -> JSDocPropertyTag + [] + abstract createJSDocTypeLiteral: (JSDocPropertyLikeTag[]) option -> (bool) option -> JSDocTypeLiteral + [] + abstract createJSDocImplementsTag: Identifier option -> obj -> (U2) option -> JSDocImplementsTag + [] + abstract createJSDocAuthorTag: Identifier option -> (U2) option -> JSDocAuthorTag + [] + abstract createJSDocPublicTag: Identifier option -> (U2) option -> JSDocPublicTag + [] + abstract createJSDocPrivateTag: Identifier option -> (U2) option -> JSDocPrivateTag + [] + abstract createJSDocProtectedTag: Identifier option -> (U2) option -> JSDocProtectedTag + [] + abstract createJSDocReadonlyTag: Identifier option -> (U2) option -> JSDocReadonlyTag + [] + abstract createJSDocTag: Identifier -> (U2) option -> JSDocUnknownTag + [] + abstract createJsxElement: JsxOpeningElement -> JsxChild[] -> JsxClosingElement -> JsxElement + [] + abstract updateJsxElement: JsxElement -> JsxOpeningElement -> JsxChild[] -> JsxClosingElement -> JsxElement + [] + abstract createJsxSelfClosingElement: JsxTagNameExpression -> TypeNode[] option -> JsxAttributes -> JsxSelfClosingElement + [] + abstract updateJsxSelfClosingElement: JsxSelfClosingElement -> JsxTagNameExpression -> TypeNode[] option -> JsxAttributes -> JsxSelfClosingElement + [] + abstract createJsxOpeningElement: JsxTagNameExpression -> TypeNode[] option -> JsxAttributes -> JsxOpeningElement + [] + abstract updateJsxOpeningElement: JsxOpeningElement -> JsxTagNameExpression -> TypeNode[] option -> JsxAttributes -> JsxOpeningElement + [] + abstract createJsxClosingElement: JsxTagNameExpression -> JsxClosingElement + [] + abstract updateJsxClosingElement: JsxClosingElement -> JsxTagNameExpression -> JsxClosingElement + [] + abstract createJsxFragment: JsxOpeningFragment -> JsxChild[] -> JsxClosingFragment -> JsxFragment + [] + abstract createJsxText: string -> (bool) option -> JsxText + [] + abstract updateJsxText: JsxText -> string -> (bool) option -> JsxText + [] + abstract createJsxOpeningFragment: unit -> JsxOpeningFragment + [] + abstract createJsxJsxClosingFragment: unit -> JsxClosingFragment + [] + abstract updateJsxFragment: JsxFragment -> JsxOpeningFragment -> JsxChild[] -> JsxClosingFragment -> JsxFragment + [] + abstract createJsxAttribute: Identifier -> U2 option -> JsxAttribute + [] + abstract updateJsxAttribute: JsxAttribute -> Identifier -> U2 option -> JsxAttribute + [] + abstract createJsxAttributes: JsxAttributeLike[] -> JsxAttributes + [] + abstract updateJsxAttributes: JsxAttributes -> JsxAttributeLike[] -> JsxAttributes + [] + abstract createJsxSpreadAttribute: Expression -> JsxSpreadAttribute + [] + abstract updateJsxSpreadAttribute: JsxSpreadAttribute -> Expression -> JsxSpreadAttribute + [] + abstract createJsxExpression: DotDotDotToken option -> Expression option -> JsxExpression + [] + abstract updateJsxExpression: JsxExpression -> Expression option -> JsxExpression + [] + abstract createCaseClause: Expression -> Statement[] -> CaseClause + [] + abstract updateCaseClause: CaseClause -> Expression -> Statement[] -> CaseClause + [] + abstract createDefaultClause: Statement[] -> DefaultClause + [] + abstract updateDefaultClause: DefaultClause -> Statement[] -> DefaultClause + [] + abstract createHeritageClause: SyntaxKind -> ExpressionWithTypeArguments[] -> HeritageClause + [] + abstract updateHeritageClause: HeritageClause -> ExpressionWithTypeArguments[] -> HeritageClause + [] + abstract createCatchClause: U3 option -> Block -> CatchClause + [] + abstract updateCatchClause: CatchClause -> VariableDeclaration option -> Block -> CatchClause + [] + abstract createPropertyAssignment: U2 -> Expression -> PropertyAssignment + [] + abstract updatePropertyAssignment: PropertyAssignment -> PropertyName -> Expression -> PropertyAssignment + [] + abstract createShorthandPropertyAssignment: U2 -> (Expression) option -> ShorthandPropertyAssignment + [] + abstract updateShorthandPropertyAssignment: ShorthandPropertyAssignment -> Identifier -> Expression option -> ShorthandPropertyAssignment + [] + abstract createSpreadAssignment: Expression -> SpreadAssignment + [] + abstract updateSpreadAssignment: SpreadAssignment -> Expression -> SpreadAssignment + [] + abstract createEnumMember: U2 -> (Expression) option -> EnumMember + [] + abstract updateEnumMember: EnumMember -> PropertyName -> Expression option -> EnumMember + [] + abstract updateSourceFileNode: SourceFile -> Statement[] -> (bool) option -> (FileReference[]) option -> (FileReference[]) option -> (bool) option -> (FileReference[]) option -> SourceFile + [] + abstract createNotEmittedStatement: Node -> NotEmittedStatement + [] + abstract createPartiallyEmittedExpression: Expression -> (Node) option -> PartiallyEmittedExpression + [] + abstract updatePartiallyEmittedExpression: PartiallyEmittedExpression -> Expression -> PartiallyEmittedExpression + [] + abstract createCommaList: Expression[] -> CommaListExpression + [] + abstract updateCommaList: CommaListExpression -> Expression[] -> CommaListExpression + [] + abstract createBundle: SourceFile[] -> (U2[]) option -> Bundle + [] + abstract updateBundle: Bundle -> SourceFile[] -> (U2[]) option -> Bundle + [] + abstract createImmediatelyInvokedFunctionExpression: {| Invoke: Statement[] -> CallExpression; Invoke: Statement[] -> ParameterDeclaration -> Expression -> CallExpression |} + [] + abstract createImmediatelyInvokedArrowFunction: {| Invoke: Statement[] -> CallExpression; Invoke: Statement[] -> ParameterDeclaration -> Expression -> CallExpression |} + [] + abstract createVoidZero: unit -> VoidExpression + [] + abstract createExportDefault: Expression -> ExportAssignment + [] + abstract createExternalModuleExport: Identifier -> ExportDeclaration + [] + abstract createNamespaceExport: Identifier -> NamespaceExport + [] + abstract updateNamespaceExport: NamespaceExport -> Identifier -> NamespaceExport + [] abstract createToken: 'TKind -> Token<'TKind> - abstract createIdentifier: (string -> Identifier) - abstract createTempVariable: ((Identifier -> unit) option -> Identifier) - abstract getGeneratedNameForNode: (Node option -> Identifier) - abstract createOptimisticUniqueName: (string -> Identifier) - abstract createFileLevelUniqueName: (string -> Identifier) - abstract createIndexSignature: (ResizeArray option -> ResizeArray option -> ResizeArray -> TypeNode -> IndexSignatureDeclaration) - abstract createTypePredicateNode: (U3 -> TypeNode -> TypePredicateNode) - abstract updateTypePredicateNode: (TypePredicateNode -> U2 -> TypeNode -> TypePredicateNode) - abstract createLiteral: IExportsCreateLiteral - abstract createMethodSignature: (ResizeArray option -> ResizeArray -> TypeNode option -> U2 -> QuestionToken option -> MethodSignature) - abstract updateMethodSignature: (MethodSignature -> ResizeArray option -> ResizeArray -> TypeNode option -> PropertyName -> QuestionToken option -> MethodSignature) - abstract createTypeOperatorNode: IExportsCreateTypeOperatorNode - abstract createTaggedTemplate: IExportsCreateTaggedTemplate - abstract updateTaggedTemplate: IExportsUpdateTaggedTemplate - abstract updateBinary: (BinaryExpression -> Expression -> Expression -> U2 -> BinaryExpression) - abstract createConditional: IExportsCreateConditional - abstract createYield: IExportsCreateYield - abstract createClassExpression: (ResizeArray option -> U2 option -> ResizeArray option -> ResizeArray option -> ResizeArray -> ClassExpression) - abstract updateClassExpression: (ClassExpression -> ResizeArray option -> Identifier option -> ResizeArray option -> ResizeArray option -> ResizeArray -> ClassExpression) - abstract createPropertySignature: (ResizeArray option -> U2 -> QuestionToken option -> TypeNode option -> Expression -> PropertySignature) - abstract updatePropertySignature: (PropertySignature -> ResizeArray option -> PropertyName -> QuestionToken option -> TypeNode option -> Expression option -> PropertySignature) - abstract createExpressionWithTypeArguments: (ResizeArray option -> Expression -> ExpressionWithTypeArguments) - abstract updateExpressionWithTypeArguments: (ExpressionWithTypeArguments -> ResizeArray option -> Expression -> ExpressionWithTypeArguments) - abstract createArrowFunction: IExportsCreateArrowFunction - abstract updateArrowFunction: IExportsUpdateArrowFunction - abstract createVariableDeclaration: IExportsCreateVariableDeclaration - abstract updateVariableDeclaration: IExportsUpdateVariableDeclaration - abstract createImportClause: (Identifier option -> NamedImportBindings option -> obj -> ImportClause) - abstract updateImportClause: (ImportClause -> Identifier option -> NamedImportBindings option -> bool -> ImportClause) - abstract createExportDeclaration: (ResizeArray option -> ResizeArray option -> NamedExportBindings option -> Expression -> obj -> ExportDeclaration) - abstract updateExportDeclaration: (ExportDeclaration -> ResizeArray option -> ResizeArray option -> NamedExportBindings option -> Expression option -> bool -> ExportDeclaration) - abstract createJSDocParamTag: (EntityName -> bool -> JSDocTypeExpression -> string -> JSDocParameterTag) - abstract createComma: (Expression -> Expression -> Expression) - abstract createLessThan: (Expression -> Expression -> Expression) - abstract createAssignment: (Expression -> Expression -> BinaryExpression) - abstract createStrictEquality: (Expression -> Expression -> BinaryExpression) - abstract createStrictInequality: (Expression -> Expression -> BinaryExpression) - abstract createAdd: (Expression -> Expression -> BinaryExpression) - abstract createSubtract: (Expression -> Expression -> BinaryExpression) - abstract createLogicalAnd: (Expression -> Expression -> BinaryExpression) - abstract createLogicalOr: (Expression -> Expression -> BinaryExpression) - abstract createPostfixIncrement: (Expression -> PostfixUnaryExpression) - abstract createLogicalNot: (Expression -> PrefixUnaryExpression) - abstract createNode: (SyntaxKind -> obj -> obj -> Node) + [] + abstract createIdentifier: string -> Identifier + [] + abstract createTempVariable: (Identifier -> unit) option -> Identifier + [] + abstract getGeneratedNameForNode: Node option -> Identifier + [] + abstract createOptimisticUniqueName: string -> Identifier + [] + abstract createFileLevelUniqueName: string -> Identifier + [] + abstract createIndexSignature: Decorator[] option -> Modifier[] option -> ParameterDeclaration[] -> TypeNode -> IndexSignatureDeclaration + [] + abstract createTypePredicateNode: U3 -> TypeNode -> TypePredicateNode + [] + abstract updateTypePredicateNode: TypePredicateNode -> U2 -> TypeNode -> TypePredicateNode + [] + abstract createLiteral: {| Invoke: U5 -> StringLiteral; Invoke: U2 -> NumericLiteral; Invoke: bool -> BooleanLiteral; Invoke: U4 -> PrimaryExpression |} + [] + abstract createMethodSignature: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> U2 -> QuestionToken option -> MethodSignature + [] + abstract updateMethodSignature: MethodSignature -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> PropertyName -> QuestionToken option -> MethodSignature + [] + abstract createTypeOperatorNode: {| Invoke: TypeNode -> TypeOperatorNode; Invoke: SyntaxKind -> TypeNode -> TypeOperatorNode |} + [] + abstract createTaggedTemplate: {| Invoke: Expression -> TemplateLiteral -> TaggedTemplateExpression; Invoke: Expression -> TypeNode[] option -> TemplateLiteral -> TaggedTemplateExpression |} + [] + abstract updateTaggedTemplate: {| Invoke: TaggedTemplateExpression -> Expression -> TemplateLiteral -> TaggedTemplateExpression; Invoke: TaggedTemplateExpression -> Expression -> TypeNode[] option -> TemplateLiteral -> TaggedTemplateExpression |} + [] + abstract updateBinary: BinaryExpression -> Expression -> Expression -> (U2) option -> BinaryExpression + [] + abstract createConditional: {| Invoke: Expression -> Expression -> Expression -> ConditionalExpression; Invoke: Expression -> QuestionToken -> Expression -> ColonToken -> Expression -> ConditionalExpression |} + [] + abstract createYield: {| Invoke: Expression option -> YieldExpression; Invoke: AsteriskToken option -> Expression -> YieldExpression |} + [] + abstract createClassExpression: Modifier[] option -> U2 option -> TypeParameterDeclaration[] option -> HeritageClause[] option -> ClassElement[] -> ClassExpression + [] + abstract updateClassExpression: ClassExpression -> Modifier[] option -> Identifier option -> TypeParameterDeclaration[] option -> HeritageClause[] option -> ClassElement[] -> ClassExpression + [] + abstract createPropertySignature: Modifier[] option -> U2 -> QuestionToken option -> TypeNode option -> (Expression) option -> PropertySignature + [] + abstract updatePropertySignature: PropertySignature -> Modifier[] option -> PropertyName -> QuestionToken option -> TypeNode option -> Expression option -> PropertySignature + [] + abstract createExpressionWithTypeArguments: TypeNode[] option -> Expression -> ExpressionWithTypeArguments + [] + abstract updateExpressionWithTypeArguments: ExpressionWithTypeArguments -> TypeNode[] option -> Expression -> ExpressionWithTypeArguments + [] + abstract createArrowFunction: {| Invoke: Modifier[] option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> EqualsGreaterThanToken option -> ConciseBody -> ArrowFunction; Invoke: Modifier[] option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> ConciseBody -> ArrowFunction |} + [] + abstract updateArrowFunction: {| Invoke: ArrowFunction -> Modifier[] option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> EqualsGreaterThanToken -> ConciseBody -> ArrowFunction; Invoke: ArrowFunction -> Modifier[] option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> ConciseBody -> ArrowFunction |} + [] + abstract createVariableDeclaration: {| Invoke: U2 -> TypeNode option -> Expression option -> VariableDeclaration; Invoke: U2 -> ExclamationToken option -> TypeNode option -> Expression option -> VariableDeclaration |} + [] + abstract updateVariableDeclaration: {| Invoke: VariableDeclaration -> BindingName -> TypeNode option -> Expression option -> VariableDeclaration; Invoke: VariableDeclaration -> BindingName -> ExclamationToken option -> TypeNode option -> Expression option -> VariableDeclaration |} + [] + abstract createImportClause: Identifier option -> NamedImportBindings option -> (obj) option -> ImportClause + [] + abstract updateImportClause: ImportClause -> Identifier option -> NamedImportBindings option -> bool -> ImportClause + [] + abstract createExportDeclaration: Decorator[] option -> Modifier[] option -> NamedExportBindings option -> (Expression) option -> (obj) option -> ExportDeclaration + [] + abstract updateExportDeclaration: ExportDeclaration -> Decorator[] option -> Modifier[] option -> NamedExportBindings option -> Expression option -> bool -> ExportDeclaration + [] + abstract createJSDocParamTag: EntityName -> bool -> (JSDocTypeExpression) option -> (string) option -> JSDocParameterTag + [] + abstract createComma: Expression -> Expression -> Expression + [] + abstract createLessThan: Expression -> Expression -> Expression + [] + abstract createAssignment: Expression -> Expression -> BinaryExpression + [] + abstract createStrictEquality: Expression -> Expression -> BinaryExpression + [] + abstract createStrictInequality: Expression -> Expression -> BinaryExpression + [] + abstract createAdd: Expression -> Expression -> BinaryExpression + [] + abstract createSubtract: Expression -> Expression -> BinaryExpression + [] + abstract createLogicalAnd: Expression -> Expression -> BinaryExpression + [] + abstract createLogicalOr: Expression -> Expression -> BinaryExpression + [] + abstract createPostfixIncrement: Expression -> PostfixUnaryExpression + [] + abstract createLogicalNot: Expression -> PrefixUnaryExpression + [] + abstract createNode: SyntaxKind -> (obj) option -> (obj) option -> Node + /// + /// Creates a shallow, memberwise clone of a node ~for mutation~ with its pos, end, and parent set. + /// + /// NOTE: It is unsafe to change any properties of a Node that relate to its AST children, as those changes won't be + /// captured with respect to transformations. + /// + [] abstract getMutableClone: 'T -> 'T - abstract isTypeAssertion: (Node -> bool) - abstract isIdentifierOrPrivateIdentifier: (Node -> bool) - - type [] ValidateLocaleAndSetLanguageSys = - abstract getExecutingFilePath: unit -> string - abstract resolvePath: path: string -> string - abstract fileExists: fileName: string -> bool - abstract readFile: fileName: string -> string option - - type [] [] CreateUnparsedSourceFileType = - | Js - | Dts - - type [] ReadConfigFileReturn = - abstract config: obj option with get, set - abstract error: Diagnostic option with get, set - - type [] ParseConfigFileTextToJsonReturn = - abstract config: obj option with get, set - abstract error: Diagnostic option with get, set - - type [] ConvertCompilerOptionsFromJsonReturn = - abstract options: CompilerOptions with get, set - abstract errors: ResizeArray with get, set - - type [] ConvertTypeAcquisitionFromJsonReturn = - abstract options: TypeAcquisition with get, set - abstract errors: ResizeArray with get, set + [] + abstract isTypeAssertion: Node -> bool + [] + abstract isIdentifierOrPrivateIdentifier: Node -> bool + /// /// Type of objects whose values are all of the same type. - /// The `in` and `for-in` operators can *not* be safely used, - /// since `Object.prototype` may be modified by outside code. + /// The in and for-in operators can *not* be safely used, + /// since Object.prototype may be modified by outside code. + /// type [] MapLike<'T> = - [] abstract Item: index: string -> 'T with get, set + [] abstract Item: index: string -> 'T with get, set type [] SortedReadonlyArray<'T> = inherit ReadonlyArray<'T> @@ -1114,11 +1514,11 @@ module Ts = /// ES6 Iterator type. type [] Iterator<'T> = - abstract next: unit -> U2, IteratorNext2> + abstract next: unit -> U2<{| value: 'T; ``done``: bool option |}, {| value: unit; ``done``: bool |}> /// Array that is only intended to be pushed to, never read. type [] Push<'T> = - abstract push: [] values: ResizeArray<'T> -> unit + abstract push: [] values: 'T[] -> unit type [] Path = interface end @@ -1193,7 +1593,9 @@ module Ts = | ColonToken = 58 | AtToken = 59 | QuestionQuestionToken = 60 + /// Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. | BacktickToken = 61 + /// Only the JSDoc scanner produces HashToken. The normal scanner produces PrivateIdentifier. | HashToken = 62 | EqualsToken = 63 | PlusEqualsToken = 64 @@ -1604,7 +2006,9 @@ module Ts = type [] JsxFlags = | None = 0 + /// An element from a named property of the JSX.IntrinsicElements interface | IntrinsicNamedElement = 1 + /// An element inferred from the string index signature of the JSX.IntrinsicElements interface | IntrinsicIndexedElement = 2 | IntrinsicElement = 3 @@ -1612,13 +2016,13 @@ module Ts = inherit ReadonlyTextRange abstract kind: SyntaxKind abstract flags: NodeFlags - abstract decorators: ResizeArray option + abstract decorators: Decorator[] option abstract modifiers: ModifiersArray option abstract parent: Node abstract getSourceFile: unit -> SourceFile abstract getChildCount: ?sourceFile: SourceFile -> float abstract getChildAt: index: float * ?sourceFile: SourceFile -> Node - abstract getChildren: ?sourceFile: SourceFile -> ResizeArray + abstract getChildren: ?sourceFile: SourceFile -> Node[] abstract getStart: ?sourceFile: SourceFile * ?includeJsDocComment: bool -> float abstract getFullStart: unit -> float abstract getEnd: unit -> float @@ -1629,7 +2033,7 @@ module Ts = abstract getText: ?sourceFile: SourceFile -> string abstract getFirstToken: ?sourceFile: SourceFile -> Node option abstract getLastToken: ?sourceFile: SourceFile -> Node option - abstract forEachChild: cbNode: (Node -> 'T option) * ?cbNodeArray: (ResizeArray -> 'T option) -> 'T option + abstract forEachChild: cbNode: (Node -> 'T option) * ?cbNodeArray: (Node[] -> 'T option) -> 'T option type [] JSDocContainer = interface end @@ -1637,17 +2041,66 @@ module Ts = type HasJSDoc = obj - type HasType = - obj - - type HasTypeArguments = - U5 - - type HasInitializer = - U5 - - type HasExpressionInitializer = - U7 + type [] [] HasType = + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertySignature of PropertySignature + | [] PropertyDeclaration of PropertyDeclaration + | [] MethodSignature of MethodSignature + | [] MethodDeclaration of MethodDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] TypePredicateNode of TypePredicateNode + | [] FunctionTypeNode of FunctionTypeNode + | [] ConstructorTypeNode of ConstructorTypeNode + | [] ParenthesizedTypeNode of ParenthesizedTypeNode + | [] TypeOperatorNode of TypeOperatorNode + | [] MappedTypeNode of MappedTypeNode + | [] TypeAssertion of TypeAssertion + | [] FunctionExpression of FunctionExpression + | [] ArrowFunction of ArrowFunction + | [] AsExpression of AsExpression + | [] VariableDeclaration of VariableDeclaration + | [] FunctionDeclaration of FunctionDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + | [] JSDocTypeExpression of JSDocTypeExpression + | [] JSDocNullableType of JSDocNullableType + | [] JSDocNonNullableType of JSDocNonNullableType + | [] JSDocOptionalType of JSDocOptionalType + | [] JSDocFunctionType of JSDocFunctionType + | [] JSDocVariadicType of JSDocVariadicType + + type [] [] HasTypeArguments = + | [] CallExpression of CallExpression + | [] NewExpression of NewExpression + | [] TaggedTemplateExpression of TaggedTemplateExpression + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] JsxOpeningElement of JsxOpeningElement + + type [] [] HasInitializer = + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertySignature of PropertySignature + | [] PropertyDeclaration of PropertyDeclaration + | [] BindingElement of BindingElement + | [] ForStatement of ForStatement + | [] ForInStatement of ForInStatement + | [] ForOfStatement of ForOfStatement + | [] VariableDeclaration of VariableDeclaration + | [] JsxAttribute of JsxAttribute + | [] PropertyAssignment of PropertyAssignment + | [] EnumMember of EnumMember + + type [] [] HasExpressionInitializer = + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertySignature of PropertySignature + | [] PropertyDeclaration of PropertyDeclaration + | [] BindingElement of BindingElement + | [] VariableDeclaration of VariableDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] EnumMember of EnumMember type [] NodeArray<'T> = inherit ReadonlyArray<'T> @@ -1709,9 +2162,11 @@ module Ts = type AwaitKeyword = KeywordToken + [] type AwaitKeywordToken = AwaitKeyword + [] type AssertsToken = AssertsKeyword @@ -1754,23 +2209,46 @@ module Ts = type StaticKeyword = ModifierToken + [] type ReadonlyToken = ReadonlyKeyword - type Modifier = - Token - - type AccessibilityModifier = - U3 - - type ParameterPropertyModifier = - U2 - - type ClassMemberModifier = - U3 + type [] [] Modifier = + | [] ConstKeyword of ConstKeyword + | [] DefaultKeyword of DefaultKeyword + | [] ExportKeyword of ExportKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] StaticKeyword of StaticKeyword + | [] AbstractKeyword of AbstractKeyword + | [] AsyncKeyword of AsyncKeyword + | [] DeclareKeyword of DeclareKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + | [] OverrideKeyword of OverrideKeyword + with + [] member this.kind : SyntaxKind = jsNative + + type [] [] AccessibilityModifier = + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + + type [] [] ParameterPropertyModifier = + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + + type [] [] ClassMemberModifier = + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] StaticKeyword of StaticKeyword + | [] ReadonlyKeyword of ReadonlyKeyword type ModifiersArray = - ResizeArray + Modifier[] type [] GeneratedIdentifierFlags = | None = 0 @@ -1783,8 +2261,10 @@ module Ts = inherit PrimaryExpression inherit Declaration abstract kind: SyntaxKind - /// Prefer to use `id.unescapedText`. (Note: This is available only in services, not internally to the TypeScript compiler.) + /// + /// Prefer to use id.unescapedText. (Note: This is available only in services, not internally to the TypeScript compiler.) /// Text of identifier, but if the identifier begins with two underscores, this will begin with three. + /// abstract escapedText: __String abstract originalKeywordKind: SyntaxKind option abstract isInJSDocNamespace: bool option with get, set @@ -1800,17 +2280,32 @@ module Ts = abstract left: EntityName abstract right: Identifier - type EntityName = - U2 - - type PropertyName = - U5 - - type MemberName = - U2 - - type DeclarationName = - U8 + type [] [] EntityName = + | [] Identifier of Identifier + | [] QualifiedName of QualifiedName + + type [] [] PropertyName = + | [] NumericLiteral of NumericLiteral + | [] StringLiteral of StringLiteral + | [] Identifier of Identifier + | [] PrivateIdentifier of PrivateIdentifier + | [] ComputedPropertyName of ComputedPropertyName + + type [] [] MemberName = + | [] Identifier of Identifier + | [] PrivateIdentifier of PrivateIdentifier + + type [] [] DeclarationName = + | [] NumericLiteral of NumericLiteral + | [] StringLiteral of StringLiteral + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] Identifier of Identifier + | [] PrivateIdentifier of PrivateIdentifier + | [] ComputedPropertyName of ComputedPropertyName + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ArrayBindingPattern of ArrayBindingPattern + | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression + | [] ElementAccessExpression of ElementAccessExpression type [] Declaration = inherit Node @@ -1848,7 +2343,7 @@ module Ts = abstract kind: SyntaxKind abstract parent: U2 abstract name: Identifier - /// Note: Consider calling `getEffectiveConstraintOfTypeParameter` + /// Note: Consider calling getEffectiveConstraintOfTypeParameter abstract ``constraint``: TypeNode option abstract ``default``: TypeNode option abstract expression: Expression option with get, set @@ -1856,14 +2351,27 @@ module Ts = type [] SignatureDeclarationBase = inherit NamedDeclaration inherit JSDocContainer - abstract kind: SignatureDeclaration + abstract kind: obj abstract name: PropertyName option - abstract typeParameters: ResizeArray option - abstract parameters: ResizeArray + abstract typeParameters: TypeParameterDeclaration[] option + abstract parameters: ParameterDeclaration[] abstract ``type``: TypeNode option - type SignatureDeclaration = - obj + type [] [] SignatureDeclaration = + | [] MethodSignature of MethodSignature + | [] MethodDeclaration of MethodDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] FunctionTypeNode of FunctionTypeNode + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionExpression of FunctionExpression + | [] ArrowFunction of ArrowFunction + | [] FunctionDeclaration of FunctionDeclaration + | [] JSDocFunctionType of JSDocFunctionType type [] CallSignatureDeclaration = inherit SignatureDeclarationBase @@ -1875,8 +2383,10 @@ module Ts = inherit TypeElement abstract kind: SyntaxKind - type BindingName = - U2 + type [] [] BindingName = + | [] Identifier of Identifier + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ArrayBindingPattern of ArrayBindingPattern type [] VariableDeclaration = inherit NamedDeclaration @@ -1892,7 +2402,7 @@ module Ts = inherit Node abstract kind: SyntaxKind abstract parent: U4 - abstract declarations: ResizeArray + abstract declarations: VariableDeclaration[] type [] ParameterDeclaration = inherit NamedDeclaration @@ -1939,8 +2449,14 @@ module Ts = abstract _objectLiteralBrand: obj option with get, set abstract name: PropertyName option - type ObjectLiteralElementLike = - U5 + /// Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. + type [] [] ObjectLiteralElementLike = + | [] MethodDeclaration of MethodDeclaration + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] SpreadAssignment of SpreadAssignment type [] PropertyAssignment = inherit ObjectLiteralElement @@ -1970,8 +2486,18 @@ module Ts = abstract parent: ObjectLiteralExpression abstract expression: Expression - type VariableLikeDeclaration = - obj + type [] [] VariableLikeDeclaration = + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertySignature of PropertySignature + | [] PropertyDeclaration of PropertyDeclaration + | [] BindingElement of BindingElement + | [] VariableDeclaration of VariableDeclaration + | [] JsxAttribute of JsxAttribute + | [] PropertyAssignment of PropertyAssignment + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] EnumMember of EnumMember + | [] JSDocParameterTag of JSDocParameterTag + | [] JSDocPropertyTag of JSDocPropertyTag type [] PropertyLikeDeclaration = inherit NamedDeclaration @@ -1981,19 +2507,21 @@ module Ts = inherit Node abstract kind: SyntaxKind abstract parent: U3 - abstract elements: ResizeArray + abstract elements: BindingElement[] type [] ArrayBindingPattern = inherit Node abstract kind: SyntaxKind abstract parent: U3 - abstract elements: ResizeArray + abstract elements: ArrayBindingElement[] - type BindingPattern = - U2 + type [] [] BindingPattern = + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ArrayBindingPattern of ArrayBindingPattern - type ArrayBindingElement = - U2 + type [] [] ArrayBindingElement = + | [] BindingElement of BindingElement + | [] OmittedExpression of OmittedExpression /// Several node kinds share function-like features such as a signature, /// a name, and a body. These nodes should extend FunctionLikeDeclarationBase. @@ -2009,9 +2537,16 @@ module Ts = abstract exclamationToken: ExclamationToken option abstract body: U2 option - type FunctionLikeDeclaration = - U7 + type [] [] FunctionLikeDeclaration = + | [] MethodDeclaration of MethodDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] FunctionExpression of FunctionExpression + | [] ArrowFunction of ArrowFunction + | [] FunctionDeclaration of FunctionDeclaration + [] type FunctionLike = SignatureDeclaration @@ -2075,8 +2610,9 @@ module Ts = abstract name: PropertyName abstract body: FunctionBody option - type AccessorDeclaration = - U2 + type [] [] AccessorDeclaration = + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration type [] IndexSignatureDeclaration = inherit SignatureDeclarationBase @@ -2098,7 +2634,7 @@ module Ts = abstract _typeNodeBrand: obj option with get, set type KeywordTypeNode = - KeywordTypeNode + KeywordTypeNode type [] KeywordTypeNode<'TKind> = inherit KeywordToken<'TKind> @@ -2116,8 +2652,9 @@ module Ts = inherit TypeNode abstract kind: SyntaxKind - type FunctionOrConstructorTypeNode = - U2 + type [] [] FunctionOrConstructorTypeNode = + | [] FunctionTypeNode of FunctionTypeNode + | [] ConstructorTypeNode of ConstructorTypeNode type [] FunctionOrConstructorTypeNodeBase = inherit TypeNode @@ -2135,10 +2672,11 @@ module Ts = type [] NodeWithTypeArguments = inherit TypeNode - abstract typeArguments: ResizeArray option + abstract typeArguments: TypeNode[] option - type TypeReferenceType = - U2 + type [] [] TypeReferenceType = + | [] TypeReferenceNode of TypeReferenceNode + | [] ExpressionWithTypeArguments of ExpressionWithTypeArguments type [] TypeReferenceNode = inherit NodeWithTypeArguments @@ -2149,7 +2687,7 @@ module Ts = inherit TypeNode abstract kind: SyntaxKind abstract parent: U2 - abstract assertsModifier: AssertsToken option + abstract assertsModifier: AssertsKeyword option abstract parameterName: U2 abstract ``type``: TypeNode option @@ -2162,7 +2700,7 @@ module Ts = inherit TypeNode inherit Declaration abstract kind: SyntaxKind - abstract members: ResizeArray + abstract members: TypeElement[] type [] ArrayTypeNode = inherit TypeNode @@ -2172,7 +2710,7 @@ module Ts = type [] TupleTypeNode = inherit TypeNode abstract kind: SyntaxKind - abstract elements: ResizeArray> + abstract elements: U2[] type [] NamedTupleMember = inherit TypeNode @@ -2194,18 +2732,19 @@ module Ts = abstract kind: SyntaxKind abstract ``type``: TypeNode - type UnionOrIntersectionTypeNode = - U2 + type [] [] UnionOrIntersectionTypeNode = + | [] UnionTypeNode of UnionTypeNode + | [] IntersectionTypeNode of IntersectionTypeNode type [] UnionTypeNode = inherit TypeNode abstract kind: SyntaxKind - abstract types: ResizeArray + abstract types: TypeNode[] type [] IntersectionTypeNode = inherit TypeNode abstract kind: SyntaxKind - abstract types: ResizeArray + abstract types: TypeNode[] type [] ConditionalTypeNode = inherit TypeNode @@ -2241,13 +2780,13 @@ module Ts = inherit TypeNode inherit Declaration abstract kind: SyntaxKind - abstract readonlyToken: U3 option + abstract readonlyToken: U3 option abstract typeParameter: TypeParameterDeclaration abstract nameType: TypeNode option abstract questionToken: U3 option abstract ``type``: TypeNode option /// Used only to produce grammar errors - abstract members: ResizeArray option + abstract members: TypeElement[] option type [] LiteralTypeNode = inherit TypeNode @@ -2259,17 +2798,21 @@ module Ts = inherit Declaration abstract kind: SyntaxKind - type StringLiteralLike = - U2 + type [] [] StringLiteralLike = + | [] StringLiteral of StringLiteral + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - type PropertyNameLiteral = - U3 + type [] [] PropertyNameLiteral = + | [] NumericLiteral of NumericLiteral + | [] StringLiteral of StringLiteral + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] Identifier of Identifier type [] TemplateLiteralTypeNode = inherit TypeNode abstract kind: SyntaxKind with get, set abstract head: TemplateHead - abstract templateSpans: ResizeArray + abstract templateSpans: TemplateLiteralTypeSpan[] type [] TemplateLiteralTypeSpan = inherit TypeNode @@ -2295,6 +2838,7 @@ module Ts = inherit Expression abstract _unaryExpressionBrand: obj option with get, set + /// Deprecated, please use UpdateExpression type IncrementExpression = UpdateExpression @@ -2344,8 +2888,9 @@ module Ts = inherit PrimaryExpression abstract kind: SyntaxKind - type BooleanLiteral = - U2 + type [] [] BooleanLiteral = + | [] FalseLiteral of FalseLiteral + | [] TrueLiteral of TrueLiteral type [] ThisExpression = inherit PrimaryExpression @@ -2482,32 +3027,71 @@ module Ts = type DestructuringAssignment = U2 - type BindingOrAssignmentElement = - U4 - - type ObjectBindingOrAssignmentElement = - U4 - - type ArrayBindingOrAssignmentElement = - obj - - type BindingOrAssignmentElementRestIndicator = - U3 - - type BindingOrAssignmentElementTarget = - U5 - - type ObjectBindingOrAssignmentPattern = - U2 - - type ArrayBindingOrAssignmentPattern = - U2 - - type AssignmentPattern = - U2 - - type BindingOrAssignmentPattern = - U2 + type [] [] BindingOrAssignmentElement = + | [] Identifier of Identifier + | [] ParameterDeclaration of ParameterDeclaration + | [] BindingElement of BindingElement + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] PropertyAccessExpression of PropertyAccessExpression + | [] ElementAccessExpression of ElementAccessExpression + | [] AssignmentExpression of AssignmentExpression + | [] SpreadElement of SpreadElement + | [] OmittedExpression of OmittedExpression + | [] VariableDeclaration of VariableDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] SpreadAssignment of SpreadAssignment + + type [] [] ObjectBindingOrAssignmentElement = + | [] BindingElement of BindingElement + | [] PropertyAssignment of PropertyAssignment + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] SpreadAssignment of SpreadAssignment + + type [] [] ArrayBindingOrAssignmentElement = + | [] Identifier of Identifier + | [] BindingElement of BindingElement + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] PropertyAccessExpression of PropertyAccessExpression + | [] ElementAccessExpression of ElementAccessExpression + | [] AssignmentExpression of AssignmentExpression + | [] SpreadElement of SpreadElement + | [] OmittedExpression of OmittedExpression + + type [] [] BindingOrAssignmentElementRestIndicator = + | [] DotDotDotToken of DotDotDotToken + | [] SpreadElement of SpreadElement + | [] SpreadAssignment of SpreadAssignment + + type [] [] BindingOrAssignmentElementTarget = + | [] Identifier of Identifier + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] PropertyAccessExpression of PropertyAccessExpression + | [] ElementAccessExpression of ElementAccessExpression + | [] OmittedExpression of OmittedExpression + + type [] [] ObjectBindingOrAssignmentPattern = + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ObjectLiteralExpression of ObjectLiteralExpression + + type [] [] ArrayBindingOrAssignmentPattern = + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + + type [] [] AssignmentPattern = + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectLiteralExpression of ObjectLiteralExpression + + type [] [] BindingOrAssignmentPattern = + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectLiteralExpression of ObjectLiteralExpression type [] ConditionalExpression = inherit Expression @@ -2583,8 +3167,13 @@ module Ts = inherit LiteralExpression abstract kind: SyntaxKind - type LiteralToken = - U6 + type [] [] LiteralToken = + | [] NumericLiteral of NumericLiteral + | [] BigIntLiteral of BigIntLiteral + | [] StringLiteral of StringLiteral + | [] JsxText of JsxText + | [] RegularExpressionLiteral of RegularExpressionLiteral + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral type [] TemplateHead = inherit TemplateLiteralLikeNode @@ -2601,20 +3190,26 @@ module Ts = abstract kind: SyntaxKind abstract parent: U2 - type PseudoLiteralToken = - U3 + type [] [] PseudoLiteralToken = + | [] TemplateHead of TemplateHead + | [] TemplateMiddle of TemplateMiddle + | [] TemplateTail of TemplateTail - type TemplateLiteralToken = - U2 + type [] [] TemplateLiteralToken = + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] TemplateHead of TemplateHead + | [] TemplateMiddle of TemplateMiddle + | [] TemplateTail of TemplateTail type [] TemplateExpression = inherit PrimaryExpression abstract kind: SyntaxKind abstract head: TemplateHead - abstract templateSpans: ResizeArray + abstract templateSpans: TemplateSpan[] - type TemplateLiteral = - U2 + type [] [] TemplateLiteral = + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] TemplateExpression of TemplateExpression type [] TemplateSpan = inherit Node @@ -2632,7 +3227,7 @@ module Ts = type [] ArrayLiteralExpression = inherit PrimaryExpression abstract kind: SyntaxKind - abstract elements: ResizeArray + abstract elements: Expression[] type [] SpreadElement = inherit Expression @@ -2647,20 +3242,24 @@ module Ts = type [] ObjectLiteralExpressionBase<'T> = inherit PrimaryExpression inherit Declaration - abstract properties: ResizeArray<'T> + abstract properties: 'T[] type [] ObjectLiteralExpression = inherit ObjectLiteralExpressionBase abstract kind: SyntaxKind - type EntityNameExpression = - U2 + type [] [] EntityNameExpression = + | [] Identifier of Identifier + | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression - type EntityNameOrEntityNameExpression = - U2 + type [] [] EntityNameOrEntityNameExpression = + | [] Identifier of Identifier + | [] QualifiedName of QualifiedName + | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression - type AccessExpression = - U2 + type [] [] AccessExpression = + | [] PropertyAccessExpression of PropertyAccessExpression + | [] ElementAccessExpression of ElementAccessExpression type [] PropertyAccessExpression = inherit MemberExpression @@ -2701,8 +3300,9 @@ module Ts = inherit ElementAccessExpression abstract expression: SuperExpression - type SuperProperty = - U2 + type [] [] SuperProperty = + | [] SuperPropertyAccessExpression of SuperPropertyAccessExpression + | [] SuperElementAccessExpression of SuperElementAccessExpression type [] CallExpression = inherit LeftHandSideExpression @@ -2710,15 +3310,18 @@ module Ts = abstract kind: SyntaxKind abstract expression: LeftHandSideExpression abstract questionDotToken: QuestionDotToken option - abstract typeArguments: ResizeArray option - abstract arguments: ResizeArray + abstract typeArguments: TypeNode[] option + abstract arguments: Expression[] type [] CallChain = inherit CallExpression abstract _optionalChainBrand: obj option with get, set - type OptionalChain = - U4 + type [] [] OptionalChain = + | [] PropertyAccessChain of PropertyAccessChain + | [] ElementAccessChain of ElementAccessChain + | [] CallChain of CallChain + | [] NonNullChain of NonNullChain type [] SuperCall = inherit CallExpression @@ -2739,18 +3342,23 @@ module Ts = inherit Declaration abstract kind: SyntaxKind abstract expression: LeftHandSideExpression - abstract typeArguments: ResizeArray option - abstract arguments: ResizeArray option + abstract typeArguments: TypeNode[] option + abstract arguments: Expression[] option type [] TaggedTemplateExpression = inherit MemberExpression abstract kind: SyntaxKind abstract tag: LeftHandSideExpression - abstract typeArguments: ResizeArray option + abstract typeArguments: TypeNode[] option abstract template: TemplateLiteral - type CallLikeExpression = - U5 + type [] [] CallLikeExpression = + | [] Decorator of Decorator + | [] CallExpression of CallExpression + | [] NewExpression of NewExpression + | [] TaggedTemplateExpression of TaggedTemplateExpression + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] JsxOpeningElement of JsxOpeningElement type [] AsExpression = inherit Expression @@ -2764,8 +3372,9 @@ module Ts = abstract ``type``: TypeNode abstract expression: UnaryExpression - type AssertionExpression = - U2 + type [] [] AssertionExpression = + | [] TypeAssertion of TypeAssertion + | [] AsExpression of AsExpression type [] NonNullExpression = inherit LeftHandSideExpression @@ -2786,17 +3395,21 @@ module Ts = inherit PrimaryExpression abstract kind: SyntaxKind abstract openingElement: JsxOpeningElement - abstract children: ResizeArray + abstract children: JsxChild[] abstract closingElement: JsxClosingElement - type JsxOpeningLikeElement = - U2 + type [] [] JsxOpeningLikeElement = + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] JsxOpeningElement of JsxOpeningElement - type JsxAttributeLike = - U2 + type [] [] JsxAttributeLike = + | [] JsxAttribute of JsxAttribute + | [] JsxSpreadAttribute of JsxSpreadAttribute - type JsxTagNameExpression = - U3 + type [] [] JsxTagNameExpression = + | [] Identifier of Identifier + | [] ThisExpression of ThisExpression + | [] JsxTagNamePropertyAccess of JsxTagNamePropertyAccess type [] JsxTagNamePropertyAccess = inherit PropertyAccessExpression @@ -2812,21 +3425,21 @@ module Ts = abstract kind: SyntaxKind abstract parent: JsxElement abstract tagName: JsxTagNameExpression - abstract typeArguments: ResizeArray option + abstract typeArguments: TypeNode[] option abstract attributes: JsxAttributes type [] JsxSelfClosingElement = inherit PrimaryExpression abstract kind: SyntaxKind abstract tagName: JsxTagNameExpression - abstract typeArguments: ResizeArray option + abstract typeArguments: TypeNode[] option abstract attributes: JsxAttributes type [] JsxFragment = inherit PrimaryExpression abstract kind: SyntaxKind abstract openingFragment: JsxOpeningFragment - abstract children: ResizeArray + abstract children: JsxChild[] abstract closingFragment: JsxClosingFragment type [] JsxOpeningFragment = @@ -2871,8 +3484,12 @@ module Ts = abstract parent: U2 abstract containsOnlyTriviaWhiteSpaces: bool - type JsxChild = - U5 + type [] [] JsxChild = + | [] JsxText of JsxText + | [] JsxElement of JsxElement + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] JsxFragment of JsxFragment + | [] JsxExpression of JsxExpression type [] Statement = inherit Node @@ -2887,7 +3504,7 @@ module Ts = type [] CommaListExpression = inherit Expression abstract kind: SyntaxKind - abstract elements: ResizeArray + abstract elements: Expression[] type [] EmptyStatement = inherit Statement @@ -2902,13 +3519,17 @@ module Ts = abstract kind: SyntaxKind abstract name: Identifier option - type BlockLike = - U4 + type [] [] BlockLike = + | [] Block of Block + | [] ModuleBlock of ModuleBlock + | [] CaseClause of CaseClause + | [] DefaultClause of DefaultClause + | [] SourceFile of SourceFile type [] Block = inherit Statement abstract kind: SyntaxKind - abstract statements: ResizeArray + abstract statements: Statement[] type [] VariableStatement = inherit Statement @@ -2951,8 +3572,9 @@ module Ts = abstract condition: Expression option abstract incrementor: Expression option - type ForInOrOfStatement = - U2 + type [] [] ForInOrOfStatement = + | [] ForInStatement of ForInStatement + | [] ForOfStatement of ForOfStatement type [] ForInStatement = inherit IterationStatement @@ -2963,7 +3585,7 @@ module Ts = type [] ForOfStatement = inherit IterationStatement abstract kind: SyntaxKind - abstract awaitModifier: AwaitKeywordToken option + abstract awaitModifier: AwaitKeyword option abstract initializer: ForInitializer abstract expression: Expression @@ -2977,8 +3599,9 @@ module Ts = abstract kind: SyntaxKind abstract label: Identifier option - type BreakOrContinueStatement = - U2 + type [] [] BreakOrContinueStatement = + | [] ContinueStatement of ContinueStatement + | [] BreakStatement of BreakStatement type [] ReturnStatement = inherit Statement @@ -3002,23 +3625,24 @@ module Ts = inherit Node abstract kind: SyntaxKind abstract parent: SwitchStatement - abstract clauses: ResizeArray + abstract clauses: CaseOrDefaultClause[] type [] CaseClause = inherit Node abstract kind: SyntaxKind abstract parent: CaseBlock abstract expression: Expression - abstract statements: ResizeArray + abstract statements: Statement[] type [] DefaultClause = inherit Node abstract kind: SyntaxKind abstract parent: CaseBlock - abstract statements: ResizeArray + abstract statements: Statement[] - type CaseOrDefaultClause = - U2 + type [] [] CaseOrDefaultClause = + | [] CaseClause of CaseClause + | [] DefaultClause of DefaultClause type [] LabeledStatement = inherit Statement @@ -3045,29 +3669,71 @@ module Ts = abstract variableDeclaration: VariableDeclaration option abstract block: Block - type ObjectTypeDeclaration = - U3 - - type DeclarationWithTypeParameters = - U4 - - type DeclarationWithTypeParameterChildren = - U5 + type [] [] ObjectTypeDeclaration = + | [] TypeLiteralNode of TypeLiteralNode + | [] ClassExpression of ClassExpression + | [] ClassDeclaration of ClassDeclaration + | [] InterfaceDeclaration of InterfaceDeclaration + + type [] [] DeclarationWithTypeParameters = + | [] MethodSignature of MethodSignature + | [] MethodDeclaration of MethodDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] FunctionTypeNode of FunctionTypeNode + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionExpression of FunctionExpression + | [] ArrowFunction of ArrowFunction + | [] ClassExpression of ClassExpression + | [] FunctionDeclaration of FunctionDeclaration + | [] ClassDeclaration of ClassDeclaration + | [] InterfaceDeclaration of InterfaceDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + | [] JSDocFunctionType of JSDocFunctionType + | [] JSDocSignature of JSDocSignature + | [] JSDocCallbackTag of JSDocCallbackTag + | [] JSDocTemplateTag of JSDocTemplateTag + | [] JSDocTypedefTag of JSDocTypedefTag + + type [] [] DeclarationWithTypeParameterChildren = + | [] MethodSignature of MethodSignature + | [] MethodDeclaration of MethodDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] FunctionTypeNode of FunctionTypeNode + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionExpression of FunctionExpression + | [] ArrowFunction of ArrowFunction + | [] ClassExpression of ClassExpression + | [] FunctionDeclaration of FunctionDeclaration + | [] ClassDeclaration of ClassDeclaration + | [] InterfaceDeclaration of InterfaceDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + | [] JSDocFunctionType of JSDocFunctionType + | [] JSDocTemplateTag of JSDocTemplateTag type [] ClassLikeDeclarationBase = inherit NamedDeclaration inherit JSDocContainer abstract kind: SyntaxKind abstract name: Identifier option - abstract typeParameters: ResizeArray option - abstract heritageClauses: ResizeArray option - abstract members: ResizeArray + abstract typeParameters: TypeParameterDeclaration[] option + abstract heritageClauses: HeritageClause[] option + abstract members: ClassElement[] type [] ClassDeclaration = inherit ClassLikeDeclarationBase inherit DeclarationStatement abstract kind: SyntaxKind - /// May be undefined in `export default class { ... }`. + /// May be undefined in export default class { ... }. abstract name: Identifier option type [] ClassExpression = @@ -3075,8 +3741,9 @@ module Ts = inherit PrimaryExpression abstract kind: SyntaxKind - type ClassLikeDeclaration = - U2 + type [] [] ClassLikeDeclaration = + | [] ClassExpression of ClassExpression + | [] ClassDeclaration of ClassDeclaration type [] ClassElement = inherit NamedDeclaration @@ -3094,23 +3761,23 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract name: Identifier - abstract typeParameters: ResizeArray option - abstract heritageClauses: ResizeArray option - abstract members: ResizeArray + abstract typeParameters: TypeParameterDeclaration[] option + abstract heritageClauses: HeritageClause[] option + abstract members: TypeElement[] type [] HeritageClause = inherit Node abstract kind: SyntaxKind abstract parent: U2 abstract token: SyntaxKind - abstract types: ResizeArray + abstract types: ExpressionWithTypeArguments[] type [] TypeAliasDeclaration = inherit DeclarationStatement inherit JSDocContainer abstract kind: SyntaxKind abstract name: Identifier - abstract typeParameters: ResizeArray option + abstract typeParameters: TypeParameterDeclaration[] option abstract ``type``: TypeNode type [] EnumMember = @@ -3126,13 +3793,16 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract name: Identifier - abstract members: ResizeArray + abstract members: EnumMember[] - type ModuleName = - U2 + type [] [] ModuleName = + | [] StringLiteral of StringLiteral + | [] Identifier of Identifier - type ModuleBody = - U2 + type [] [] ModuleBody = + | [] Identifier of Identifier + | [] Empty of U2 + | [] ModuleBlock of ModuleBlock type [] ModuleDeclaration = inherit DeclarationStatement @@ -3142,16 +3812,18 @@ module Ts = abstract name: ModuleName abstract body: U2 option - type NamespaceBody = - U2 + type [] [] NamespaceBody = + | [] NamespaceDeclaration of NamespaceDeclaration + | [] ModuleBlock of ModuleBlock type [] NamespaceDeclaration = inherit ModuleDeclaration abstract name: Identifier abstract body: NamespaceBody - type JSDocNamespaceBody = - U2 + type [] [] JSDocNamespaceBody = + | [] Identifier of Identifier + | [] JSDocNamespaceDeclaration of JSDocNamespaceDeclaration type [] JSDocNamespaceDeclaration = inherit ModuleDeclaration @@ -3163,10 +3835,12 @@ module Ts = inherit Statement abstract kind: SyntaxKind abstract parent: ModuleDeclaration - abstract statements: ResizeArray + abstract statements: Statement[] - type ModuleReference = - U2 + type [] [] ModuleReference = + | [] Identifier of Identifier + | [] QualifiedName of QualifiedName + | [] ExternalModuleReference of ExternalModuleReference /// One of: /// - import x = require("mod"); @@ -3195,11 +3869,13 @@ module Ts = abstract moduleSpecifier: Expression abstract assertClause: AssertClause option - type NamedImportBindings = - U2 + type [] [] NamedImportBindings = + | [] NamespaceImport of NamespaceImport + | [] NamedImports of NamedImports - type NamedExportBindings = - U2 + type [] [] NamedExportBindings = + | [] NamedExports of NamedExports + | [] NamespaceExport of NamespaceExport type [] ImportClause = inherit NamedDeclaration @@ -3209,21 +3885,22 @@ module Ts = abstract name: Identifier option abstract namedBindings: NamedImportBindings option - type AssertionKey = - U2 + type [] [] AssertionKey = + | [] StringLiteral of StringLiteral + | [] Identifier of Identifier type [] AssertEntry = inherit Node abstract kind: SyntaxKind abstract parent: AssertClause abstract name: AssertionKey - abstract value: StringLiteral + abstract value: Expression type [] AssertClause = inherit Node abstract kind: SyntaxKind abstract parent: U2 - abstract elements: ResizeArray + abstract elements: AssertEntry[] abstract multiLine: bool option type [] NamespaceImport = @@ -3250,7 +3927,7 @@ module Ts = abstract kind: SyntaxKind abstract parent: U2 abstract isTypeOnly: bool - /// Will not be assigned in the case of `export * from "foo";` + /// Will not be assigned in the case of export * from "foo"; abstract exportClause: NamedExportBindings option /// If this is not a StringLiteral it will be a grammar error. abstract moduleSpecifier: Expression option @@ -3260,16 +3937,17 @@ module Ts = inherit Node abstract kind: SyntaxKind abstract parent: ImportClause - abstract elements: ResizeArray + abstract elements: ImportSpecifier[] type [] NamedExports = inherit Node abstract kind: SyntaxKind abstract parent: ExportDeclaration - abstract elements: ResizeArray + abstract elements: ExportSpecifier[] - type NamedImportsOrExports = - U2 + type [] [] NamedImportsOrExports = + | [] NamedImports of NamedImports + | [] NamedExports of NamedExports type [] ImportSpecifier = inherit NamedDeclaration @@ -3281,23 +3959,31 @@ module Ts = type [] ExportSpecifier = inherit NamedDeclaration + inherit JSDocContainer abstract kind: SyntaxKind abstract parent: NamedExports abstract isTypeOnly: bool abstract propertyName: Identifier option abstract name: Identifier - type ImportOrExportSpecifier = - U2 + type [] [] ImportOrExportSpecifier = + | [] ImportSpecifier of ImportSpecifier + | [] ExportSpecifier of ExportSpecifier - type TypeOnlyCompatibleAliasDeclaration = - U4 + type [] [] TypeOnlyCompatibleAliasDeclaration = + | [] ImportEqualsDeclaration of ImportEqualsDeclaration + | [] ImportClause of ImportClause + | [] NamespaceImport of NamespaceImport + | [] ImportSpecifier of ImportSpecifier + | [] ExportSpecifier of ExportSpecifier type TypeOnlyAliasDeclaration = obj - /// This is either an `export =` or an `export default` declaration. - /// Unless `isExportEquals` is set, this node was parsed as an `export default`. + /// + /// This is either an export = or an export default declaration. + /// Unless isExportEquals is set, this node was parsed as an export default. + /// type [] ExportAssignment = inherit DeclarationStatement inherit JSDocContainer @@ -3325,8 +4011,8 @@ module Ts = type [] SynthesizedComment = inherit CommentRange abstract text: string with get, set - abstract pos: obj with get, set - abstract ``end``: obj with get, set + abstract pos: int with get, set + abstract ``end``: int with get, set abstract hasLeadingNewline: bool option with get, set type [] JSDocTypeExpression = @@ -3388,21 +4074,24 @@ module Ts = abstract kind: SyntaxKind abstract ``type``: TypeNode - type JSDocTypeReferencingNode = - U4 + type [] [] JSDocTypeReferencingNode = + | [] JSDocNullableType of JSDocNullableType + | [] JSDocNonNullableType of JSDocNonNullableType + | [] JSDocOptionalType of JSDocOptionalType + | [] JSDocVariadicType of JSDocVariadicType type [] JSDoc = inherit Node abstract kind: SyntaxKind abstract parent: HasJSDoc - abstract tags: ResizeArray option - abstract comment: U2> option + abstract tags: JSDocTag[] option + abstract comment: U2 option type [] JSDocTag = inherit Node abstract parent: U2 abstract tagName: Identifier - abstract comment: U2> option + abstract comment: U2 option type [] JSDocLink = inherit Node @@ -3422,8 +4111,11 @@ module Ts = abstract name: U2 option abstract text: string with get, set - type JSDocComment = - U4 + type [] [] JSDocComment = + | [] JSDocText of JSDocText + | [] JSDocLink of JSDocLink + | [] JSDocLinkCode of JSDocLinkCode + | [] JSDocLinkPlain of JSDocLinkPlain type [] JSDocText = inherit Node @@ -3434,8 +4126,10 @@ module Ts = inherit JSDocTag abstract kind: SyntaxKind - /// Note that `@extends` is a synonym of `@augments`. + /// + /// Note that @extends is a synonym of @augments. /// Both tags are represented by this interface. + /// type [] JSDocAugmentsTag = inherit JSDocTag abstract kind: SyntaxKind @@ -3494,7 +4188,7 @@ module Ts = inherit JSDocTag abstract kind: SyntaxKind abstract ``constraint``: JSDocTypeExpression option - abstract typeParameters: ResizeArray + abstract typeParameters: TypeParameterDeclaration[] type [] JSDocSeeTag = inherit JSDocTag @@ -3533,8 +4227,8 @@ module Ts = inherit JSDocType inherit Declaration abstract kind: SyntaxKind - abstract typeParameters: ResizeArray option - abstract parameters: ResizeArray + abstract typeParameters: JSDocTemplateTag[] option + abstract parameters: JSDocParameterTag[] abstract ``type``: JSDocReturnTag option type [] JSDocPropertyLikeTag = @@ -3558,7 +4252,7 @@ module Ts = type [] JSDocTypeLiteral = inherit JSDocType abstract kind: SyntaxKind - abstract jsDocPropertyTags: ResizeArray option + abstract jsDocPropertyTags: JSDocPropertyLikeTag[] option /// If true, then this type literal represents an *array* of its type. abstract isArrayType: bool @@ -3592,7 +4286,7 @@ module Ts = type [] FlowLabel = inherit FlowNodeBase - abstract antecedents: ResizeArray option with get, set + abstract antecedents: FlowNode[] option with get, set type [] FlowAssignment = inherit FlowNodeBase @@ -3624,7 +4318,7 @@ module Ts = type [] FlowReduceLabel = inherit FlowNodeBase abstract target: FlowLabel with get, set - abstract antecedents: ResizeArray with get, set + abstract antecedents: FlowNode[] with get, set abstract antecedent: FlowNode with get, set type FlowType = @@ -3641,15 +4335,15 @@ module Ts = type [] SourceFile = inherit Declaration abstract kind: SyntaxKind - abstract statements: ResizeArray + abstract statements: Statement[] abstract endOfFileToken: Token abstract fileName: string with get, set abstract text: string with get, set - abstract amdDependencies: ResizeArray with get, set + abstract amdDependencies: AmdDependency[] with get, set abstract moduleName: string option with get, set - abstract referencedFiles: ResizeArray with get, set - abstract typeReferenceDirectives: ResizeArray with get, set - abstract libReferenceDirectives: ResizeArray with get, set + abstract referencedFiles: FileReference[] with get, set + abstract typeReferenceDirectives: FileReference[] with get, set + abstract libReferenceDirectives: FileReference[] with get, set abstract languageVariant: LanguageVariant with get, set abstract isDeclarationFile: bool with get, set /// lib.d.ts should have a reference comment like @@ -3660,27 +4354,29 @@ module Ts = /// because this containing file is intended to act as a default library. abstract hasNoDefaultLib: bool with get, set abstract languageVersion: ScriptTarget with get, set - /// When `module` is `Node12` or `NodeNext`, this field controls whether the + /// + /// When module is Node12 or NodeNext, this field controls whether the /// source file in question is an ESNext-output-format file, or a CommonJS-output-format /// module. This is derived by the module resolver as it looks up the file, since /// it is derived from either the file extension of the module, or the containing - /// `package.json` context, and affects both checking and emit. + /// package.json context, and affects both checking and emit. /// /// It is _public_ so that (pre)transformers can set this field, - /// since it switches the builtin `node` module transform. Generally speaking, if unset, - /// the field is treated as though it is `ModuleKind.CommonJS`. + /// since it switches the builtin node module transform. Generally speaking, if unset, + /// the field is treated as though it is ModuleKind.CommonJS. + /// abstract impliedNodeFormat: ModuleKind option with get, set abstract getLineAndCharacterOfPosition: pos: float -> LineAndCharacter abstract getLineEndOfPosition: pos: float -> float - abstract getLineStarts: unit -> ResizeArray + abstract getLineStarts: unit -> float[] abstract getPositionOfLineAndCharacter: line: float * character: float -> float abstract update: newText: string * textChangeRange: TextChangeRange -> SourceFile type [] Bundle = inherit Node abstract kind: SyntaxKind - abstract prepends: ResizeArray> - abstract sourceFiles: ResizeArray + abstract prepends: U2[] + abstract sourceFiles: SourceFile[] type [] InputFiles = inherit Node @@ -3699,22 +4395,28 @@ module Ts = abstract kind: SyntaxKind abstract fileName: string with get, set abstract text: string with get, set - abstract prologues: ResizeArray - abstract helpers: ResizeArray option with get, set - abstract referencedFiles: ResizeArray with get, set - abstract typeReferenceDirectives: ResizeArray option with get, set - abstract libReferenceDirectives: ResizeArray with get, set + abstract prologues: UnparsedPrologue[] + abstract helpers: UnscopedEmitHelper[] option with get, set + abstract referencedFiles: FileReference[] with get, set + abstract typeReferenceDirectives: string[] option with get, set + abstract libReferenceDirectives: FileReference[] with get, set abstract hasNoDefaultLib: bool option with get, set abstract sourceMapPath: string option with get, set abstract sourceMapText: string option with get, set - abstract syntheticReferences: ResizeArray option - abstract texts: ResizeArray + abstract syntheticReferences: UnparsedSyntheticReference[] option + abstract texts: UnparsedSourceText[] - type UnparsedSourceText = - U2 + type [] [] UnparsedSourceText = + | [] UnparsedPrepend of UnparsedPrepend + | [] UnparsedTextLike of UnparsedTextLike + | [] UnparsedTextLike' of UnparsedTextLike - type UnparsedNode = - U3 + type [] [] UnparsedNode = + | [] UnparsedPrologue of UnparsedPrologue + | [] UnparsedPrepend of UnparsedPrepend + | [] UnparsedTextLike of UnparsedTextLike + | [] UnparsedTextLike' of UnparsedTextLike + | [] UnparsedSyntheticReference of UnparsedSyntheticReference type [] UnparsedSection = inherit Node @@ -3733,7 +4435,7 @@ module Ts = abstract kind: SyntaxKind abstract parent: UnparsedSource abstract data: string - abstract texts: ResizeArray + abstract texts: UnparsedTextLike[] type [] UnparsedTextLike = inherit UnparsedSection @@ -3747,11 +4449,11 @@ module Ts = type [] JsonSourceFile = inherit SourceFile - abstract statements: ResizeArray + abstract statements: JsonObjectExpressionStatement[] type [] TsConfigSourceFile = inherit JsonSourceFile - abstract extendedSourceFiles: ResizeArray option with get, set + abstract extendedSourceFiles: string[] option with get, set type [] JsonMinusNumericLiteral = inherit PrefixUnaryExpression @@ -3759,8 +4461,15 @@ module Ts = abstract operator: SyntaxKind abstract operand: NumericLiteral - type JsonObjectExpression = - U7 + type [] [] JsonObjectExpression = + | [] NumericLiteral of NumericLiteral + | [] StringLiteral of StringLiteral + | [] FalseLiteral of FalseLiteral + | [] NullLiteral of NullLiteral + | [] TrueLiteral of TrueLiteral + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] JsonMinusNumericLiteral of JsonMinusNumericLiteral type [] JsonObjectExpressionStatement = inherit ExpressionStatement @@ -3774,36 +4483,40 @@ module Ts = type [] ParseConfigHost = abstract useCaseSensitiveFileNames: bool with get, set - abstract readDirectory: rootDir: string * extensions: ResizeArray * excludes: ResizeArray option * includes: ResizeArray * ?depth: float -> ResizeArray + abstract readDirectory: rootDir: string * extensions: string[] * excludes: string[] option * includes: string[] * ?depth: float -> string[] /// Gets a value indicating whether the specified path exists and is a file. /// The path to test. abstract fileExists: path: string -> bool abstract readFile: path: string -> string option abstract trace: s: string -> unit + /// Branded string for keeping track of when we've turned an ambiguous path + /// specified like "./blah" to an absolute path to an actual + /// tsconfig file, e.g. "/root/blah/tsconfig.json" type [] ResolvedConfigFileName = interface end type [] WriteFileCallback = - [] abstract Invoke: fileName: string * data: string * writeByteOrderMark: bool * ?onError: (string -> unit) * ?sourceFiles: ResizeArray -> unit + [] abstract Invoke: fileName: string * data: string * writeByteOrderMark: bool * ?onError: (string -> unit) * ?sourceFiles: SourceFile[] -> unit type [] OperationCanceledException = interface end type [] OperationCanceledExceptionStatic = - [] abstract Create: unit -> OperationCanceledException + [] abstract Create: unit -> OperationCanceledException type [] CancellationToken = abstract isCancellationRequested: unit -> bool + /// OperationCanceledException if isCancellationRequested is true abstract throwIfCancellationRequested: unit -> unit type [] Program = inherit ScriptReferenceHost abstract getCurrentDirectory: unit -> string /// Get a list of root file names that were passed to a 'createProgram' - abstract getRootFileNames: unit -> ResizeArray + abstract getRootFileNames: unit -> string[] /// Get a list of files in the program - abstract getSourceFiles: unit -> ResizeArray + abstract getSourceFiles: unit -> SourceFile[] /// Emits the JavaScript and declaration files. If targetSourceFile is not specified, then /// the JavaScript and declaration files will be produced for all the files in this program. /// If targetSourceFile is specified, then only the JavaScript and declaration for that @@ -3813,13 +4526,13 @@ module Ts = /// used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter /// will be invoked when writing the JavaScript and declaration files. abstract emit: ?targetSourceFile: SourceFile * ?writeFile: WriteFileCallback * ?cancellationToken: CancellationToken * ?emitOnlyDtsFiles: bool * ?customTransformers: CustomTransformers -> EmitResult - abstract getOptionsDiagnostics: ?cancellationToken: CancellationToken -> ResizeArray - abstract getGlobalDiagnostics: ?cancellationToken: CancellationToken -> ResizeArray - abstract getSyntacticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> ResizeArray + abstract getOptionsDiagnostics: ?cancellationToken: CancellationToken -> Diagnostic[] + abstract getGlobalDiagnostics: ?cancellationToken: CancellationToken -> Diagnostic[] + abstract getSyntacticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> DiagnosticWithLocation[] /// The first time this is called, it will return global diagnostics (no location). - abstract getSemanticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> ResizeArray - abstract getDeclarationDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> ResizeArray - abstract getConfigFileParsingDiagnostics: unit -> ResizeArray + abstract getSemanticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> Diagnostic[] + abstract getDeclarationDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> DiagnosticWithLocation[] + abstract getConfigFileParsingDiagnostics: unit -> Diagnostic[] /// Gets a type checker that can be used to semantically analyze source files in the program. abstract getTypeChecker: unit -> TypeChecker abstract getNodeCount: unit -> float @@ -3827,22 +4540,16 @@ module Ts = abstract getSymbolCount: unit -> float abstract getTypeCount: unit -> float abstract getInstantiationCount: unit -> float - abstract getRelationCacheSizes: unit -> ProgramGetRelationCacheSizesReturn + abstract getRelationCacheSizes: unit -> {| assignable: float; identity: float; subtype: float; strictSubtype: float |} abstract isSourceFileFromExternalLibrary: file: SourceFile -> bool abstract isSourceFileDefaultLibrary: file: SourceFile -> bool - abstract getProjectReferences: unit -> ResizeArray option - abstract getResolvedProjectReferences: unit -> ResizeArray option - - type [] ProgramGetRelationCacheSizesReturn = - abstract assignable: float with get, set - abstract identity: float with get, set - abstract subtype: float with get, set - abstract strictSubtype: float with get, set + abstract getProjectReferences: unit -> ProjectReference[] option + abstract getResolvedProjectReferences: unit -> ResolvedProjectReference option[] option type [] ResolvedProjectReference = abstract commandLine: ParsedCommandLine with get, set abstract sourceFile: SourceFile with get, set - abstract references: ResizeArray option with get, set + abstract references: ResolvedProjectReference option[] option with get, set type [] CustomTransformerFactory = [] abstract Invoke: context: TransformationContext -> CustomTransformer @@ -3853,11 +4560,11 @@ module Ts = type [] CustomTransformers = /// Custom transformers to evaluate before built-in .js transformations. - abstract before: ResizeArray, CustomTransformerFactory>> option with get, set + abstract before: U2, CustomTransformerFactory>[] option with get, set /// Custom transformers to evaluate after built-in .js transformations. - abstract after: ResizeArray, CustomTransformerFactory>> option with get, set + abstract after: U2, CustomTransformerFactory>[] option with get, set /// Custom transformers to evaluate after built-in .d.ts transformations. - abstract afterDeclarations: ResizeArray>, CustomTransformerFactory>> option with get, set + abstract afterDeclarations: U2>, CustomTransformerFactory>[] option with get, set type [] SourceMapSpan = /// Line number in the .js file. @@ -3873,37 +4580,39 @@ module Ts = /// .ts file (index into sources array) associated with this span abstract sourceIndex: float with get, set + /// Return code used by getEmitOutput function to indicate status of the function type [] ExitStatus = | Success = 0 | DiagnosticsPresent_OutputsSkipped = 1 | DiagnosticsPresent_OutputsGenerated = 2 | InvalidProject_OutputsSkipped = 3 | ProjectReferenceCycle_OutputsSkipped = 4 + /// Use ProjectReferenceCycle_OutputsSkipped instead. | ProjectReferenceCycle_OutputsSkupped = 4 type [] EmitResult = abstract emitSkipped: bool with get, set /// Contains declaration emit diagnostics - abstract diagnostics: ResizeArray with get, set - abstract emittedFiles: ResizeArray option with get, set + abstract diagnostics: Diagnostic[] with get, set + abstract emittedFiles: string[] option with get, set type [] TypeChecker = abstract getTypeOfSymbolAtLocation: symbol: Symbol * node: Node -> Type abstract getDeclaredTypeOfSymbol: symbol: Symbol -> Type - abstract getPropertiesOfType: ``type``: Type -> ResizeArray + abstract getPropertiesOfType: ``type``: Type -> Symbol[] abstract getPropertyOfType: ``type``: Type * propertyName: string -> Symbol option abstract getPrivateIdentifierPropertyOfType: leftType: Type * name: string * location: Node -> Symbol option abstract getIndexInfoOfType: ``type``: Type * kind: IndexKind -> IndexInfo option - abstract getIndexInfosOfType: ``type``: Type -> ResizeArray - abstract getSignaturesOfType: ``type``: Type * kind: SignatureKind -> ResizeArray + abstract getIndexInfosOfType: ``type``: Type -> IndexInfo[] + abstract getSignaturesOfType: ``type``: Type * kind: SignatureKind -> Signature[] abstract getIndexTypeOfType: ``type``: Type * kind: IndexKind -> Type option - abstract getBaseTypes: ``type``: InterfaceType -> ResizeArray + abstract getBaseTypes: ``type``: InterfaceType -> BaseType[] abstract getBaseTypeOfLiteralType: ``type``: Type -> Type abstract getWidenedType: ``type``: Type -> Type abstract getReturnTypeOfSignature: signature: Signature -> Type abstract getNullableType: ``type``: Type * flags: TypeFlags -> Type abstract getNonNullableType: ``type``: Type -> Type - abstract getTypeArguments: ``type``: TypeReference -> ResizeArray + abstract getTypeArguments: ``type``: TypeReference -> Type[] /// Note that the resulting nodes cannot be checked. abstract typeToTypeNode: ``type``: Type * enclosingDeclaration: Node option * flags: NodeBuilderFlags option -> TypeNode option /// Note that the resulting nodes cannot be checked. @@ -3915,24 +4624,26 @@ module Ts = /// Note that the resulting nodes cannot be checked. abstract symbolToExpression: symbol: Symbol * meaning: SymbolFlags * enclosingDeclaration: Node option * flags: NodeBuilderFlags option -> Expression option /// Note that the resulting nodes cannot be checked. - abstract symbolToTypeParameterDeclarations: symbol: Symbol * enclosingDeclaration: Node option * flags: NodeBuilderFlags option -> ResizeArray option + abstract symbolToTypeParameterDeclarations: symbol: Symbol * enclosingDeclaration: Node option * flags: NodeBuilderFlags option -> TypeParameterDeclaration[] option /// Note that the resulting nodes cannot be checked. abstract symbolToParameterDeclaration: symbol: Symbol * enclosingDeclaration: Node option * flags: NodeBuilderFlags option -> ParameterDeclaration option /// Note that the resulting nodes cannot be checked. abstract typeParameterToDeclaration: parameter: TypeParameter * enclosingDeclaration: Node option * flags: NodeBuilderFlags option -> TypeParameterDeclaration option - abstract getSymbolsInScope: location: Node * meaning: SymbolFlags -> ResizeArray + abstract getSymbolsInScope: location: Node * meaning: SymbolFlags -> Symbol[] abstract getSymbolAtLocation: node: Node -> Symbol option - abstract getSymbolsOfParameterPropertyDeclaration: parameter: ParameterDeclaration * parameterName: string -> ResizeArray + abstract getSymbolsOfParameterPropertyDeclaration: parameter: ParameterDeclaration * parameterName: string -> Symbol[] /// The function returns the value (local variable) symbol of an identifier in the short-hand property assignment. /// This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value. abstract getShorthandAssignmentValueSymbol: location: Node option -> Symbol option abstract getExportSpecifierLocalTargetSymbol: location: U2 -> Symbol option + /// /// If a symbol is a local symbol with an associated exported symbol, returns the exported symbol. /// Otherwise returns its input. - /// For example, at `export type T = number;`: - /// - `getSymbolAtLocation` at the location `T` will return the exported symbol for `T`. - /// - But the result of `getSymbolsInScope` will contain the *local* symbol for `T`, not the exported symbol. - /// - Calling `getExportSymbolOfSymbol` on that local symbol will return the exported symbol. + /// For example, at export type T = number;: + /// - getSymbolAtLocation at the location T will return the exported symbol for T. + /// - But the result of getSymbolsInScope will contain the *local* symbol for T, not the exported symbol. + /// - Calling getExportSymbolOfSymbol on that local symbol will return the exported symbol. + /// abstract getExportSymbolOfSymbol: symbol: Symbol -> Symbol abstract getPropertySymbolOfDestructuringAssignment: location: Identifier -> Symbol option abstract getTypeOfAssignmentPattern: pattern: AssignmentPattern -> Type @@ -3943,14 +4654,16 @@ module Ts = abstract symbolToString: symbol: Symbol * ?enclosingDeclaration: Node * ?meaning: SymbolFlags * ?flags: SymbolFormatFlags -> string abstract typePredicateToString: predicate: TypePredicate * ?enclosingDeclaration: Node * ?flags: TypeFormatFlags -> string abstract getFullyQualifiedName: symbol: Symbol -> string - abstract getAugmentedPropertiesOfType: ``type``: Type -> ResizeArray - abstract getRootSymbols: symbol: Symbol -> ResizeArray + abstract getAugmentedPropertiesOfType: ``type``: Type -> Symbol[] + abstract getRootSymbols: symbol: Symbol -> Symbol[] abstract getSymbolOfExpando: node: Node * allowDeclaration: bool -> Symbol option abstract getContextualType: node: Expression -> Type option - /// returns unknownSignature in the case of an error. - /// returns undefined if the node is not valid. - /// Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`. - abstract getResolvedSignature: node: CallLikeExpression * ?candidatesOutArray: ResizeArray * ?argumentCount: float -> Signature option + /// + /// returns unknownSignature in the case of an error. + /// returns undefined if the node is not valid. + /// + /// Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See signatureHelp.ts. + abstract getResolvedSignature: node: CallLikeExpression * ?candidatesOutArray: Signature[] * ?argumentCount: float -> Signature option abstract getSignatureFromDeclaration: declaration: SignatureDeclaration -> Signature option abstract isImplementationOfOverload: node: SignatureDeclaration -> bool option abstract isUndefinedSymbol: symbol: Symbol -> bool @@ -3962,10 +4675,10 @@ module Ts = abstract getAliasedSymbol: symbol: Symbol -> Symbol /// Follow a *single* alias to get the immediately aliased symbol. abstract getImmediateAliasedSymbol: symbol: Symbol -> Symbol option - abstract getExportsOfModule: moduleSymbol: Symbol -> ResizeArray - abstract getJsxIntrinsicTagNamesAt: location: Node -> ResizeArray + abstract getExportsOfModule: moduleSymbol: Symbol -> Symbol[] + abstract getJsxIntrinsicTagNamesAt: location: Node -> Symbol[] abstract isOptionalParameter: node: ParameterDeclaration -> bool - abstract getAmbientModules: unit -> ResizeArray + abstract getAmbientModules: unit -> Symbol[] abstract tryGetMemberInModuleExports: memberName: string * moduleSymbol: Symbol -> Symbol option abstract getApparentType: ``type``: Type -> Type abstract getBaseConstraintOfType: ``type``: Type -> Type option @@ -3998,6 +4711,7 @@ module Ts = | NoUndefinedOptionalParameterType = 1073741824 | AllowThisInObjectLiteral = 32768 | AllowQualifiedNameInPlaceOfIdentifier = 65536 + /// AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. | AllowQualifedNameInPlaceOfIdentifier = 65536 | AllowAnonymousIdentifier = 131072 | AllowEmptyUnionOrIntersection = 262144 @@ -4032,6 +4746,7 @@ module Ts = | InElementType = 2097152 | InFirstTypeArgument = 4194304 | InTypeAlias = 8388608 + /// | WriteOwnNameForAnyLike = 0 | NodeBuilderFlagsMask = 814775659 @@ -4080,8 +4795,11 @@ module Ts = abstract parameterIndex: float with get, set abstract ``type``: Type option with get, set - type TypePredicate = - U4 + type [] [] TypePredicate = + | [] ThisTypePredicate of ThisTypePredicate + | [] IdentifierTypePredicate of IdentifierTypePredicate + | [] AssertsThisTypePredicate of AssertsThisTypePredicate + | [] AssertsIdentifierTypePredicate of AssertsIdentifierTypePredicate type [] SymbolFlags = | None = 0 @@ -4147,7 +4865,7 @@ module Ts = type [] Symbol = abstract flags: SymbolFlags with get, set abstract escapedName: __String with get, set - abstract declarations: ResizeArray option with get, set + abstract declarations: Declaration[] option with get, set abstract valueDeclaration: Declaration option with get, set abstract members: SymbolTable option with get, set abstract exports: SymbolTable option with get, set @@ -4156,9 +4874,9 @@ module Ts = abstract getFlags: unit -> SymbolFlags abstract getEscapedName: unit -> __String abstract getName: unit -> string - abstract getDeclarations: unit -> ResizeArray option - abstract getDocumentationComment: typeChecker: TypeChecker option -> ResizeArray - abstract getJsDocTags: ?checker: TypeChecker -> ResizeArray + abstract getDeclarations: unit -> Declaration[] option + abstract getDocumentationComment: typeChecker: TypeChecker option -> SymbolDisplayPart[] + abstract getJsDocTags: ?checker: TypeChecker -> JSDocTagInfo[] type [] [] InternalSymbolName = | [] Call @@ -4179,18 +4897,25 @@ module Ts = | Default | This + /// This represents a string whose leading underscore have been escaped by adding extra leading underscores. + /// The shape of this brand is rather unique compared to others we've used. + /// Instead of just an intersection of a string and an object, it is that union-ed + /// with an intersection of void and an object. This makes it wholly incompatible + /// with a normal string (which is good, it cannot be misused on assignment or on usage), + /// while still being comparable with a normal string via === (also good) and castable from a string. type __String = U2 - /// ReadonlyMap where keys are `__String`s. + /// ReadonlyMap where keys are __Strings. type [] ReadonlyUnderscoreEscapedMap<'T> = inherit ReadonlyESMap<__String, 'T> - /// Map where keys are `__String`s. + /// Map where keys are __Strings. type [] UnderscoreEscapedMap<'T> = inherit ESMap<__String, 'T> inherit ReadonlyUnderscoreEscapedMap<'T> + /// SymbolTable based on ES6 Map interface. type SymbolTable = UnderscoreEscapedMap @@ -4244,25 +4969,28 @@ module Ts = | StructuredOrInstantiable = 469499904 | Narrowable = 536624127 - type DestructuringPattern = - U3 + type [] [] DestructuringPattern = + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectLiteralExpression of ObjectLiteralExpression type [] Type = abstract flags: TypeFlags with get, set abstract symbol: Symbol with get, set abstract pattern: DestructuringPattern option with get, set abstract aliasSymbol: Symbol option with get, set - abstract aliasTypeArguments: ResizeArray option with get, set + abstract aliasTypeArguments: Type[] option with get, set abstract getFlags: unit -> TypeFlags abstract getSymbol: unit -> Symbol option - abstract getProperties: unit -> ResizeArray + abstract getProperties: unit -> Symbol[] abstract getProperty: propertyName: string -> Symbol option - abstract getApparentProperties: unit -> ResizeArray - abstract getCallSignatures: unit -> ResizeArray - abstract getConstructSignatures: unit -> ResizeArray + abstract getApparentProperties: unit -> Symbol[] + abstract getCallSignatures: unit -> Signature[] + abstract getConstructSignatures: unit -> Signature[] abstract getStringIndexType: unit -> Type option abstract getNumberIndexType: unit -> Type option - abstract getBaseTypes: unit -> ResizeArray option + abstract getBaseTypes: unit -> BaseType[] option abstract getNonNullableType: unit -> Type abstract getConstraint: unit -> Type option abstract getDefault: unit -> Type option @@ -4275,6 +5003,7 @@ module Ts = abstract isTypeParameter: unit -> bool abstract isClassOrInterface: unit -> bool abstract isClass: unit -> bool + abstract isIndexType: unit -> bool type [] LiteralType = inherit Type @@ -4330,9 +5059,9 @@ module Ts = /// Class and interface types (ObjectFlags.Class and ObjectFlags.Interface). type [] InterfaceType = inherit ObjectType - abstract typeParameters: ResizeArray option with get, set - abstract outerTypeParameters: ResizeArray option with get, set - abstract localTypeParameters: ResizeArray option with get, set + abstract typeParameters: TypeParameter[] option with get, set + abstract outerTypeParameters: TypeParameter[] option with get, set + abstract localTypeParameters: TypeParameter[] option with get, set abstract thisType: TypeParameter option with get, set type BaseType = @@ -4340,10 +5069,10 @@ module Ts = type [] InterfaceTypeWithDeclaredMembers = inherit InterfaceType - abstract declaredProperties: ResizeArray with get, set - abstract declaredCallSignatures: ResizeArray with get, set - abstract declaredConstructSignatures: ResizeArray with get, set - abstract declaredIndexInfos: ResizeArray with get, set + abstract declaredProperties: Symbol[] with get, set + abstract declaredCallSignatures: Signature[] with get, set + abstract declaredConstructSignatures: Signature[] with get, set + abstract declaredIndexInfos: IndexInfo[] with get, set /// Type references (ObjectFlags.Reference). When a class or interface has type parameters or /// a "this" type, references to the class or interface are made using type references. The @@ -4357,7 +5086,7 @@ module Ts = inherit ObjectType abstract target: GenericType with get, set abstract node: U3 option with get, set - abstract typeArguments: ResizeArray option with get, set + abstract typeArguments: Type[] option with get, set type [] DeferredTypeReference = inherit TypeReference @@ -4378,13 +5107,13 @@ module Ts = type [] TupleType = inherit GenericType - abstract elementFlags: ResizeArray with get, set + abstract elementFlags: ElementFlags[] with get, set abstract minLength: float with get, set abstract fixedLength: float with get, set abstract hasRestElement: bool with get, set abstract combinedFlags: ElementFlags with get, set abstract readonly: bool with get, set - abstract labeledElementDeclarations: ResizeArray> option with get, set + abstract labeledElementDeclarations: U2[] option with get, set type [] TupleTypeReference = inherit TypeReference @@ -4392,7 +5121,7 @@ module Ts = type [] UnionOrIntersectionType = inherit Type - abstract types: ResizeArray with get, set + abstract types: Type[] with get, set type [] UnionType = inherit UnionOrIntersectionType @@ -4434,11 +5163,11 @@ module Ts = abstract checkType: Type with get, set abstract extendsType: Type with get, set abstract isDistributive: bool with get, set - abstract inferTypeParameters: ResizeArray option with get, set - abstract outerTypeParameters: ResizeArray option with get, set + abstract inferTypeParameters: TypeParameter[] option with get, set + abstract outerTypeParameters: TypeParameter[] option with get, set abstract instantiations: Map option with get, set abstract aliasSymbol: Symbol option with get, set - abstract aliasTypeArguments: ResizeArray option with get, set + abstract aliasTypeArguments: Type[] option with get, set type [] ConditionalType = inherit InstantiableType @@ -4450,8 +5179,8 @@ module Ts = type [] TemplateLiteralType = inherit InstantiableType - abstract texts: ResizeArray with get, set - abstract types: ResizeArray with get, set + abstract texts: string[] with get, set + abstract types: Type[] with get, set type [] StringMappingType = inherit InstantiableType @@ -4470,14 +5199,15 @@ module Ts = type [] Signature = abstract declaration: U2 option with get, set - abstract typeParameters: ResizeArray option with get, set - abstract parameters: ResizeArray with get, set + abstract typeParameters: TypeParameter[] option with get, set + abstract parameters: Symbol[] with get, set abstract getDeclaration: unit -> SignatureDeclaration - abstract getTypeParameters: unit -> ResizeArray option - abstract getParameters: unit -> ResizeArray + abstract getTypeParameters: unit -> TypeParameter[] option + abstract getParameters: unit -> Symbol[] + abstract getTypeParameterAtPosition: pos: float -> Type abstract getReturnType: unit -> Type - abstract getDocumentationComment: typeChecker: TypeChecker option -> ResizeArray - abstract getJsDocTags: unit -> ResizeArray + abstract getDocumentationComment: typeChecker: TypeChecker option -> SymbolDisplayPart[] + abstract getJsDocTags: unit -> JSDocTagInfo[] type [] IndexKind = | String = 0 @@ -4505,6 +5235,7 @@ module Ts = | PriorityImpliesCombination = 416 | Circularity = -1 + [] type JsFileExtensionInfo = FileExtensionInfo @@ -4529,15 +5260,15 @@ module Ts = abstract messageText: string with get, set abstract category: DiagnosticCategory with get, set abstract code: float with get, set - abstract next: ResizeArray option with get, set + abstract next: DiagnosticMessageChain[] option with get, set type [] Diagnostic = inherit DiagnosticRelatedInformation - /// May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. + /// May store more in future. For now, this will simply be true to indicate when a diagnostic is an unused-identifier diagnostic. abstract reportsUnnecessary: DiagnosticMessageReportsUnnecessary option with get, set abstract reportsDeprecated: DiagnosticMessageReportsUnnecessary option with get, set abstract source: string option with get, set - abstract relatedInformation: ResizeArray option with get, set + abstract relatedInformation: DiagnosticRelatedInformation[] option with get, set type [] DiagnosticRelatedInformation = abstract category: DiagnosticCategory with get, set @@ -4599,7 +5330,7 @@ module Ts = | FixedChunkSize = 3 type CompilerOptionsValue = - U8>, ResizeArray, MapLike>, ResizeArray, ResizeArray> option + U8[], string[], MapLike, PluginImport[], ProjectReference[]> option type [] CompilerOptions = abstract allowJs: bool option with get, set @@ -4632,7 +5363,7 @@ module Ts = abstract isolatedModules: bool option with get, set abstract jsx: JsxEmit option with get, set abstract keyofStringsOnly: bool option with get, set - abstract lib: ResizeArray option with get, set + abstract lib: string[] option with get, set abstract locale: string option with get, set abstract mapRoot: string option with get, set abstract maxNodeModuleJsDepth: float option with get, set @@ -4659,7 +5390,7 @@ module Ts = abstract out: string option with get, set abstract outDir: string option with get, set abstract outFile: string option with get, set - abstract paths: MapLike> option with get, set + abstract paths: MapLike option with get, set abstract preserveConstEnums: bool option with get, set abstract noImplicitOverride: bool option with get, set abstract preserveSymlinks: bool option with get, set @@ -4674,7 +5405,7 @@ module Ts = abstract tsBuildInfoFile: string option with get, set abstract removeComments: bool option with get, set abstract rootDir: string option with get, set - abstract rootDirs: ResizeArray option with get, set + abstract rootDirs: string[] option with get, set abstract skipLibCheck: bool option with get, set abstract skipDefaultLibCheck: bool option with get, set abstract sourceMap: bool option with get, set @@ -4691,29 +5422,31 @@ module Ts = abstract traceResolution: bool option with get, set abstract useUnknownInCatchVariables: bool option with get, set abstract resolveJsonModule: bool option with get, set - abstract types: ResizeArray option with get, set + abstract types: string[] option with get, set /// Paths used to compute primary types search locations - abstract typeRoots: ResizeArray option with get, set + abstract typeRoots: string[] option with get, set abstract esModuleInterop: bool option with get, set abstract useDefineForClassFields: bool option with get, set - [] abstract Item: option: string -> U2 option with get, set + [] abstract Item: option: string -> U2 option with get, set type [] WatchOptions = abstract watchFile: WatchFileKind option with get, set abstract watchDirectory: WatchDirectoryKind option with get, set abstract fallbackPolling: PollingWatchKind option with get, set abstract synchronousWatchDirectory: bool option with get, set - abstract excludeDirectories: ResizeArray option with get, set - abstract excludeFiles: ResizeArray option with get, set - [] abstract Item: option: string -> CompilerOptionsValue option with get, set + abstract excludeDirectories: string[] option with get, set + abstract excludeFiles: string[] option with get, set + [] abstract Item: option: string -> CompilerOptionsValue option with get, set type [] TypeAcquisition = + [] abstract enableAutoDiscovery: bool option with get, set abstract enable: bool option with get, set - abstract ``include``: ResizeArray option with get, set - abstract exclude: ResizeArray option with get, set + abstract ``include``: string[] option with get, set + abstract exclude: string[] option with get, set abstract disableFilenameBasedTypeAcquisition: bool option with get, set - [] abstract Item: option: string -> CompilerOptionsValue option with get, set + [] abstract Item: option: string -> CompilerOptionsValue option with get, set type [] ModuleKind = | None = 0 @@ -4758,6 +5491,8 @@ module Ts = | TSX = 4 | External = 5 | JSON = 6 + /// Used on extensions that doesn't define the ScriptKind but the content defines it. + /// Deferred extensions are going to be included in all project contexts. | Deferred = 7 type [] ScriptTarget = @@ -4770,6 +5505,7 @@ module Ts = | ES2019 = 6 | ES2020 = 7 | ES2021 = 8 + | ES2022 = 9 | ESNext = 99 | JSON = 100 | Latest = 99 @@ -4782,11 +5518,11 @@ module Ts = type [] ParsedCommandLine = abstract options: CompilerOptions with get, set abstract typeAcquisition: TypeAcquisition option with get, set - abstract fileNames: ResizeArray with get, set - abstract projectReferences: ResizeArray option with get, set + abstract fileNames: string[] with get, set + abstract projectReferences: ProjectReference[] option with get, set abstract watchOptions: WatchOptions option with get, set abstract raw: obj option with get, set - abstract errors: ResizeArray with get, set + abstract errors: Diagnostic[] with get, set abstract wildcardDirectories: MapLike option with get, set abstract compileOnSave: bool option with get, set @@ -4795,38 +5531,43 @@ module Ts = | Recursive = 1 type [] CreateProgramOptions = - abstract rootNames: ResizeArray with get, set + abstract rootNames: string[] with get, set abstract options: CompilerOptions with get, set - abstract projectReferences: ResizeArray option with get, set + abstract projectReferences: ProjectReference[] option with get, set abstract host: CompilerHost option with get, set abstract oldProgram: Program option with get, set - abstract configFileParsingDiagnostics: ResizeArray option with get, set + abstract configFileParsingDiagnostics: Diagnostic[] option with get, set type [] ModuleResolutionHost = abstract fileExists: fileName: string -> bool abstract readFile: fileName: string -> string option abstract trace: s: string -> unit abstract directoryExists: directoryName: string -> bool - /// Resolve a symbolic link. + /// Resolve a symbolic link. + /// abstract realpath: path: string -> string abstract getCurrentDirectory: unit -> string - abstract getDirectories: path: string -> ResizeArray + abstract getDirectories: path: string -> string[] abstract useCaseSensitiveFileNames: U2 bool)> option with get, set + /// /// Represents the result of module resolution. /// Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off. /// The Program will then filter results based on these flags. /// - /// Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred. + /// Prefer to return a ResolvedModuleFull so that the file type does not have to be inferred. + /// type [] ResolvedModule = /// Path of the file the module was resolved to. abstract resolvedFileName: string with get, set - /// True if `resolvedFileName` comes from `node_modules`. + /// True if resolvedFileName comes from node_modules. abstract isExternalLibraryImport: bool option with get, set - /// ResolvedModule with an explicitly provided `extension` property. - /// Prefer this over `ResolvedModule`. - /// If changing this, remember to change `moduleResolutionIsEqualTo`. + /// + /// ResolvedModule with an explicitly provided extension property. + /// Prefer this over ResolvedModule. + /// If changing this, remember to change moduleResolutionIsEqualTo. + /// type [] ResolvedModuleFull = inherit ResolvedModule /// Extension of resolvedFileName. This must match what's at the end of resolvedFileName. @@ -4834,12 +5575,16 @@ module Ts = abstract extension: Extension with get, set abstract packageId: PackageId option with get, set + /// /// Unique identifier with a package name and version. - /// If changing this, remember to change `packageIdIsEqual`. + /// If changing this, remember to change packageIdIsEqual. + /// type [] PackageId = + /// /// Name of the package. - /// Should not include `@types`. + /// Should not include @types. /// If accessing a non-index file, this should include its name e.g. "foo/bar". + /// abstract name: string with get, set /// Name of a submodule within this package. /// May be "". @@ -4869,12 +5614,12 @@ module Ts = abstract primary: bool with get, set abstract resolvedFileName: string option with get, set abstract packageId: PackageId option with get, set - /// True if `resolvedFileName` comes from `node_modules`. + /// True if resolvedFileName comes from node_modules. abstract isExternalLibraryImport: bool option with get, set type [] ResolvedTypeReferenceDirectiveWithFailedLookupLocations = abstract resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective option - abstract failedLookupLocations: ResizeArray + abstract failedLookupLocations: string[] type [] CompilerHost = inherit ModuleResolutionHost @@ -4888,12 +5633,12 @@ module Ts = abstract getCanonicalFileName: fileName: string -> string abstract useCaseSensitiveFileNames: unit -> bool abstract getNewLine: unit -> string - abstract readDirectory: rootDir: string * extensions: ResizeArray * excludes: ResizeArray option * includes: ResizeArray * ?depth: float -> ResizeArray - abstract resolveModuleNames: moduleNames: ResizeArray * containingFile: string * reusedNames: ResizeArray option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResizeArray - /// Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it + abstract readDirectory: rootDir: string * extensions: string[] * excludes: string[] option * includes: string[] * ?depth: float -> string[] + abstract resolveModuleNames: moduleNames: string[] * containingFile: string * reusedNames: string[] option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResolvedModule option[] + /// Returns the module resolution cache used by a provided resolveModuleNames implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it abstract getModuleResolutionCache: unit -> ModuleResolutionCache option /// This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files - abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: ResizeArray * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions -> ResizeArray + abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: string[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions -> ResolvedTypeReferenceDirective option[] abstract getEnvironmentVariable: name: string -> string option abstract createHash: data: string -> string abstract getParsedCommandLine: fileName: string -> ParsedCommandLine option @@ -4944,19 +5689,20 @@ module Ts = abstract scoped: bool abstract text: U2 string)> abstract priority: float option - abstract dependencies: ResizeArray option + abstract dependencies: EmitHelper[] option type [] ScopedEmitHelper = inherit EmitHelperBase - abstract scoped: obj + abstract scoped: bool type [] UnscopedEmitHelper = inherit EmitHelperBase - abstract scoped: obj + abstract scoped: bool abstract text: string - type EmitHelper = - U2 + type [] [] EmitHelper = + | [] UnscopedEmitHelper of UnscopedEmitHelper + | [] ScopedEmitHelper of ScopedEmitHelper type [] EmitHelperUniqueNameCallback = [] abstract Invoke: name: string -> string @@ -4990,7 +5736,7 @@ module Ts = | Function type [] NodeFactory = - abstract createNodeArray: ?elements: ResizeArray<'T> * ?hasTrailingComma: bool -> ResizeArray<'T> + abstract createNodeArray: ?elements: 'T[] * ?hasTrailingComma: bool -> 'T[] abstract createNumericLiteral: value: U2 * ?numericLiteralFlags: TokenFlags -> NumericLiteral abstract createBigIntLiteral: value: U2 -> BigIntLiteral abstract createStringLiteral: text: string * ?isSingleQuote: bool -> StringLiteral @@ -4998,17 +5744,23 @@ module Ts = abstract createRegularExpressionLiteral: text: string -> RegularExpressionLiteral abstract createIdentifier: text: string -> Identifier /// Create a unique temporary variable. - /// An optional callback used to record the temporary variable name. This - /// should usually be a reference to `hoistVariableDeclaration` from a `TransformationContext`, but - /// can be `undefined` if you plan to record the temporary variable manually. - /// When `true`, reserves the temporary variable name in all nested scopes + /// + /// An optional callback used to record the temporary variable name. This + /// should usually be a reference to hoistVariableDeclaration from a TransformationContext, but + /// can be undefined if you plan to record the temporary variable manually. + /// + /// + /// When true, reserves the temporary variable name in all nested scopes /// during emit so that the variable can be referenced in a nested function body. This is an alternative to - /// setting `EmitFlags.ReuseTempVariableScope` on the nested function itself. + /// setting EmitFlags.ReuseTempVariableScope on the nested function itself. + /// abstract createTempVariable: recordTempVariable: (Identifier -> unit) option * ?reservedInNestedScopes: bool -> Identifier /// Create a unique temporary variable for use in a loop. - /// When `true`, reserves the temporary variable name in all nested scopes + /// + /// When true, reserves the temporary variable name in all nested scopes /// during emit so that the variable can be referenced in a nested function body. This is an alternative to - /// setting `EmitFlags.ReuseTempVariableScope` on the nested function itself. + /// setting EmitFlags.ReuseTempVariableScope on the nested function itself. + /// abstract createLoopVariable: ?reservedInNestedScopes: bool -> Identifier /// Create a unique name based on the supplied text. abstract createUniqueName: text: string * ?flags: GeneratedIdentifierFlags -> Identifier @@ -5016,83 +5768,85 @@ module Ts = abstract getGeneratedNameForNode: node: Node option * ?flags: GeneratedIdentifierFlags -> Identifier abstract createPrivateIdentifier: text: string -> PrivateIdentifier abstract createToken: token: SyntaxKind -> SuperExpression - abstract createToken: token: 'TKind -> PunctuationToken<'TKind> + abstract createToken: token: 'TKind -> Token<'TKind> abstract createSuper: unit -> SuperExpression abstract createThis: unit -> ThisExpression abstract createNull: unit -> NullLiteral abstract createTrue: unit -> TrueLiteral abstract createFalse: unit -> FalseLiteral abstract createModifier: kind: 'T -> ModifierToken<'T> - abstract createModifiersFromModifierFlags: flags: ModifierFlags -> ResizeArray + abstract createModifiersFromModifierFlags: flags: ModifierFlags -> Modifier[] option abstract createQualifiedName: left: EntityName * right: U2 -> QualifiedName abstract updateQualifiedName: node: QualifiedName * left: EntityName * right: Identifier -> QualifiedName abstract createComputedPropertyName: expression: Expression -> ComputedPropertyName abstract updateComputedPropertyName: node: ComputedPropertyName * expression: Expression -> ComputedPropertyName abstract createTypeParameterDeclaration: name: U2 * ?``constraint``: TypeNode * ?defaultType: TypeNode -> TypeParameterDeclaration abstract updateTypeParameterDeclaration: node: TypeParameterDeclaration * name: Identifier * ``constraint``: TypeNode option * defaultType: TypeNode option -> TypeParameterDeclaration - abstract createParameterDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * dotDotDotToken: DotDotDotToken option * name: U2 * ?questionToken: QuestionToken * ?``type``: TypeNode * ?initializer: Expression -> ParameterDeclaration - abstract updateParameterDeclaration: node: ParameterDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * dotDotDotToken: DotDotDotToken option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option * initializer: Expression option -> ParameterDeclaration + abstract createParameterDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * ?questionToken: QuestionToken * ?``type``: TypeNode * ?initializer: Expression -> ParameterDeclaration + abstract updateParameterDeclaration: node: ParameterDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option * initializer: Expression option -> ParameterDeclaration abstract createDecorator: expression: Expression -> Decorator abstract updateDecorator: node: Decorator * expression: Expression -> Decorator - abstract createPropertySignature: modifiers: ResizeArray option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option -> PropertySignature - abstract updatePropertySignature: node: PropertySignature * modifiers: ResizeArray option * name: PropertyName * questionToken: QuestionToken option * ``type``: TypeNode option -> PropertySignature - abstract createPropertyDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration - abstract updatePropertyDeclaration: node: PropertyDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration - abstract createMethodSignature: modifiers: ResizeArray option * name: U2 * questionToken: QuestionToken option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option -> MethodSignature - abstract updateMethodSignature: node: MethodSignature * modifiers: ResizeArray option * name: PropertyName * questionToken: QuestionToken option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option -> MethodSignature - abstract createMethodDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * asteriskToken: AsteriskToken option * name: U2 * questionToken: QuestionToken option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * body: Block option -> MethodDeclaration - abstract updateMethodDeclaration: node: MethodDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * asteriskToken: AsteriskToken option * name: PropertyName * questionToken: QuestionToken option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * body: Block option -> MethodDeclaration - abstract createConstructorDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * parameters: ResizeArray * body: Block option -> ConstructorDeclaration - abstract updateConstructorDeclaration: node: ConstructorDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * parameters: ResizeArray * body: Block option -> ConstructorDeclaration - abstract createGetAccessorDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * name: U2 * parameters: ResizeArray * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration - abstract updateGetAccessorDeclaration: node: GetAccessorDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * name: PropertyName * parameters: ResizeArray * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration - abstract createSetAccessorDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * name: U2 * parameters: ResizeArray * body: Block option -> SetAccessorDeclaration - abstract updateSetAccessorDeclaration: node: SetAccessorDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * name: PropertyName * parameters: ResizeArray * body: Block option -> SetAccessorDeclaration - abstract createCallSignature: typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option -> CallSignatureDeclaration - abstract updateCallSignature: node: CallSignatureDeclaration * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option -> CallSignatureDeclaration - abstract createConstructSignature: typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option -> ConstructSignatureDeclaration - abstract updateConstructSignature: node: ConstructSignatureDeclaration * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option -> ConstructSignatureDeclaration - abstract createIndexSignature: decorators: ResizeArray option * modifiers: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode -> IndexSignatureDeclaration - abstract updateIndexSignature: node: IndexSignatureDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode -> IndexSignatureDeclaration + abstract createPropertySignature: modifiers: Modifier[] option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option -> PropertySignature + abstract updatePropertySignature: node: PropertySignature * modifiers: Modifier[] option * name: PropertyName * questionToken: QuestionToken option * ``type``: TypeNode option -> PropertySignature + abstract createPropertyDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration + abstract updatePropertyDeclaration: node: PropertyDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration + abstract createMethodSignature: modifiers: Modifier[] option * name: U2 * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> MethodSignature + abstract updateMethodSignature: node: MethodSignature * modifiers: Modifier[] option * name: PropertyName * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> MethodSignature + abstract createMethodDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: U2 * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration + abstract updateMethodDeclaration: node: MethodDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: PropertyName * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration + abstract createConstructorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration + abstract updateConstructorDeclaration: node: ConstructorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration + abstract createGetAccessorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration + abstract updateGetAccessorDeclaration: node: GetAccessorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: PropertyName * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration + abstract createSetAccessorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration + abstract updateSetAccessorDeclaration: node: SetAccessorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: PropertyName * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration + abstract createCallSignature: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> CallSignatureDeclaration + abstract updateCallSignature: node: CallSignatureDeclaration * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> CallSignatureDeclaration + abstract createConstructSignature: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> ConstructSignatureDeclaration + abstract updateConstructSignature: node: ConstructSignatureDeclaration * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> ConstructSignatureDeclaration + abstract createIndexSignature: decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration + abstract updateIndexSignature: node: IndexSignatureDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration abstract createTemplateLiteralTypeSpan: ``type``: TypeNode * literal: U2 -> TemplateLiteralTypeSpan abstract updateTemplateLiteralTypeSpan: node: TemplateLiteralTypeSpan * ``type``: TypeNode * literal: U2 -> TemplateLiteralTypeSpan - abstract createClassStaticBlockDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * body: Block -> ClassStaticBlockDeclaration - abstract updateClassStaticBlockDeclaration: node: ClassStaticBlockDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * body: Block -> ClassStaticBlockDeclaration + abstract createClassStaticBlockDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * body: Block -> ClassStaticBlockDeclaration + abstract updateClassStaticBlockDeclaration: node: ClassStaticBlockDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * body: Block -> ClassStaticBlockDeclaration abstract createKeywordTypeNode: kind: 'TKind -> KeywordTypeNode<'TKind> abstract createTypePredicateNode: assertsModifier: AssertsKeyword option * parameterName: U3 * ``type``: TypeNode option -> TypePredicateNode abstract updateTypePredicateNode: node: TypePredicateNode * assertsModifier: AssertsKeyword option * parameterName: U2 * ``type``: TypeNode option -> TypePredicateNode - abstract createTypeReferenceNode: typeName: U2 * ?typeArguments: ResizeArray -> TypeReferenceNode - abstract updateTypeReferenceNode: node: TypeReferenceNode * typeName: EntityName * typeArguments: ResizeArray option -> TypeReferenceNode - abstract createFunctionTypeNode: typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode -> FunctionTypeNode - abstract updateFunctionTypeNode: node: FunctionTypeNode * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode -> FunctionTypeNode - abstract createConstructorTypeNode: modifiers: ResizeArray option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode -> ConstructorTypeNode - abstract createConstructorTypeNode: typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode -> ConstructorTypeNode - abstract updateConstructorTypeNode: node: ConstructorTypeNode * modifiers: ResizeArray option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode -> ConstructorTypeNode - abstract updateConstructorTypeNode: node: ConstructorTypeNode * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode -> ConstructorTypeNode + abstract createTypeReferenceNode: typeName: U2 * ?typeArguments: TypeNode[] -> TypeReferenceNode + abstract updateTypeReferenceNode: node: TypeReferenceNode * typeName: EntityName * typeArguments: TypeNode[] option -> TypeReferenceNode + abstract createFunctionTypeNode: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> FunctionTypeNode + abstract updateFunctionTypeNode: node: FunctionTypeNode * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> FunctionTypeNode + abstract createConstructorTypeNode: modifiers: Modifier[] option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode + [] + abstract createConstructorTypeNode: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode + abstract updateConstructorTypeNode: node: ConstructorTypeNode * modifiers: Modifier[] option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode + [] + abstract updateConstructorTypeNode: node: ConstructorTypeNode * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode abstract createTypeQueryNode: exprName: EntityName -> TypeQueryNode abstract updateTypeQueryNode: node: TypeQueryNode * exprName: EntityName -> TypeQueryNode - abstract createTypeLiteralNode: members: ResizeArray option -> TypeLiteralNode - abstract updateTypeLiteralNode: node: TypeLiteralNode * members: ResizeArray -> TypeLiteralNode + abstract createTypeLiteralNode: members: TypeElement[] option -> TypeLiteralNode + abstract updateTypeLiteralNode: node: TypeLiteralNode * members: TypeElement[] -> TypeLiteralNode abstract createArrayTypeNode: elementType: TypeNode -> ArrayTypeNode abstract updateArrayTypeNode: node: ArrayTypeNode * elementType: TypeNode -> ArrayTypeNode - abstract createTupleTypeNode: elements: ResizeArray> -> TupleTypeNode - abstract updateTupleTypeNode: node: TupleTypeNode * elements: ResizeArray> -> TupleTypeNode + abstract createTupleTypeNode: elements: U2[] -> TupleTypeNode + abstract updateTupleTypeNode: node: TupleTypeNode * elements: U2[] -> TupleTypeNode abstract createNamedTupleMember: dotDotDotToken: DotDotDotToken option * name: Identifier * questionToken: QuestionToken option * ``type``: TypeNode -> NamedTupleMember abstract updateNamedTupleMember: node: NamedTupleMember * dotDotDotToken: DotDotDotToken option * name: Identifier * questionToken: QuestionToken option * ``type``: TypeNode -> NamedTupleMember abstract createOptionalTypeNode: ``type``: TypeNode -> OptionalTypeNode abstract updateOptionalTypeNode: node: OptionalTypeNode * ``type``: TypeNode -> OptionalTypeNode abstract createRestTypeNode: ``type``: TypeNode -> RestTypeNode abstract updateRestTypeNode: node: RestTypeNode * ``type``: TypeNode -> RestTypeNode - abstract createUnionTypeNode: types: ResizeArray -> UnionTypeNode - abstract updateUnionTypeNode: node: UnionTypeNode * types: ResizeArray -> UnionTypeNode - abstract createIntersectionTypeNode: types: ResizeArray -> IntersectionTypeNode - abstract updateIntersectionTypeNode: node: IntersectionTypeNode * types: ResizeArray -> IntersectionTypeNode + abstract createUnionTypeNode: types: TypeNode[] -> UnionTypeNode + abstract updateUnionTypeNode: node: UnionTypeNode * types: TypeNode[] -> UnionTypeNode + abstract createIntersectionTypeNode: types: TypeNode[] -> IntersectionTypeNode + abstract updateIntersectionTypeNode: node: IntersectionTypeNode * types: TypeNode[] -> IntersectionTypeNode abstract createConditionalTypeNode: checkType: TypeNode * extendsType: TypeNode * trueType: TypeNode * falseType: TypeNode -> ConditionalTypeNode abstract updateConditionalTypeNode: node: ConditionalTypeNode * checkType: TypeNode * extendsType: TypeNode * trueType: TypeNode * falseType: TypeNode -> ConditionalTypeNode abstract createInferTypeNode: typeParameter: TypeParameterDeclaration -> InferTypeNode abstract updateInferTypeNode: node: InferTypeNode * typeParameter: TypeParameterDeclaration -> InferTypeNode - abstract createImportTypeNode: argument: TypeNode * ?qualifier: EntityName * ?typeArguments: ResizeArray * ?isTypeOf: bool -> ImportTypeNode - abstract updateImportTypeNode: node: ImportTypeNode * argument: TypeNode * qualifier: EntityName option * typeArguments: ResizeArray option * ?isTypeOf: bool -> ImportTypeNode + abstract createImportTypeNode: argument: TypeNode * ?qualifier: EntityName * ?typeArguments: TypeNode[] * ?isTypeOf: bool -> ImportTypeNode + abstract updateImportTypeNode: node: ImportTypeNode * argument: TypeNode * qualifier: EntityName option * typeArguments: TypeNode[] option * ?isTypeOf: bool -> ImportTypeNode abstract createParenthesizedType: ``type``: TypeNode -> ParenthesizedTypeNode abstract updateParenthesizedType: node: ParenthesizedTypeNode * ``type``: TypeNode -> ParenthesizedTypeNode abstract createThisTypeNode: unit -> ThisTypeNode @@ -5100,22 +5854,22 @@ module Ts = abstract updateTypeOperatorNode: node: TypeOperatorNode * ``type``: TypeNode -> TypeOperatorNode abstract createIndexedAccessTypeNode: objectType: TypeNode * indexType: TypeNode -> IndexedAccessTypeNode abstract updateIndexedAccessTypeNode: node: IndexedAccessTypeNode * objectType: TypeNode * indexType: TypeNode -> IndexedAccessTypeNode - abstract createMappedTypeNode: readonlyToken: U3 option * typeParameter: TypeParameterDeclaration * nameType: TypeNode option * questionToken: U3 option * ``type``: TypeNode option * members: ResizeArray option -> MappedTypeNode - abstract updateMappedTypeNode: node: MappedTypeNode * readonlyToken: U3 option * typeParameter: TypeParameterDeclaration * nameType: TypeNode option * questionToken: U3 option * ``type``: TypeNode option * members: ResizeArray option -> MappedTypeNode - abstract createLiteralTypeNode: literal: LiteralTypeNode -> LiteralTypeNode - abstract updateLiteralTypeNode: node: LiteralTypeNode * literal: LiteralTypeNode -> LiteralTypeNode - abstract createTemplateLiteralType: head: TemplateHead * templateSpans: ResizeArray -> TemplateLiteralTypeNode - abstract updateTemplateLiteralType: node: TemplateLiteralTypeNode * head: TemplateHead * templateSpans: ResizeArray -> TemplateLiteralTypeNode - abstract createObjectBindingPattern: elements: ResizeArray -> ObjectBindingPattern - abstract updateObjectBindingPattern: node: ObjectBindingPattern * elements: ResizeArray -> ObjectBindingPattern - abstract createArrayBindingPattern: elements: ResizeArray -> ArrayBindingPattern - abstract updateArrayBindingPattern: node: ArrayBindingPattern * elements: ResizeArray -> ArrayBindingPattern + abstract createMappedTypeNode: readonlyToken: U3 option * typeParameter: TypeParameterDeclaration * nameType: TypeNode option * questionToken: U3 option * ``type``: TypeNode option * members: TypeElement[] option -> MappedTypeNode + abstract updateMappedTypeNode: node: MappedTypeNode * readonlyToken: U3 option * typeParameter: TypeParameterDeclaration * nameType: TypeNode option * questionToken: U3 option * ``type``: TypeNode option * members: TypeElement[] option -> MappedTypeNode + abstract createLiteralTypeNode: literal: obj -> LiteralTypeNode + abstract updateLiteralTypeNode: node: LiteralTypeNode * literal: obj -> LiteralTypeNode + abstract createTemplateLiteralType: head: TemplateHead * templateSpans: TemplateLiteralTypeSpan[] -> TemplateLiteralTypeNode + abstract updateTemplateLiteralType: node: TemplateLiteralTypeNode * head: TemplateHead * templateSpans: TemplateLiteralTypeSpan[] -> TemplateLiteralTypeNode + abstract createObjectBindingPattern: elements: BindingElement[] -> ObjectBindingPattern + abstract updateObjectBindingPattern: node: ObjectBindingPattern * elements: BindingElement[] -> ObjectBindingPattern + abstract createArrayBindingPattern: elements: ArrayBindingElement[] -> ArrayBindingPattern + abstract updateArrayBindingPattern: node: ArrayBindingPattern * elements: ArrayBindingElement[] -> ArrayBindingPattern abstract createBindingElement: dotDotDotToken: DotDotDotToken option * propertyName: U2 option * name: U2 * ?initializer: Expression -> BindingElement abstract updateBindingElement: node: BindingElement * dotDotDotToken: DotDotDotToken option * propertyName: PropertyName option * name: BindingName * initializer: Expression option -> BindingElement - abstract createArrayLiteralExpression: ?elements: ResizeArray * ?multiLine: bool -> ArrayLiteralExpression - abstract updateArrayLiteralExpression: node: ArrayLiteralExpression * elements: ResizeArray -> ArrayLiteralExpression - abstract createObjectLiteralExpression: ?properties: ResizeArray * ?multiLine: bool -> ObjectLiteralExpression - abstract updateObjectLiteralExpression: node: ObjectLiteralExpression * properties: ResizeArray -> ObjectLiteralExpression + abstract createArrayLiteralExpression: ?elements: Expression[] * ?multiLine: bool -> ArrayLiteralExpression + abstract updateArrayLiteralExpression: node: ArrayLiteralExpression * elements: Expression[] -> ArrayLiteralExpression + abstract createObjectLiteralExpression: ?properties: ObjectLiteralElementLike[] * ?multiLine: bool -> ObjectLiteralExpression + abstract updateObjectLiteralExpression: node: ObjectLiteralExpression * properties: ObjectLiteralElementLike[] -> ObjectLiteralExpression abstract createPropertyAccessExpression: expression: Expression * name: U2 -> PropertyAccessExpression abstract updatePropertyAccessExpression: node: PropertyAccessExpression * expression: Expression * name: MemberName -> PropertyAccessExpression abstract createPropertyAccessChain: expression: Expression * questionDotToken: QuestionDotToken option * name: U2 -> PropertyAccessChain @@ -5124,22 +5878,22 @@ module Ts = abstract updateElementAccessExpression: node: ElementAccessExpression * expression: Expression * argumentExpression: Expression -> ElementAccessExpression abstract createElementAccessChain: expression: Expression * questionDotToken: QuestionDotToken option * index: U2 -> ElementAccessChain abstract updateElementAccessChain: node: ElementAccessChain * expression: Expression * questionDotToken: QuestionDotToken option * argumentExpression: Expression -> ElementAccessChain - abstract createCallExpression: expression: Expression * typeArguments: ResizeArray option * argumentsArray: ResizeArray option -> CallExpression - abstract updateCallExpression: node: CallExpression * expression: Expression * typeArguments: ResizeArray option * argumentsArray: ResizeArray -> CallExpression - abstract createCallChain: expression: Expression * questionDotToken: QuestionDotToken option * typeArguments: ResizeArray option * argumentsArray: ResizeArray option -> CallChain - abstract updateCallChain: node: CallChain * expression: Expression * questionDotToken: QuestionDotToken option * typeArguments: ResizeArray option * argumentsArray: ResizeArray -> CallChain - abstract createNewExpression: expression: Expression * typeArguments: ResizeArray option * argumentsArray: ResizeArray option -> NewExpression - abstract updateNewExpression: node: NewExpression * expression: Expression * typeArguments: ResizeArray option * argumentsArray: ResizeArray option -> NewExpression - abstract createTaggedTemplateExpression: tag: Expression * typeArguments: ResizeArray option * template: TemplateLiteral -> TaggedTemplateExpression - abstract updateTaggedTemplateExpression: node: TaggedTemplateExpression * tag: Expression * typeArguments: ResizeArray option * template: TemplateLiteral -> TaggedTemplateExpression + abstract createCallExpression: expression: Expression * typeArguments: TypeNode[] option * argumentsArray: Expression[] option -> CallExpression + abstract updateCallExpression: node: CallExpression * expression: Expression * typeArguments: TypeNode[] option * argumentsArray: Expression[] -> CallExpression + abstract createCallChain: expression: Expression * questionDotToken: QuestionDotToken option * typeArguments: TypeNode[] option * argumentsArray: Expression[] option -> CallChain + abstract updateCallChain: node: CallChain * expression: Expression * questionDotToken: QuestionDotToken option * typeArguments: TypeNode[] option * argumentsArray: Expression[] -> CallChain + abstract createNewExpression: expression: Expression * typeArguments: TypeNode[] option * argumentsArray: Expression[] option -> NewExpression + abstract updateNewExpression: node: NewExpression * expression: Expression * typeArguments: TypeNode[] option * argumentsArray: Expression[] option -> NewExpression + abstract createTaggedTemplateExpression: tag: Expression * typeArguments: TypeNode[] option * template: TemplateLiteral -> TaggedTemplateExpression + abstract updateTaggedTemplateExpression: node: TaggedTemplateExpression * tag: Expression * typeArguments: TypeNode[] option * template: TemplateLiteral -> TaggedTemplateExpression abstract createTypeAssertion: ``type``: TypeNode * expression: Expression -> TypeAssertion abstract updateTypeAssertion: node: TypeAssertion * ``type``: TypeNode * expression: Expression -> TypeAssertion abstract createParenthesizedExpression: expression: Expression -> ParenthesizedExpression abstract updateParenthesizedExpression: node: ParenthesizedExpression * expression: Expression -> ParenthesizedExpression - abstract createFunctionExpression: modifiers: ResizeArray option * asteriskToken: AsteriskToken option * name: U2 option * typeParameters: ResizeArray option * parameters: ResizeArray option * ``type``: TypeNode option * body: Block -> FunctionExpression - abstract updateFunctionExpression: node: FunctionExpression * modifiers: ResizeArray option * asteriskToken: AsteriskToken option * name: Identifier option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * body: Block -> FunctionExpression - abstract createArrowFunction: modifiers: ResizeArray option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * equalsGreaterThanToken: EqualsGreaterThanToken option * body: ConciseBody -> ArrowFunction - abstract updateArrowFunction: node: ArrowFunction * modifiers: ResizeArray option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * equalsGreaterThanToken: EqualsGreaterThanToken * body: ConciseBody -> ArrowFunction + abstract createFunctionExpression: modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] option * ``type``: TypeNode option * body: Block -> FunctionExpression + abstract updateFunctionExpression: node: FunctionExpression * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block -> FunctionExpression + abstract createArrowFunction: modifiers: Modifier[] option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * equalsGreaterThanToken: EqualsGreaterThanToken option * body: ConciseBody -> ArrowFunction + abstract updateArrowFunction: node: ArrowFunction * modifiers: Modifier[] option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * equalsGreaterThanToken: EqualsGreaterThanToken * body: ConciseBody -> ArrowFunction abstract createDeleteExpression: expression: Expression -> DeleteExpression abstract updateDeleteExpression: node: DeleteExpression * expression: Expression -> DeleteExpression abstract createTypeOfExpression: expression: Expression -> TypeOfExpression @@ -5156,8 +5910,8 @@ module Ts = abstract updateBinaryExpression: node: BinaryExpression * left: Expression * operator: U2 * right: Expression -> BinaryExpression abstract createConditionalExpression: condition: Expression * questionToken: QuestionToken option * whenTrue: Expression * colonToken: ColonToken option * whenFalse: Expression -> ConditionalExpression abstract updateConditionalExpression: node: ConditionalExpression * condition: Expression * questionToken: QuestionToken * whenTrue: Expression * colonToken: ColonToken * whenFalse: Expression -> ConditionalExpression - abstract createTemplateExpression: head: TemplateHead * templateSpans: ResizeArray -> TemplateExpression - abstract updateTemplateExpression: node: TemplateExpression * head: TemplateHead * templateSpans: ResizeArray -> TemplateExpression + abstract createTemplateExpression: head: TemplateHead * templateSpans: TemplateSpan[] -> TemplateExpression + abstract updateTemplateExpression: node: TemplateExpression * head: TemplateHead * templateSpans: TemplateSpan[] -> TemplateExpression abstract createTemplateHead: text: string * ?rawText: string * ?templateFlags: TokenFlags -> TemplateHead abstract createTemplateHead: text: string option * rawText: string * ?templateFlags: TokenFlags -> TemplateHead abstract createTemplateMiddle: text: string * ?rawText: string * ?templateFlags: TokenFlags -> TemplateMiddle @@ -5171,26 +5925,26 @@ module Ts = abstract updateYieldExpression: node: YieldExpression * asteriskToken: AsteriskToken option * expression: Expression option -> YieldExpression abstract createSpreadElement: expression: Expression -> SpreadElement abstract updateSpreadElement: node: SpreadElement * expression: Expression -> SpreadElement - abstract createClassExpression: decorators: ResizeArray option * modifiers: ResizeArray option * name: U2 option * typeParameters: ResizeArray option * heritageClauses: ResizeArray option * members: ResizeArray -> ClassExpression - abstract updateClassExpression: node: ClassExpression * decorators: ResizeArray option * modifiers: ResizeArray option * name: Identifier option * typeParameters: ResizeArray option * heritageClauses: ResizeArray option * members: ResizeArray -> ClassExpression + abstract createClassExpression: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression + abstract updateClassExpression: node: ClassExpression * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression abstract createOmittedExpression: unit -> OmittedExpression - abstract createExpressionWithTypeArguments: expression: Expression * typeArguments: ResizeArray option -> ExpressionWithTypeArguments - abstract updateExpressionWithTypeArguments: node: ExpressionWithTypeArguments * expression: Expression * typeArguments: ResizeArray option -> ExpressionWithTypeArguments + abstract createExpressionWithTypeArguments: expression: Expression * typeArguments: TypeNode[] option -> ExpressionWithTypeArguments + abstract updateExpressionWithTypeArguments: node: ExpressionWithTypeArguments * expression: Expression * typeArguments: TypeNode[] option -> ExpressionWithTypeArguments abstract createAsExpression: expression: Expression * ``type``: TypeNode -> AsExpression abstract updateAsExpression: node: AsExpression * expression: Expression * ``type``: TypeNode -> AsExpression abstract createNonNullExpression: expression: Expression -> NonNullExpression abstract updateNonNullExpression: node: NonNullExpression * expression: Expression -> NonNullExpression abstract createNonNullChain: expression: Expression -> NonNullChain abstract updateNonNullChain: node: NonNullChain * expression: Expression -> NonNullChain - abstract createMetaProperty: keywordToken: MetaProperty * name: Identifier -> MetaProperty + abstract createMetaProperty: keywordToken: obj * name: Identifier -> MetaProperty abstract updateMetaProperty: node: MetaProperty * name: Identifier -> MetaProperty abstract createTemplateSpan: expression: Expression * literal: U2 -> TemplateSpan abstract updateTemplateSpan: node: TemplateSpan * expression: Expression * literal: U2 -> TemplateSpan abstract createSemicolonClassElement: unit -> SemicolonClassElement - abstract createBlock: statements: ResizeArray * ?multiLine: bool -> Block - abstract updateBlock: node: Block * statements: ResizeArray -> Block - abstract createVariableStatement: modifiers: ResizeArray option * declarationList: U2> -> VariableStatement - abstract updateVariableStatement: node: VariableStatement * modifiers: ResizeArray option * declarationList: VariableDeclarationList -> VariableStatement + abstract createBlock: statements: Statement[] * ?multiLine: bool -> Block + abstract updateBlock: node: Block * statements: Statement[] -> Block + abstract createVariableStatement: modifiers: Modifier[] option * declarationList: U2 -> VariableStatement + abstract updateVariableStatement: node: VariableStatement * modifiers: Modifier[] option * declarationList: VariableDeclarationList -> VariableStatement abstract createEmptyStatement: unit -> EmptyStatement abstract createExpressionStatement: expression: Expression -> ExpressionStatement abstract updateExpressionStatement: node: ExpressionStatement * expression: Expression -> ExpressionStatement @@ -5225,50 +5979,50 @@ module Ts = abstract createDebuggerStatement: unit -> DebuggerStatement abstract createVariableDeclaration: name: U2 * ?exclamationToken: ExclamationToken * ?``type``: TypeNode * ?initializer: Expression -> VariableDeclaration abstract updateVariableDeclaration: node: VariableDeclaration * name: BindingName * exclamationToken: ExclamationToken option * ``type``: TypeNode option * initializer: Expression option -> VariableDeclaration - abstract createVariableDeclarationList: declarations: ResizeArray * ?flags: NodeFlags -> VariableDeclarationList - abstract updateVariableDeclarationList: node: VariableDeclarationList * declarations: ResizeArray -> VariableDeclarationList - abstract createFunctionDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * asteriskToken: AsteriskToken option * name: U2 option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * body: Block option -> FunctionDeclaration - abstract updateFunctionDeclaration: node: FunctionDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * asteriskToken: AsteriskToken option * name: Identifier option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * body: Block option -> FunctionDeclaration - abstract createClassDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * name: U2 option * typeParameters: ResizeArray option * heritageClauses: ResizeArray option * members: ResizeArray -> ClassDeclaration - abstract updateClassDeclaration: node: ClassDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * name: Identifier option * typeParameters: ResizeArray option * heritageClauses: ResizeArray option * members: ResizeArray -> ClassDeclaration - abstract createInterfaceDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * name: U2 * typeParameters: ResizeArray option * heritageClauses: ResizeArray option * members: ResizeArray -> InterfaceDeclaration - abstract updateInterfaceDeclaration: node: InterfaceDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * name: Identifier * typeParameters: ResizeArray option * heritageClauses: ResizeArray option * members: ResizeArray -> InterfaceDeclaration - abstract createTypeAliasDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * name: U2 * typeParameters: ResizeArray option * ``type``: TypeNode -> TypeAliasDeclaration - abstract updateTypeAliasDeclaration: node: TypeAliasDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * name: Identifier * typeParameters: ResizeArray option * ``type``: TypeNode -> TypeAliasDeclaration - abstract createEnumDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * name: U2 * members: ResizeArray -> EnumDeclaration - abstract updateEnumDeclaration: node: EnumDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * name: Identifier * members: ResizeArray -> EnumDeclaration - abstract createModuleDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * name: ModuleName * body: ModuleBody option * ?flags: NodeFlags -> ModuleDeclaration - abstract updateModuleDeclaration: node: ModuleDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * name: ModuleName * body: ModuleBody option -> ModuleDeclaration - abstract createModuleBlock: statements: ResizeArray -> ModuleBlock - abstract updateModuleBlock: node: ModuleBlock * statements: ResizeArray -> ModuleBlock - abstract createCaseBlock: clauses: ResizeArray -> CaseBlock - abstract updateCaseBlock: node: CaseBlock * clauses: ResizeArray -> CaseBlock + abstract createVariableDeclarationList: declarations: VariableDeclaration[] * ?flags: NodeFlags -> VariableDeclarationList + abstract updateVariableDeclarationList: node: VariableDeclarationList * declarations: VariableDeclaration[] -> VariableDeclarationList + abstract createFunctionDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration + abstract updateFunctionDeclaration: node: FunctionDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration + abstract createClassDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration + abstract updateClassDeclaration: node: ClassDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration + abstract createInterfaceDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration + abstract updateInterfaceDeclaration: node: InterfaceDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration + abstract createTypeAliasDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration + abstract updateTypeAliasDeclaration: node: TypeAliasDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration + abstract createEnumDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * members: EnumMember[] -> EnumDeclaration + abstract updateEnumDeclaration: node: EnumDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * members: EnumMember[] -> EnumDeclaration + abstract createModuleDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option * ?flags: NodeFlags -> ModuleDeclaration + abstract updateModuleDeclaration: node: ModuleDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option -> ModuleDeclaration + abstract createModuleBlock: statements: Statement[] -> ModuleBlock + abstract updateModuleBlock: node: ModuleBlock * statements: Statement[] -> ModuleBlock + abstract createCaseBlock: clauses: CaseOrDefaultClause[] -> CaseBlock + abstract updateCaseBlock: node: CaseBlock * clauses: CaseOrDefaultClause[] -> CaseBlock abstract createNamespaceExportDeclaration: name: U2 -> NamespaceExportDeclaration abstract updateNamespaceExportDeclaration: node: NamespaceExportDeclaration * name: Identifier -> NamespaceExportDeclaration - abstract createImportEqualsDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * isTypeOnly: bool * name: U2 * moduleReference: ModuleReference -> ImportEqualsDeclaration - abstract updateImportEqualsDeclaration: node: ImportEqualsDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * isTypeOnly: bool * name: Identifier * moduleReference: ModuleReference -> ImportEqualsDeclaration - abstract createImportDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * importClause: ImportClause option * moduleSpecifier: Expression * ?assertClause: AssertClause -> ImportDeclaration - abstract updateImportDeclaration: node: ImportDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * importClause: ImportClause option * moduleSpecifier: Expression * assertClause: AssertClause option -> ImportDeclaration + abstract createImportEqualsDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * name: U2 * moduleReference: ModuleReference -> ImportEqualsDeclaration + abstract updateImportEqualsDeclaration: node: ImportEqualsDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * name: Identifier * moduleReference: ModuleReference -> ImportEqualsDeclaration + abstract createImportDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * ?assertClause: AssertClause -> ImportDeclaration + abstract updateImportDeclaration: node: ImportDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * assertClause: AssertClause option -> ImportDeclaration abstract createImportClause: isTypeOnly: bool * name: Identifier option * namedBindings: NamedImportBindings option -> ImportClause abstract updateImportClause: node: ImportClause * isTypeOnly: bool * name: Identifier option * namedBindings: NamedImportBindings option -> ImportClause - abstract createAssertClause: elements: ResizeArray * ?multiLine: bool -> AssertClause - abstract updateAssertClause: node: AssertClause * elements: ResizeArray * ?multiLine: bool -> AssertClause - abstract createAssertEntry: name: AssertionKey * value: StringLiteral -> AssertEntry - abstract updateAssertEntry: node: AssertEntry * name: AssertionKey * value: StringLiteral -> AssertEntry + abstract createAssertClause: elements: AssertEntry[] * ?multiLine: bool -> AssertClause + abstract updateAssertClause: node: AssertClause * elements: AssertEntry[] * ?multiLine: bool -> AssertClause + abstract createAssertEntry: name: AssertionKey * value: Expression -> AssertEntry + abstract updateAssertEntry: node: AssertEntry * name: AssertionKey * value: Expression -> AssertEntry abstract createNamespaceImport: name: Identifier -> NamespaceImport abstract updateNamespaceImport: node: NamespaceImport * name: Identifier -> NamespaceImport abstract createNamespaceExport: name: Identifier -> NamespaceExport abstract updateNamespaceExport: node: NamespaceExport * name: Identifier -> NamespaceExport - abstract createNamedImports: elements: ResizeArray -> NamedImports - abstract updateNamedImports: node: NamedImports * elements: ResizeArray -> NamedImports + abstract createNamedImports: elements: ImportSpecifier[] -> NamedImports + abstract updateNamedImports: node: NamedImports * elements: ImportSpecifier[] -> NamedImports abstract createImportSpecifier: isTypeOnly: bool * propertyName: Identifier option * name: Identifier -> ImportSpecifier abstract updateImportSpecifier: node: ImportSpecifier * isTypeOnly: bool * propertyName: Identifier option * name: Identifier -> ImportSpecifier - abstract createExportAssignment: decorators: ResizeArray option * modifiers: ResizeArray option * isExportEquals: bool option * expression: Expression -> ExportAssignment - abstract updateExportAssignment: node: ExportAssignment * decorators: ResizeArray option * modifiers: ResizeArray option * expression: Expression -> ExportAssignment - abstract createExportDeclaration: decorators: ResizeArray option * modifiers: ResizeArray option * isTypeOnly: bool * exportClause: NamedExportBindings option * ?moduleSpecifier: Expression * ?assertClause: AssertClause -> ExportDeclaration - abstract updateExportDeclaration: node: ExportDeclaration * decorators: ResizeArray option * modifiers: ResizeArray option * isTypeOnly: bool * exportClause: NamedExportBindings option * moduleSpecifier: Expression option * assertClause: AssertClause option -> ExportDeclaration - abstract createNamedExports: elements: ResizeArray -> NamedExports - abstract updateNamedExports: node: NamedExports * elements: ResizeArray -> NamedExports + abstract createExportAssignment: decorators: Decorator[] option * modifiers: Modifier[] option * isExportEquals: bool option * expression: Expression -> ExportAssignment + abstract updateExportAssignment: node: ExportAssignment * decorators: Decorator[] option * modifiers: Modifier[] option * expression: Expression -> ExportAssignment + abstract createExportDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * ?moduleSpecifier: Expression * ?assertClause: AssertClause -> ExportDeclaration + abstract updateExportDeclaration: node: ExportDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * moduleSpecifier: Expression option * assertClause: AssertClause option -> ExportDeclaration + abstract createNamedExports: elements: ExportSpecifier[] -> NamedExports + abstract updateNamedExports: node: NamedExports * elements: ExportSpecifier[] -> NamedExports abstract createExportSpecifier: isTypeOnly: bool * propertyName: U2 option * name: U2 -> ExportSpecifier abstract updateExportSpecifier: node: ExportSpecifier * isTypeOnly: bool * propertyName: Identifier option * name: Identifier -> ExportSpecifier abstract createExternalModuleReference: expression: Expression -> ExternalModuleReference @@ -5281,8 +6035,8 @@ module Ts = abstract updateJSDocNullableType: node: JSDocNullableType * ``type``: TypeNode -> JSDocNullableType abstract createJSDocOptionalType: ``type``: TypeNode -> JSDocOptionalType abstract updateJSDocOptionalType: node: JSDocOptionalType * ``type``: TypeNode -> JSDocOptionalType - abstract createJSDocFunctionType: parameters: ResizeArray * ``type``: TypeNode option -> JSDocFunctionType - abstract updateJSDocFunctionType: node: JSDocFunctionType * parameters: ResizeArray * ``type``: TypeNode option -> JSDocFunctionType + abstract createJSDocFunctionType: parameters: ParameterDeclaration[] * ``type``: TypeNode option -> JSDocFunctionType + abstract updateJSDocFunctionType: node: JSDocFunctionType * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> JSDocFunctionType abstract createJSDocVariadicType: ``type``: TypeNode -> JSDocVariadicType abstract updateJSDocVariadicType: node: JSDocVariadicType * ``type``: TypeNode -> JSDocVariadicType abstract createJSDocNamepathType: ``type``: TypeNode -> JSDocNamepathType @@ -5299,84 +6053,84 @@ module Ts = abstract updateJSDocLinkCode: node: JSDocLinkCode * name: U2 option * text: string -> JSDocLinkCode abstract createJSDocLinkPlain: name: U2 option * text: string -> JSDocLinkPlain abstract updateJSDocLinkPlain: node: JSDocLinkPlain * name: U2 option * text: string -> JSDocLinkPlain - abstract createJSDocTypeLiteral: ?jsDocPropertyTags: ResizeArray * ?isArrayType: bool -> JSDocTypeLiteral - abstract updateJSDocTypeLiteral: node: JSDocTypeLiteral * jsDocPropertyTags: ResizeArray option * isArrayType: bool option -> JSDocTypeLiteral - abstract createJSDocSignature: typeParameters: ResizeArray option * parameters: ResizeArray * ?``type``: JSDocReturnTag -> JSDocSignature - abstract updateJSDocSignature: node: JSDocSignature * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: JSDocReturnTag option -> JSDocSignature - abstract createJSDocTemplateTag: tagName: Identifier option * ``constraint``: JSDocTypeExpression option * typeParameters: ResizeArray * ?comment: U2> -> JSDocTemplateTag - abstract updateJSDocTemplateTag: node: JSDocTemplateTag * tagName: Identifier option * ``constraint``: JSDocTypeExpression option * typeParameters: ResizeArray * comment: U2> option -> JSDocTemplateTag - abstract createJSDocTypedefTag: tagName: Identifier option * ?typeExpression: U2 * ?fullName: U2 * ?comment: U2> -> JSDocTypedefTag - abstract updateJSDocTypedefTag: node: JSDocTypedefTag * tagName: Identifier option * typeExpression: U2 option * fullName: U2 option * comment: U2> option -> JSDocTypedefTag - abstract createJSDocParameterTag: tagName: Identifier option * name: EntityName * isBracketed: bool * ?typeExpression: JSDocTypeExpression * ?isNameFirst: bool * ?comment: U2> -> JSDocParameterTag - abstract updateJSDocParameterTag: node: JSDocParameterTag * tagName: Identifier option * name: EntityName * isBracketed: bool * typeExpression: JSDocTypeExpression option * isNameFirst: bool * comment: U2> option -> JSDocParameterTag - abstract createJSDocPropertyTag: tagName: Identifier option * name: EntityName * isBracketed: bool * ?typeExpression: JSDocTypeExpression * ?isNameFirst: bool * ?comment: U2> -> JSDocPropertyTag - abstract updateJSDocPropertyTag: node: JSDocPropertyTag * tagName: Identifier option * name: EntityName * isBracketed: bool * typeExpression: JSDocTypeExpression option * isNameFirst: bool * comment: U2> option -> JSDocPropertyTag - abstract createJSDocTypeTag: tagName: Identifier option * typeExpression: JSDocTypeExpression * ?comment: U2> -> JSDocTypeTag - abstract updateJSDocTypeTag: node: JSDocTypeTag * tagName: Identifier option * typeExpression: JSDocTypeExpression * comment: U2> option -> JSDocTypeTag - abstract createJSDocSeeTag: tagName: Identifier option * nameExpression: JSDocNameReference option * ?comment: U2> -> JSDocSeeTag - abstract updateJSDocSeeTag: node: JSDocSeeTag * tagName: Identifier option * nameExpression: JSDocNameReference option * ?comment: U2> -> JSDocSeeTag - abstract createJSDocReturnTag: tagName: Identifier option * ?typeExpression: JSDocTypeExpression * ?comment: U2> -> JSDocReturnTag - abstract updateJSDocReturnTag: node: JSDocReturnTag * tagName: Identifier option * typeExpression: JSDocTypeExpression option * comment: U2> option -> JSDocReturnTag - abstract createJSDocThisTag: tagName: Identifier option * typeExpression: JSDocTypeExpression * ?comment: U2> -> JSDocThisTag - abstract updateJSDocThisTag: node: JSDocThisTag * tagName: Identifier option * typeExpression: JSDocTypeExpression option * comment: U2> option -> JSDocThisTag - abstract createJSDocEnumTag: tagName: Identifier option * typeExpression: JSDocTypeExpression * ?comment: U2> -> JSDocEnumTag - abstract updateJSDocEnumTag: node: JSDocEnumTag * tagName: Identifier option * typeExpression: JSDocTypeExpression * comment: U2> option -> JSDocEnumTag - abstract createJSDocCallbackTag: tagName: Identifier option * typeExpression: JSDocSignature * ?fullName: U2 * ?comment: U2> -> JSDocCallbackTag - abstract updateJSDocCallbackTag: node: JSDocCallbackTag * tagName: Identifier option * typeExpression: JSDocSignature * fullName: U2 option * comment: U2> option -> JSDocCallbackTag - abstract createJSDocAugmentsTag: tagName: Identifier option * className: JSDocAugmentsTag * ?comment: U2> -> JSDocAugmentsTag - abstract updateJSDocAugmentsTag: node: JSDocAugmentsTag * tagName: Identifier option * className: JSDocAugmentsTag * comment: U2> option -> JSDocAugmentsTag - abstract createJSDocImplementsTag: tagName: Identifier option * className: JSDocImplementsTag * ?comment: U2> -> JSDocImplementsTag - abstract updateJSDocImplementsTag: node: JSDocImplementsTag * tagName: Identifier option * className: JSDocImplementsTag * comment: U2> option -> JSDocImplementsTag - abstract createJSDocAuthorTag: tagName: Identifier option * ?comment: U2> -> JSDocAuthorTag - abstract updateJSDocAuthorTag: node: JSDocAuthorTag * tagName: Identifier option * comment: U2> option -> JSDocAuthorTag - abstract createJSDocClassTag: tagName: Identifier option * ?comment: U2> -> JSDocClassTag - abstract updateJSDocClassTag: node: JSDocClassTag * tagName: Identifier option * comment: U2> option -> JSDocClassTag - abstract createJSDocPublicTag: tagName: Identifier option * ?comment: U2> -> JSDocPublicTag - abstract updateJSDocPublicTag: node: JSDocPublicTag * tagName: Identifier option * comment: U2> option -> JSDocPublicTag - abstract createJSDocPrivateTag: tagName: Identifier option * ?comment: U2> -> JSDocPrivateTag - abstract updateJSDocPrivateTag: node: JSDocPrivateTag * tagName: Identifier option * comment: U2> option -> JSDocPrivateTag - abstract createJSDocProtectedTag: tagName: Identifier option * ?comment: U2> -> JSDocProtectedTag - abstract updateJSDocProtectedTag: node: JSDocProtectedTag * tagName: Identifier option * comment: U2> option -> JSDocProtectedTag - abstract createJSDocReadonlyTag: tagName: Identifier option * ?comment: U2> -> JSDocReadonlyTag - abstract updateJSDocReadonlyTag: node: JSDocReadonlyTag * tagName: Identifier option * comment: U2> option -> JSDocReadonlyTag - abstract createJSDocUnknownTag: tagName: Identifier * ?comment: U2> -> JSDocUnknownTag - abstract updateJSDocUnknownTag: node: JSDocUnknownTag * tagName: Identifier * comment: U2> option -> JSDocUnknownTag - abstract createJSDocDeprecatedTag: tagName: Identifier * ?comment: U2> -> JSDocDeprecatedTag - abstract updateJSDocDeprecatedTag: node: JSDocDeprecatedTag * tagName: Identifier * ?comment: U2> -> JSDocDeprecatedTag - abstract createJSDocOverrideTag: tagName: Identifier * ?comment: U2> -> JSDocOverrideTag - abstract updateJSDocOverrideTag: node: JSDocOverrideTag * tagName: Identifier * ?comment: U2> -> JSDocOverrideTag + abstract createJSDocTypeLiteral: ?jsDocPropertyTags: JSDocPropertyLikeTag[] * ?isArrayType: bool -> JSDocTypeLiteral + abstract updateJSDocTypeLiteral: node: JSDocTypeLiteral * jsDocPropertyTags: JSDocPropertyLikeTag[] option * isArrayType: bool option -> JSDocTypeLiteral + abstract createJSDocSignature: typeParameters: JSDocTemplateTag[] option * parameters: JSDocParameterTag[] * ?``type``: JSDocReturnTag -> JSDocSignature + abstract updateJSDocSignature: node: JSDocSignature * typeParameters: JSDocTemplateTag[] option * parameters: JSDocParameterTag[] * ``type``: JSDocReturnTag option -> JSDocSignature + abstract createJSDocTemplateTag: tagName: Identifier option * ``constraint``: JSDocTypeExpression option * typeParameters: TypeParameterDeclaration[] * ?comment: U2 -> JSDocTemplateTag + abstract updateJSDocTemplateTag: node: JSDocTemplateTag * tagName: Identifier option * ``constraint``: JSDocTypeExpression option * typeParameters: TypeParameterDeclaration[] * comment: U2 option -> JSDocTemplateTag + abstract createJSDocTypedefTag: tagName: Identifier option * ?typeExpression: U2 * ?fullName: U2 * ?comment: U2 -> JSDocTypedefTag + abstract updateJSDocTypedefTag: node: JSDocTypedefTag * tagName: Identifier option * typeExpression: U2 option * fullName: U2 option * comment: U2 option -> JSDocTypedefTag + abstract createJSDocParameterTag: tagName: Identifier option * name: EntityName * isBracketed: bool * ?typeExpression: JSDocTypeExpression * ?isNameFirst: bool * ?comment: U2 -> JSDocParameterTag + abstract updateJSDocParameterTag: node: JSDocParameterTag * tagName: Identifier option * name: EntityName * isBracketed: bool * typeExpression: JSDocTypeExpression option * isNameFirst: bool * comment: U2 option -> JSDocParameterTag + abstract createJSDocPropertyTag: tagName: Identifier option * name: EntityName * isBracketed: bool * ?typeExpression: JSDocTypeExpression * ?isNameFirst: bool * ?comment: U2 -> JSDocPropertyTag + abstract updateJSDocPropertyTag: node: JSDocPropertyTag * tagName: Identifier option * name: EntityName * isBracketed: bool * typeExpression: JSDocTypeExpression option * isNameFirst: bool * comment: U2 option -> JSDocPropertyTag + abstract createJSDocTypeTag: tagName: Identifier option * typeExpression: JSDocTypeExpression * ?comment: U2 -> JSDocTypeTag + abstract updateJSDocTypeTag: node: JSDocTypeTag * tagName: Identifier option * typeExpression: JSDocTypeExpression * comment: U2 option -> JSDocTypeTag + abstract createJSDocSeeTag: tagName: Identifier option * nameExpression: JSDocNameReference option * ?comment: U2 -> JSDocSeeTag + abstract updateJSDocSeeTag: node: JSDocSeeTag * tagName: Identifier option * nameExpression: JSDocNameReference option * ?comment: U2 -> JSDocSeeTag + abstract createJSDocReturnTag: tagName: Identifier option * ?typeExpression: JSDocTypeExpression * ?comment: U2 -> JSDocReturnTag + abstract updateJSDocReturnTag: node: JSDocReturnTag * tagName: Identifier option * typeExpression: JSDocTypeExpression option * comment: U2 option -> JSDocReturnTag + abstract createJSDocThisTag: tagName: Identifier option * typeExpression: JSDocTypeExpression * ?comment: U2 -> JSDocThisTag + abstract updateJSDocThisTag: node: JSDocThisTag * tagName: Identifier option * typeExpression: JSDocTypeExpression option * comment: U2 option -> JSDocThisTag + abstract createJSDocEnumTag: tagName: Identifier option * typeExpression: JSDocTypeExpression * ?comment: U2 -> JSDocEnumTag + abstract updateJSDocEnumTag: node: JSDocEnumTag * tagName: Identifier option * typeExpression: JSDocTypeExpression * comment: U2 option -> JSDocEnumTag + abstract createJSDocCallbackTag: tagName: Identifier option * typeExpression: JSDocSignature * ?fullName: U2 * ?comment: U2 -> JSDocCallbackTag + abstract updateJSDocCallbackTag: node: JSDocCallbackTag * tagName: Identifier option * typeExpression: JSDocSignature * fullName: U2 option * comment: U2 option -> JSDocCallbackTag + abstract createJSDocAugmentsTag: tagName: Identifier option * className: obj * ?comment: U2 -> JSDocAugmentsTag + abstract updateJSDocAugmentsTag: node: JSDocAugmentsTag * tagName: Identifier option * className: obj * comment: U2 option -> JSDocAugmentsTag + abstract createJSDocImplementsTag: tagName: Identifier option * className: obj * ?comment: U2 -> JSDocImplementsTag + abstract updateJSDocImplementsTag: node: JSDocImplementsTag * tagName: Identifier option * className: obj * comment: U2 option -> JSDocImplementsTag + abstract createJSDocAuthorTag: tagName: Identifier option * ?comment: U2 -> JSDocAuthorTag + abstract updateJSDocAuthorTag: node: JSDocAuthorTag * tagName: Identifier option * comment: U2 option -> JSDocAuthorTag + abstract createJSDocClassTag: tagName: Identifier option * ?comment: U2 -> JSDocClassTag + abstract updateJSDocClassTag: node: JSDocClassTag * tagName: Identifier option * comment: U2 option -> JSDocClassTag + abstract createJSDocPublicTag: tagName: Identifier option * ?comment: U2 -> JSDocPublicTag + abstract updateJSDocPublicTag: node: JSDocPublicTag * tagName: Identifier option * comment: U2 option -> JSDocPublicTag + abstract createJSDocPrivateTag: tagName: Identifier option * ?comment: U2 -> JSDocPrivateTag + abstract updateJSDocPrivateTag: node: JSDocPrivateTag * tagName: Identifier option * comment: U2 option -> JSDocPrivateTag + abstract createJSDocProtectedTag: tagName: Identifier option * ?comment: U2 -> JSDocProtectedTag + abstract updateJSDocProtectedTag: node: JSDocProtectedTag * tagName: Identifier option * comment: U2 option -> JSDocProtectedTag + abstract createJSDocReadonlyTag: tagName: Identifier option * ?comment: U2 -> JSDocReadonlyTag + abstract updateJSDocReadonlyTag: node: JSDocReadonlyTag * tagName: Identifier option * comment: U2 option -> JSDocReadonlyTag + abstract createJSDocUnknownTag: tagName: Identifier * ?comment: U2 -> JSDocUnknownTag + abstract updateJSDocUnknownTag: node: JSDocUnknownTag * tagName: Identifier * comment: U2 option -> JSDocUnknownTag + abstract createJSDocDeprecatedTag: tagName: Identifier * ?comment: U2 -> JSDocDeprecatedTag + abstract updateJSDocDeprecatedTag: node: JSDocDeprecatedTag * tagName: Identifier * ?comment: U2 -> JSDocDeprecatedTag + abstract createJSDocOverrideTag: tagName: Identifier * ?comment: U2 -> JSDocOverrideTag + abstract updateJSDocOverrideTag: node: JSDocOverrideTag * tagName: Identifier * ?comment: U2 -> JSDocOverrideTag abstract createJSDocText: text: string -> JSDocText abstract updateJSDocText: node: JSDocText * text: string -> JSDocText - abstract createJSDocComment: ?comment: U2> * ?tags: ResizeArray -> JSDoc - abstract updateJSDocComment: node: JSDoc * comment: U2> option * tags: ResizeArray option -> JSDoc - abstract createJsxElement: openingElement: JsxOpeningElement * children: ResizeArray * closingElement: JsxClosingElement -> JsxElement - abstract updateJsxElement: node: JsxElement * openingElement: JsxOpeningElement * children: ResizeArray * closingElement: JsxClosingElement -> JsxElement - abstract createJsxSelfClosingElement: tagName: JsxTagNameExpression * typeArguments: ResizeArray option * attributes: JsxAttributes -> JsxSelfClosingElement - abstract updateJsxSelfClosingElement: node: JsxSelfClosingElement * tagName: JsxTagNameExpression * typeArguments: ResizeArray option * attributes: JsxAttributes -> JsxSelfClosingElement - abstract createJsxOpeningElement: tagName: JsxTagNameExpression * typeArguments: ResizeArray option * attributes: JsxAttributes -> JsxOpeningElement - abstract updateJsxOpeningElement: node: JsxOpeningElement * tagName: JsxTagNameExpression * typeArguments: ResizeArray option * attributes: JsxAttributes -> JsxOpeningElement + abstract createJSDocComment: ?comment: U2 * ?tags: JSDocTag[] -> JSDoc + abstract updateJSDocComment: node: JSDoc * comment: U2 option * tags: JSDocTag[] option -> JSDoc + abstract createJsxElement: openingElement: JsxOpeningElement * children: JsxChild[] * closingElement: JsxClosingElement -> JsxElement + abstract updateJsxElement: node: JsxElement * openingElement: JsxOpeningElement * children: JsxChild[] * closingElement: JsxClosingElement -> JsxElement + abstract createJsxSelfClosingElement: tagName: JsxTagNameExpression * typeArguments: TypeNode[] option * attributes: JsxAttributes -> JsxSelfClosingElement + abstract updateJsxSelfClosingElement: node: JsxSelfClosingElement * tagName: JsxTagNameExpression * typeArguments: TypeNode[] option * attributes: JsxAttributes -> JsxSelfClosingElement + abstract createJsxOpeningElement: tagName: JsxTagNameExpression * typeArguments: TypeNode[] option * attributes: JsxAttributes -> JsxOpeningElement + abstract updateJsxOpeningElement: node: JsxOpeningElement * tagName: JsxTagNameExpression * typeArguments: TypeNode[] option * attributes: JsxAttributes -> JsxOpeningElement abstract createJsxClosingElement: tagName: JsxTagNameExpression -> JsxClosingElement abstract updateJsxClosingElement: node: JsxClosingElement * tagName: JsxTagNameExpression -> JsxClosingElement - abstract createJsxFragment: openingFragment: JsxOpeningFragment * children: ResizeArray * closingFragment: JsxClosingFragment -> JsxFragment + abstract createJsxFragment: openingFragment: JsxOpeningFragment * children: JsxChild[] * closingFragment: JsxClosingFragment -> JsxFragment abstract createJsxText: text: string * ?containsOnlyTriviaWhiteSpaces: bool -> JsxText abstract updateJsxText: node: JsxText * text: string * ?containsOnlyTriviaWhiteSpaces: bool -> JsxText abstract createJsxOpeningFragment: unit -> JsxOpeningFragment abstract createJsxJsxClosingFragment: unit -> JsxClosingFragment - abstract updateJsxFragment: node: JsxFragment * openingFragment: JsxOpeningFragment * children: ResizeArray * closingFragment: JsxClosingFragment -> JsxFragment + abstract updateJsxFragment: node: JsxFragment * openingFragment: JsxOpeningFragment * children: JsxChild[] * closingFragment: JsxClosingFragment -> JsxFragment abstract createJsxAttribute: name: Identifier * initializer: U2 option -> JsxAttribute abstract updateJsxAttribute: node: JsxAttribute * name: Identifier * initializer: U2 option -> JsxAttribute - abstract createJsxAttributes: properties: ResizeArray -> JsxAttributes - abstract updateJsxAttributes: node: JsxAttributes * properties: ResizeArray -> JsxAttributes + abstract createJsxAttributes: properties: JsxAttributeLike[] -> JsxAttributes + abstract updateJsxAttributes: node: JsxAttributes * properties: JsxAttributeLike[] -> JsxAttributes abstract createJsxSpreadAttribute: expression: Expression -> JsxSpreadAttribute abstract updateJsxSpreadAttribute: node: JsxSpreadAttribute * expression: Expression -> JsxSpreadAttribute abstract createJsxExpression: dotDotDotToken: DotDotDotToken option * expression: Expression option -> JsxExpression abstract updateJsxExpression: node: JsxExpression * expression: Expression option -> JsxExpression - abstract createCaseClause: expression: Expression * statements: ResizeArray -> CaseClause - abstract updateCaseClause: node: CaseClause * expression: Expression * statements: ResizeArray -> CaseClause - abstract createDefaultClause: statements: ResizeArray -> DefaultClause - abstract updateDefaultClause: node: DefaultClause * statements: ResizeArray -> DefaultClause - abstract createHeritageClause: token: HeritageClause * types: ResizeArray -> HeritageClause - abstract updateHeritageClause: node: HeritageClause * types: ResizeArray -> HeritageClause + abstract createCaseClause: expression: Expression * statements: Statement[] -> CaseClause + abstract updateCaseClause: node: CaseClause * expression: Expression * statements: Statement[] -> CaseClause + abstract createDefaultClause: statements: Statement[] -> DefaultClause + abstract updateDefaultClause: node: DefaultClause * statements: Statement[] -> DefaultClause + abstract createHeritageClause: token: obj * types: ExpressionWithTypeArguments[] -> HeritageClause + abstract updateHeritageClause: node: HeritageClause * types: ExpressionWithTypeArguments[] -> HeritageClause abstract createCatchClause: variableDeclaration: U3 option * block: Block -> CatchClause abstract updateCatchClause: node: CatchClause * variableDeclaration: VariableDeclaration option * block: Block -> CatchClause abstract createPropertyAssignment: name: U2 * initializer: Expression -> PropertyAssignment @@ -5387,15 +6141,15 @@ module Ts = abstract updateSpreadAssignment: node: SpreadAssignment * expression: Expression -> SpreadAssignment abstract createEnumMember: name: U2 * ?initializer: Expression -> EnumMember abstract updateEnumMember: node: EnumMember * name: PropertyName * initializer: Expression option -> EnumMember - abstract createSourceFile: statements: ResizeArray * endOfFileToken: EndOfFileToken * flags: NodeFlags -> SourceFile - abstract updateSourceFile: node: SourceFile * statements: ResizeArray * ?isDeclarationFile: bool * ?referencedFiles: ResizeArray * ?typeReferences: ResizeArray * ?hasNoDefaultLib: bool * ?libReferences: ResizeArray -> SourceFile + abstract createSourceFile: statements: Statement[] * endOfFileToken: EndOfFileToken * flags: NodeFlags -> SourceFile + abstract updateSourceFile: node: SourceFile * statements: Statement[] * ?isDeclarationFile: bool * ?referencedFiles: FileReference[] * ?typeReferences: FileReference[] * ?hasNoDefaultLib: bool * ?libReferences: FileReference[] -> SourceFile abstract createNotEmittedStatement: original: Node -> NotEmittedStatement abstract createPartiallyEmittedExpression: expression: Expression * ?original: Node -> PartiallyEmittedExpression abstract updatePartiallyEmittedExpression: node: PartiallyEmittedExpression * expression: Expression -> PartiallyEmittedExpression - abstract createCommaListExpression: elements: ResizeArray -> CommaListExpression - abstract updateCommaListExpression: node: CommaListExpression * elements: ResizeArray -> CommaListExpression - abstract createBundle: sourceFiles: ResizeArray * ?prepends: ResizeArray> -> Bundle - abstract updateBundle: node: Bundle * sourceFiles: ResizeArray * ?prepends: ResizeArray> -> Bundle + abstract createCommaListExpression: elements: Expression[] -> CommaListExpression + abstract updateCommaListExpression: node: CommaListExpression * elements: Expression[] -> CommaListExpression + abstract createBundle: sourceFiles: SourceFile[] * ?prepends: U2[] -> Bundle + abstract updateBundle: node: Bundle * sourceFiles: SourceFile[] * ?prepends: U2[] -> Bundle abstract createComma: left: Expression * right: Expression -> BinaryExpression abstract createAssignment: left: U2 * right: Expression -> DestructuringAssignment abstract createAssignment: left: Expression * right: Expression -> AssignmentExpression @@ -5429,10 +6183,10 @@ module Ts = abstract createLogicalNot: operand: Expression -> PrefixUnaryExpression abstract createPostfixIncrement: operand: Expression -> PostfixUnaryExpression abstract createPostfixDecrement: operand: Expression -> PostfixUnaryExpression - abstract createImmediatelyInvokedFunctionExpression: statements: ResizeArray -> CallExpression - abstract createImmediatelyInvokedFunctionExpression: statements: ResizeArray * param: ParameterDeclaration * paramValue: Expression -> CallExpression - abstract createImmediatelyInvokedArrowFunction: statements: ResizeArray -> CallExpression - abstract createImmediatelyInvokedArrowFunction: statements: ResizeArray * param: ParameterDeclaration * paramValue: Expression -> CallExpression + abstract createImmediatelyInvokedFunctionExpression: statements: Statement[] -> CallExpression + abstract createImmediatelyInvokedFunctionExpression: statements: Statement[] * param: ParameterDeclaration * paramValue: Expression -> CallExpression + abstract createImmediatelyInvokedArrowFunction: statements: Statement[] -> CallExpression + abstract createImmediatelyInvokedArrowFunction: statements: Statement[] * param: ParameterDeclaration * paramValue: Expression -> CallExpression abstract createVoidZero: unit -> VoidExpression abstract createExportDefault: expression: Expression -> ExportAssignment abstract createExternalModuleExport: exportName: Identifier -> ExportDeclaration @@ -5449,7 +6203,7 @@ module Ts = /// Resumes a suspended lexical environment, usually before visiting a function body. abstract resumeLexicalEnvironment: unit -> unit /// Ends a lexical environment, returning any declarations. - abstract endLexicalEnvironment: unit -> ResizeArray option + abstract endLexicalEnvironment: unit -> Statement[] option /// Hoists a function declaration to the containing scope. abstract hoistFunctionDeclaration: node: FunctionDeclaration -> unit /// Hoists a variable declaration to the containing scope. @@ -5460,16 +6214,18 @@ module Ts = /// Records a request for a non-scoped emit helper in the current context. abstract requestEmitHelper: helper: EmitHelper -> unit /// Gets and resets the requested non-scoped emit helpers. - abstract readEmitHelpers: unit -> ResizeArray option + abstract readEmitHelpers: unit -> EmitHelper[] option /// Enables expression substitutions in the pretty printer for the provided SyntaxKind. abstract enableSubstitution: kind: SyntaxKind -> unit /// Determines whether expression substitutions are enabled for the provided node. abstract isSubstitutionEnabled: node: Node -> bool + /// /// Hook used by transformers to substitute expressions just before they /// are emitted by the pretty printer. /// - /// NOTE: Transformation hooks should only be modified during `Transformer` initialization, - /// before returning the `NodeTransformer` callback. + /// NOTE: Transformation hooks should only be modified during Transformer initialization, + /// before returning the NodeTransformer callback. + /// abstract onSubstituteNode: (EmitHint -> Node -> Node) with get, set /// Enables before/after emit notifications in the pretty printer for the provided /// SyntaxKind. @@ -5477,18 +6233,20 @@ module Ts = /// Determines whether before/after emit notifications should be raised in the pretty /// printer when it emits a node. abstract isEmitNotificationEnabled: node: Node -> bool + /// /// Hook used to allow transformers to capture state before or after /// the printer emits a node. /// - /// NOTE: Transformation hooks should only be modified during `Transformer` initialization, - /// before returning the `NodeTransformer` callback. + /// NOTE: Transformation hooks should only be modified during Transformer initialization, + /// before returning the NodeTransformer callback. + /// abstract onEmitNode: (EmitHint -> Node -> (EmitHint -> Node -> unit) -> unit) with get, set type [] TransformationResult<'T> = /// Gets the transformed source files. - abstract transformed: ResizeArray<'T> with get, set + abstract transformed: 'T[] with get, set /// Gets diagnostics for the transformation. - abstract diagnostics: ResizeArray option with get, set + abstract diagnostics: DiagnosticWithLocation[] option with get, set /// Gets a substitute for a node, if one is available; otherwise, returns the original node. /// A hint as to the intended usage of the node. /// The node to substitute. @@ -5504,41 +6262,59 @@ module Ts = /// Clean up EmitNode entries on any parse-tree nodes. abstract dispose: unit -> unit + /// + /// A function that is used to initialize and return a Transformer callback, which in turn + /// will be used to transform one or more nodes. + /// type [] TransformerFactory<'T> = + /// + /// A function that is used to initialize and return a Transformer callback, which in turn + /// will be used to transform one or more nodes. + /// [] abstract Invoke: context: TransformationContext -> Transformer<'T> + /// A function that transforms a node. type [] Transformer<'T> = + /// A function that transforms a node. [] abstract Invoke: node: 'T -> 'T + /// A function that accepts and possibly transforms a node. type [] Visitor = + /// A function that accepts and possibly transforms a node. [] abstract Invoke: node: Node -> VisitResult type [] NodeVisitor = - [] abstract Invoke: nodes: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (ResizeArray -> 'T) -> 'T - [] abstract Invoke: nodes: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (ResizeArray -> 'T) -> 'T option + [] abstract Invoke: nodes: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T + [] abstract Invoke: nodes: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option type [] NodesVisitor = - [] abstract Invoke: nodes: ResizeArray<'T> * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> ResizeArray<'T> - [] abstract Invoke: nodes: ResizeArray<'T> option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> ResizeArray<'T> option + [] abstract Invoke: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] + [] abstract Invoke: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option type VisitResult<'T> = - U2<'T, ResizeArray<'T>> option + U2<'T, 'T[]> option type [] Printer = /// Print a node and its subtree as-is, without any emit transformations. - /// A value indicating the purpose of a node. This is primarily used to - /// distinguish between an `Identifier` used in an expression position, versus an - /// `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you - /// should just pass `Unspecified`. - /// The node to print. The node and its subtree are printed as-is, without any - /// emit transformations. - /// A source file that provides context for the node. The source text of + /// + /// A value indicating the purpose of a node. This is primarily used to + /// distinguish between an Identifier used in an expression position, versus an + /// Identifier used as an IdentifierName as part of a declaration. For most nodes you + /// should just pass Unspecified. + /// + /// + /// The node to print. The node and its subtree are printed as-is, without any + /// emit transformations. + /// + /// + /// A source file that provides context for the node. The source text of /// the file is used to emit the original source content for literals and identifiers, while /// the identifiers of the source file are used when generating unique names to avoid - /// collisions. + /// collisions. + /// abstract printNode: hint: EmitHint * node: Node * sourceFile: SourceFile -> string /// Prints a list of nodes using the given format flags - abstract printList: format: ListFormat * list: ResizeArray<'T> * sourceFile: SourceFile -> string + abstract printList: format: ListFormat * list: 'T[] * sourceFile: SourceFile -> string /// Prints a source file as-is, without any emit transformations. abstract printFile: sourceFile: SourceFile -> string /// Prints a bundle of source files as-is, without any emit transformations. @@ -5548,21 +6324,46 @@ module Ts = /// A hook used by the Printer when generating unique names to avoid collisions with /// globally defined names that exist outside of the current source file. abstract hasGlobalName: name: string -> bool - /// A hook used by the Printer to provide notifications prior to emitting a node. A - /// compatible implementation **must** invoke `emitCallback` with the provided `hint` and - /// `node` values. + /// + /// A hook used by the Printer to provide notifications prior to emitting a node. A + /// compatible implementation **must** invoke emitCallback with the provided hint and + /// node values. + /// /// A hint indicating the intended purpose of the node. /// The node to emit. /// A callback that, when invoked, will emit the node. + /// + /// + /// var printer = createPrinter(printerOptions, { + /// onEmitNode(hint, node, emitCallback) { + /// // set up or track state prior to emitting the node... + /// emitCallback(hint, node); + /// // restore state after emitting the node... + /// } + /// }); + /// + /// abstract onEmitNode: hint: EmitHint * node: Node * emitCallback: (EmitHint -> Node -> unit) -> unit /// A hook used to check if an emit notification is required for a node. /// The node to emit. abstract isEmitNotificationEnabled: node: Node -> bool - /// A hook used by the Printer to perform just-in-time substitution of a node. This is + /// + /// A hook used by the Printer to perform just-in-time substitution of a node. This is /// primarily used by node transformations that need to substitute one node for another, - /// such as replacing `myExportedVar` with `exports.myExportedVar`. + /// such as replacing myExportedVar with exports.myExportedVar. + /// /// A hint indicating the intended purpose of the node. /// The node to emit. + /// + /// + /// var printer = createPrinter(printerOptions, { + /// substituteNode(hint, node) { + /// // perform substitution if necessary... + /// return node; + /// } + /// }); + /// + /// abstract substituteNode: hint: EmitHint * node: Node -> Node type [] PrinterOptions = @@ -5586,7 +6387,7 @@ module Ts = type [] SyntaxList = inherit Node abstract kind: SyntaxKind with get, set - abstract _children: ResizeArray with get, set + abstract _children: Node[] with get, set type [] ListFormat = | None = 0 @@ -5669,7 +6470,7 @@ module Ts = abstract includeCompletionsWithClassMemberSnippets: bool option abstract allowIncompleteCompletions: bool option abstract importModuleSpecifierPreference: UserPreferencesImportModuleSpecifierPreference option - /// Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" + /// Determines whether we import foo/index.ts as "foo", "foo/index", or "foo/index.js" abstract importModuleSpecifierEnding: UserPreferencesImportModuleSpecifierEnding option abstract allowTextChangesInNewFiles: bool option abstract providePrefixAndSuffixTextForRename: bool option @@ -5694,7 +6495,7 @@ module Ts = [] abstract Invoke: fileName: string -> unit type [] System = - abstract args: ResizeArray with get, set + abstract args: string[] with get, set abstract newLine: string with get, set abstract useCaseSensitiveFileNames: bool with get, set abstract write: s: string -> unit @@ -5711,19 +6512,19 @@ module Ts = abstract createDirectory: path: string -> unit abstract getExecutingFilePath: unit -> string abstract getCurrentDirectory: unit -> string - abstract getDirectories: path: string -> ResizeArray - abstract readDirectory: path: string * ?extensions: ResizeArray * ?exclude: ResizeArray * ?``include``: ResizeArray * ?depth: float -> ResizeArray + abstract getDirectories: path: string -> string[] + abstract readDirectory: path: string * ?extensions: string[] * ?exclude: string[] * ?``include``: string[] * ?depth: float -> string[] abstract getModifiedTime: path: string -> DateTime option abstract setModifiedTime: path: string * time: DateTime -> unit abstract deleteFile: path: string -> unit - /// A good implementation is node.js' `crypto.createHash`. (https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm) + /// A good implementation is node.js' crypto.createHash. ( abstract createHash: data: string -> string - /// This must be cryptographically secure. Only implement this method using `crypto.createHash("sha256")`. + /// This must be cryptographically secure. Only implement this method using crypto.createHash("sha256"). abstract createSHA256Hash: data: string -> string abstract getMemoryUsage: unit -> float abstract exit: ?exitCode: float -> unit abstract realpath: path: string -> string - abstract setTimeout: callback: (ResizeArray -> unit) * ms: float * [] args: ResizeArray -> obj option + abstract setTimeout: callback: (obj option[] -> unit) * ms: float * [] args: obj option[] -> obj option abstract clearTimeout: timeoutId: obj option -> unit abstract clearScreen: unit -> unit abstract base64decode: input: string -> string @@ -5848,11 +6649,12 @@ module Ts = abstract getCanonicalFileName: fileName: string -> string abstract getNewLine: unit -> string + [] type [] ResolveProjectReferencePathHost = abstract fileExists: fileName: string -> bool type [] EmitOutput = - abstract outputFiles: ResizeArray with get, set + abstract outputFiles: OutputFile[] with get, set abstract emitSkipped: bool with get, set type [] OutputFile = @@ -5861,7 +6663,7 @@ module Ts = abstract text: string with get, set type AffectedFileResult<'T> = - U2<'T, U2> option + {| result: 'T; affected: U2 |} option type [] BuilderProgramHost = /// return true if file names are treated with case sensitivity @@ -5881,26 +6683,26 @@ module Ts = /// Get the source file in the program with file name abstract getSourceFile: fileName: string -> SourceFile option /// Get a list of files in the program - abstract getSourceFiles: unit -> ResizeArray + abstract getSourceFiles: unit -> SourceFile[] /// Get the diagnostics for compiler options - abstract getOptionsDiagnostics: ?cancellationToken: CancellationToken -> ResizeArray + abstract getOptionsDiagnostics: ?cancellationToken: CancellationToken -> Diagnostic[] /// Get the diagnostics that dont belong to any file - abstract getGlobalDiagnostics: ?cancellationToken: CancellationToken -> ResizeArray + abstract getGlobalDiagnostics: ?cancellationToken: CancellationToken -> Diagnostic[] /// Get the diagnostics from config file parsing - abstract getConfigFileParsingDiagnostics: unit -> ResizeArray + abstract getConfigFileParsingDiagnostics: unit -> Diagnostic[] /// Get the syntax diagnostics, for all source files if source file is not supplied - abstract getSyntacticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> ResizeArray + abstract getSyntacticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> Diagnostic[] /// Get the declaration diagnostics, for all source files if source file is not supplied - abstract getDeclarationDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> ResizeArray + abstract getDeclarationDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> DiagnosticWithLocation[] /// Get all the dependencies of the file - abstract getAllDependencies: sourceFile: SourceFile -> ResizeArray + abstract getAllDependencies: sourceFile: SourceFile -> string[] /// Gets the semantic diagnostics from the program corresponding to this state of file (if provided) or whole program /// The semantic diagnostics are cached and managed here /// Note that it is assumed that when asked about semantic diagnostics through this API, /// the file has been taken out of affected files so it is safe to use cache or get from program and cache the diagnostics /// In case of SemanticDiagnosticsBuilderProgram if the source file is not provided, /// it will iterate through all the affected files, to ensure that cache stays valid and yet provide a way to get all semantic diagnostics - abstract getSemanticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> ResizeArray + abstract getSemanticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> Diagnostic[] /// Emits the JavaScript and declaration files. /// When targetSource file is specified, emits the files corresponding to that source file, /// otherwise for the whole program. @@ -5919,7 +6721,7 @@ module Ts = inherit BuilderProgram /// Gets the semantic diagnostics from the program for the next affected file and caches it /// Returns undefined if the iteration is complete - abstract getSemanticDiagnosticsOfNextAffectedFile: ?cancellationToken: CancellationToken * ?ignoreSourceFile: (SourceFile -> bool) -> AffectedFileResult> + abstract getSemanticDiagnosticsOfNextAffectedFile: ?cancellationToken: CancellationToken * ?ignoreSourceFile: (SourceFile -> bool) -> AffectedFileResult /// The builder that can handle the changes in program and iterate through changed file to emit the files /// The semantic diagnostics are cached per file and managed by clearing for the changed/affected files @@ -5936,18 +6738,20 @@ module Ts = abstract readFile: fileName: string -> string option type [] IncrementalProgramOptions<'T> = - abstract rootNames: ResizeArray with get, set + abstract rootNames: string[] with get, set abstract options: CompilerOptions with get, set - abstract configFileParsingDiagnostics: ResizeArray option with get, set - abstract projectReferences: ResizeArray option with get, set + abstract configFileParsingDiagnostics: Diagnostic[] option with get, set + abstract projectReferences: ProjectReference[] option with get, set abstract host: CompilerHost option with get, set abstract createProgram: CreateProgram<'T> option with get, set type [] WatchStatusReporter = [] abstract Invoke: diagnostic: Diagnostic * newLine: string * options: CompilerOptions * ?errorCount: float -> unit + /// Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program type [] CreateProgram<'T> = - [] abstract Invoke: rootNames: ResizeArray option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: 'T * ?configFileParsingDiagnostics: ResizeArray * ?projectReferences: ResizeArray -> 'T + /// Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program + [] abstract Invoke: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: 'T * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> 'T /// Host that has watch functionality used in --watch mode type [] WatchHost = @@ -5958,7 +6762,7 @@ module Ts = /// Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added abstract watchDirectory: path: string * callback: DirectoryWatcherCallback * ?recursive: bool * ?options: CompilerOptions -> FileWatcher /// If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together - abstract setTimeout: callback: (ResizeArray -> unit) * ms: float * [] args: ResizeArray -> obj option + abstract setTimeout: callback: (obj option[] -> unit) * ms: float * [] args: obj option[] -> obj option /// If provided, will be used to reset existing delayed compilation abstract clearTimeout: timeoutId: obj option -> unit @@ -5980,9 +6784,9 @@ module Ts = /// If provided, used for module resolution as well as to handle directory structure abstract directoryExists: path: string -> bool /// If provided, used in resolutions as well as handling directory structure - abstract getDirectories: path: string -> ResizeArray + abstract getDirectories: path: string -> string[] /// If provided, used to cache and handle directory structure modifications - abstract readDirectory: path: string * ?extensions: ResizeArray * ?exclude: ResizeArray * ?``include``: ResizeArray * ?depth: float -> ResizeArray + abstract readDirectory: path: string * ?extensions: string[] * ?exclude: string[] * ?``include``: string[] * ?depth: float -> string[] /// Symbol links resolution abstract realpath: path: string -> string /// If provided would be used to write log about compilation @@ -5990,9 +6794,9 @@ module Ts = /// If provided is used to get the environment variable abstract getEnvironmentVariable: name: string -> string option /// If provided, used to resolve the module names, otherwise typescript's default module resolution - abstract resolveModuleNames: moduleNames: ResizeArray * containingFile: string * reusedNames: ResizeArray option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResizeArray + abstract resolveModuleNames: moduleNames: string[] * containingFile: string * reusedNames: string[] option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResolvedModule option[] /// If provided, used to resolve type reference directives, otherwise typescript's default resolution - abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: ResizeArray * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions -> ResizeArray + abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: string[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions -> ResolvedTypeReferenceDirective option[] type [] WatchCompilerHost<'T> = inherit ProgramHost<'T> @@ -6008,12 +6812,12 @@ module Ts = type [] WatchCompilerHostOfFilesAndCompilerOptions<'T> = inherit WatchCompilerHost<'T> /// root files to use to generate program - abstract rootFiles: ResizeArray with get, set + abstract rootFiles: string[] with get, set /// Compiler options abstract options: CompilerOptions with get, set abstract watchOptions: WatchOptions option with get, set /// Project References - abstract projectReferences: ResizeArray option with get, set + abstract projectReferences: ProjectReference[] option with get, set /// Host to create watch with config file type [] WatchCompilerHostOfConfigFile<'T> = @@ -6024,10 +6828,10 @@ module Ts = /// Options to extend abstract optionsToExtend: CompilerOptions option with get, set abstract watchOptionsToExtend: WatchOptions option with get, set - abstract extraFileExtensions: ResizeArray option with get, set + abstract extraFileExtensions: FileExtensionInfo[] option with get, set /// Used to generate source file names from the config file and its include, exclude, files rules /// and also to cache the directory stucture - abstract readDirectory: path: string * ?extensions: ResizeArray * ?exclude: ResizeArray * ?``include``: ResizeArray * ?depth: float -> ResizeArray + abstract readDirectory: path: string * ?extensions: string[] * ?exclude: string[] * ?``include``: string[] * ?depth: float -> string[] type [] Watch<'T> = /// Synchronize with host and get updated program @@ -6043,7 +6847,7 @@ module Ts = type [] WatchOfFilesAndCompilerOptions<'T> = inherit Watch<'T> /// Updates the root files in the program, only if this is not config file compilation - abstract updateRootFileNames: fileNames: ResizeArray -> unit + abstract updateRootFileNames: fileNames: string[] -> unit type [] BuildOptions = abstract dry: bool option with get, set @@ -6052,10 +6856,14 @@ module Ts = abstract incremental: bool option with get, set abstract assumeChangesOnlyAffectDirectDependencies: bool option with get, set abstract traceResolution: bool option with get, set - [] abstract Item: option: string -> CompilerOptionsValue option with get, set + [] abstract Item: option: string -> CompilerOptionsValue option with get, set type [] ReportEmitErrorSummary = - [] abstract Invoke: errorCount: float -> unit + [] abstract Invoke: errorCount: float * filesInError: ReportFileInError option[] -> unit + + type [] ReportFileInError = + abstract fileName: string with get, set + abstract line: float with get, set type [] SolutionBuilderHostBase<'T> = inherit ProgramHost<'T> @@ -6111,14 +6919,14 @@ module Ts = abstract getBuilderProgram: unit -> 'T option abstract getProgram: unit -> Program option abstract getSourceFile: fileName: string -> SourceFile option - abstract getSourceFiles: unit -> ResizeArray - abstract getOptionsDiagnostics: ?cancellationToken: CancellationToken -> ResizeArray - abstract getGlobalDiagnostics: ?cancellationToken: CancellationToken -> ResizeArray - abstract getConfigFileParsingDiagnostics: unit -> ResizeArray - abstract getSyntacticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> ResizeArray - abstract getAllDependencies: sourceFile: SourceFile -> ResizeArray - abstract getSemanticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> ResizeArray - abstract getSemanticDiagnosticsOfNextAffectedFile: ?cancellationToken: CancellationToken * ?ignoreSourceFile: (SourceFile -> bool) -> AffectedFileResult> + abstract getSourceFiles: unit -> SourceFile[] + abstract getOptionsDiagnostics: ?cancellationToken: CancellationToken -> Diagnostic[] + abstract getGlobalDiagnostics: ?cancellationToken: CancellationToken -> Diagnostic[] + abstract getConfigFileParsingDiagnostics: unit -> Diagnostic[] + abstract getSyntacticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> Diagnostic[] + abstract getAllDependencies: sourceFile: SourceFile -> string[] + abstract getSemanticDiagnostics: ?sourceFile: SourceFile * ?cancellationToken: CancellationToken -> Diagnostic[] + abstract getSemanticDiagnosticsOfNextAffectedFile: ?cancellationToken: CancellationToken * ?ignoreSourceFile: (SourceFile -> bool) -> AffectedFileResult abstract emit: ?targetSourceFile: SourceFile * ?writeFile: WriteFileCallback * ?cancellationToken: CancellationToken * ?emitOnlyDtsFiles: bool * ?customTransformers: CustomTransformers -> EmitResult option type [] UpdateBundleProject<'T> = @@ -6126,8 +6934,10 @@ module Ts = abstract kind: InvalidatedProjectKind abstract emit: ?writeFile: WriteFileCallback * ?customTransformers: CustomTransformers -> U2> option - type InvalidatedProject<'T> = - U3, UpdateBundleProject<'T>> + type [] [] InvalidatedProject<'T> = + | [] BuildInvalidedProject of BuildInvalidedProject<'T> + | [] UpdateBundleProject of UpdateBundleProject<'T> + | [] UpdateOutputFileStampsProject of UpdateOutputFileStampsProject module Server = @@ -6160,7 +6970,7 @@ module Ts = type [] DiscoverTypings = inherit TypingInstallerRequestWithProjectName - abstract fileNames: ResizeArray + abstract fileNames: string[] abstract projectRootPath: Path abstract compilerOptions: CompilerOptions abstract watchOptions: WatchOptions option @@ -6208,7 +7018,7 @@ module Ts = abstract kind: U2 abstract eventId: float abstract typingsInstallerVersion: string - abstract packagesToInstall: ResizeArray + abstract packagesToInstall: string[] type [] BeginInstallTypes = inherit InstallTypes @@ -6223,7 +7033,7 @@ module Ts = inherit ProjectResponse abstract typeAcquisition: TypeAcquisition abstract compilerOptions: CompilerOptions - abstract typings: ResizeArray + abstract typings: string[] abstract unresolvedImports: SortedReadonlyArray abstract kind: ActionSet @@ -6253,11 +7063,11 @@ module Ts = abstract fromString: text: string -> IScriptSnapshot type [] PreProcessedFileInfo = - abstract referencedFiles: ResizeArray with get, set - abstract typeReferenceDirectives: ResizeArray with get, set - abstract libReferenceDirectives: ResizeArray with get, set - abstract importedFiles: ResizeArray with get, set - abstract ambientExternalModules: ResizeArray option with get, set + abstract referencedFiles: FileReference[] with get, set + abstract typeReferenceDirectives: FileReference[] with get, set + abstract libReferenceDirectives: FileReference[] with get, set + abstract importedFiles: FileReference[] with get, set + abstract ambientExternalModules: string[] option with get, set abstract isLibFile: bool with get, set type [] HostCancellationToken = @@ -6286,11 +7096,11 @@ module Ts = abstract getCompilationSettings: unit -> CompilerOptions abstract getNewLine: unit -> string abstract getProjectVersion: unit -> string - abstract getScriptFileNames: unit -> ResizeArray + abstract getScriptFileNames: unit -> string[] abstract getScriptKind: fileName: string -> ScriptKind abstract getScriptVersion: fileName: string -> string abstract getScriptSnapshot: fileName: string -> IScriptSnapshot option - abstract getProjectReferences: unit -> ResizeArray option + abstract getProjectReferences: unit -> ProjectReference[] option abstract getLocalizedDiagnosticMessages: unit -> obj option abstract getCancellationToken: unit -> HostCancellationToken abstract getCurrentDirectory: unit -> string @@ -6299,15 +7109,15 @@ module Ts = abstract trace: s: string -> unit abstract error: s: string -> unit abstract useCaseSensitiveFileNames: unit -> bool - abstract readDirectory: path: string * ?extensions: ResizeArray * ?exclude: ResizeArray * ?``include``: ResizeArray * ?depth: float -> ResizeArray + abstract readDirectory: path: string * ?extensions: string[] * ?exclude: string[] * ?``include``: string[] * ?depth: float -> string[] abstract readFile: path: string * ?encoding: string -> string option abstract realpath: path: string -> string abstract fileExists: path: string -> bool abstract getTypeRootsVersion: unit -> float - abstract resolveModuleNames: moduleNames: ResizeArray * containingFile: string * reusedNames: ResizeArray option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResizeArray + abstract resolveModuleNames: moduleNames: string[] * containingFile: string * reusedNames: string[] option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResolvedModule option[] abstract getResolvedModuleWithFailedLookupLocationsFromCache: modulename: string * containingFile: string * ?resolutionMode: ModuleKind -> ResolvedModuleWithFailedLookupLocations option - abstract resolveTypeReferenceDirectives: typeDirectiveNames: ResizeArray * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions -> ResizeArray - abstract getDirectories: directoryName: string -> ResizeArray + abstract resolveTypeReferenceDirectives: typeDirectiveNames: string[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions -> ResolvedTypeReferenceDirective option[] + abstract getDirectories: directoryName: string -> string[] /// Gets a set of custom transformers to use during emit. abstract getCustomTransformers: unit -> CustomTransformers option abstract isKnownTypesPackageName: name: string -> bool @@ -6325,22 +7135,25 @@ module Ts = type [] LanguageService = /// This is used as a part of restarting the language service. abstract cleanupSemanticCache: unit -> unit - /// Gets errors indicating invalid syntax in a file. + /// + /// Gets errors indicating invalid syntax in a file. /// /// In English, "this cdeo have, erorrs" is syntactically invalid because it has typos, /// grammatical errors, and misplaced punctuation. Likewise, examples of syntax - /// errors in TypeScript are missing parentheses in an `if` statement, mismatched + /// errors in TypeScript are missing parentheses in an if statement, mismatched /// curly braces, and using a reserved keyword as a variable name. /// /// These diagnostics are inexpensive to compute and don't require knowledge of /// other files. Note that a non-empty result increases the likelihood of false positives - /// from `getSemanticDiagnostics`. + /// from getSemanticDiagnostics. /// /// While these represent the majority of syntax-related diagnostics, there are some - /// that require the type system, which will be present in `getSemanticDiagnostics`. + /// that require the type system, which will be present in getSemanticDiagnostics. + /// /// A path to the file you want syntactic diagnostics for - abstract getSyntacticDiagnostics: fileName: string -> ResizeArray - /// Gets warnings or errors indicating type system issues in a given file. + abstract getSyntacticDiagnostics: fileName: string -> DiagnosticWithLocation[] + /// + /// Gets warnings or errors indicating type system issues in a given file. /// Requesting semantic diagnostics may start up the type system and /// run deferred work, so the first call may take longer than subsequent calls. /// @@ -6350,45 +7163,59 @@ module Ts = /// /// To contrast the differences between semantic and syntactic diagnostics, consider the /// sentence: "The sun is green." is syntactically correct; those are real English words with - /// correct sentence structure. However, it is semantically invalid, because it is not true. + /// correct sentence structure. However, it is semantically invalid, because it is not true. + /// /// A path to the file you want semantic diagnostics for - abstract getSemanticDiagnostics: fileName: string -> ResizeArray - /// Gets suggestion diagnostics for a specific file. These diagnostics tend to + abstract getSemanticDiagnostics: fileName: string -> Diagnostic[] + /// + /// Gets suggestion diagnostics for a specific file. These diagnostics tend to /// proactively suggest refactors, as opposed to diagnostics that indicate - /// potentially incorrect runtime behavior. + /// potentially incorrect runtime behavior. + /// /// A path to the file you want semantic diagnostics for - abstract getSuggestionDiagnostics: fileName: string -> ResizeArray + abstract getSuggestionDiagnostics: fileName: string -> DiagnosticWithLocation[] /// Gets global diagnostics related to the program configuration and compiler options. - abstract getCompilerOptionsDiagnostics: unit -> ResizeArray - abstract getSyntacticClassifications: fileName: string * span: TextSpan -> ResizeArray - abstract getSyntacticClassifications: fileName: string * span: TextSpan * format: SemanticClassificationFormat -> U2, ResizeArray> - abstract getSemanticClassifications: fileName: string * span: TextSpan -> ResizeArray - abstract getSemanticClassifications: fileName: string * span: TextSpan * format: SemanticClassificationFormat -> U2, ResizeArray> + abstract getCompilerOptionsDiagnostics: unit -> Diagnostic[] + [] + abstract getSyntacticClassifications: fileName: string * span: TextSpan -> ClassifiedSpan[] + abstract getSyntacticClassifications: fileName: string * span: TextSpan * format: SemanticClassificationFormat -> U2 + [] + abstract getSemanticClassifications: fileName: string * span: TextSpan -> ClassifiedSpan[] + abstract getSemanticClassifications: fileName: string * span: TextSpan * format: SemanticClassificationFormat -> U2 /// Encoded as triples of [start, length, ClassificationType]. abstract getEncodedSyntacticClassifications: fileName: string * span: TextSpan -> Classifications - /// Gets semantic highlights information for a particular file. Has two formats, an older - /// version used by VS and a format used by VS Code. + /// + /// Gets semantic highlights information for a particular file. Has two formats, an older + /// version used by VS and a format used by VS Code. + /// /// The path to the file + /// A text span to return results within /// Which format to use, defaults to "original" + /// a number array encoded as triples of [start, length, ClassificationType, ...]. abstract getEncodedSemanticClassifications: fileName: string * span: TextSpan * ?format: SemanticClassificationFormat -> Classifications /// Gets completion entries at a particular position in a file. /// The path to the file /// A zero-based index of the character where you want the entries - /// An object describing how the request was triggered and what kinds - /// of code actions can be returned with the completions. - abstract getCompletionsAtPosition: fileName: string * position: float * options: GetCompletionsAtPositionOptions option -> WithMetadata option - /// Gets the extended details for a completion entry retrieved from `getCompletionsAtPosition`. + /// + /// An object describing how the request was triggered and what kinds + /// of code actions can be returned with the completions. + /// + /// settings needed for calling formatting functions. + abstract getCompletionsAtPosition: fileName: string * position: float * options: GetCompletionsAtPositionOptions option * ?formattingSettings: FormatCodeSettings -> WithMetadata option + /// Gets the extended details for a completion entry retrieved from getCompletionsAtPosition. /// The path to the file /// A zero based index of the character where you want the entries - /// The `name` from an existing completion which came from `getCompletionsAtPosition` + /// The name from an existing completion which came from getCompletionsAtPosition /// How should code samples in the completions be formatted, can be undefined for backwards compatibility - /// `source` property from the completion entry + /// source property from the completion entry /// User settings, can be undefined for backwards compatibility - /// `data` property from the completion entry + /// data property from the completion entry abstract getCompletionEntryDetails: fileName: string * position: float * entryName: string * formatOptions: U2 option * source: string option * preferences: UserPreferences option * data: CompletionEntryData option -> CompletionEntryDetails option abstract getCompletionEntrySymbol: fileName: string * position: float * name: string * source: string option -> Symbol option - /// Gets semantic information about the identifier at a particular position in a - /// file. Quick info is what you typically see when you hover in an editor. + /// + /// Gets semantic information about the identifier at a particular position in a + /// file. Quick info is what you typically see when you hover in an editor. + /// /// The path to the file /// A zero-based index of the character where you want the quick info abstract getQuickInfoAtPosition: fileName: string * position: float -> QuickInfo option @@ -6396,56 +7223,62 @@ module Ts = abstract getBreakpointStatementAtPosition: fileName: string * position: float -> TextSpan option abstract getSignatureHelpItems: fileName: string * position: float * options: SignatureHelpItemsOptions option -> SignatureHelpItems option abstract getRenameInfo: fileName: string * position: float * ?options: RenameInfoOptions -> RenameInfo - abstract findRenameLocations: fileName: string * position: float * findInStrings: bool * findInComments: bool * ?providePrefixAndSuffixTextForRename: bool -> ResizeArray option + abstract findRenameLocations: fileName: string * position: float * findInStrings: bool * findInComments: bool * ?providePrefixAndSuffixTextForRename: bool -> RenameLocation[] option abstract getSmartSelectionRange: fileName: string * position: float -> SelectionRange - abstract getDefinitionAtPosition: fileName: string * position: float -> ResizeArray option + abstract getDefinitionAtPosition: fileName: string * position: float -> DefinitionInfo[] option abstract getDefinitionAndBoundSpan: fileName: string * position: float -> DefinitionInfoAndBoundSpan option - abstract getTypeDefinitionAtPosition: fileName: string * position: float -> ResizeArray option - abstract getImplementationAtPosition: fileName: string * position: float -> ResizeArray option - abstract getReferencesAtPosition: fileName: string * position: float -> ResizeArray option - abstract findReferences: fileName: string * position: float -> ResizeArray option - abstract getDocumentHighlights: fileName: string * position: float * filesToSearch: ResizeArray -> ResizeArray option - abstract getFileReferences: fileName: string -> ResizeArray - abstract getOccurrencesAtPosition: fileName: string * position: float -> ResizeArray option - abstract getNavigateToItems: searchValue: string * ?maxResultCount: float * ?fileName: string * ?excludeDtsFiles: bool -> ResizeArray - abstract getNavigationBarItems: fileName: string -> ResizeArray + abstract getTypeDefinitionAtPosition: fileName: string * position: float -> DefinitionInfo[] option + abstract getImplementationAtPosition: fileName: string * position: float -> ImplementationLocation[] option + abstract getReferencesAtPosition: fileName: string * position: float -> ReferenceEntry[] option + abstract findReferences: fileName: string * position: float -> ReferencedSymbol[] option + abstract getDocumentHighlights: fileName: string * position: float * filesToSearch: string[] -> DocumentHighlights[] option + abstract getFileReferences: fileName: string -> ReferenceEntry[] + [] + abstract getOccurrencesAtPosition: fileName: string * position: float -> ReferenceEntry[] option + abstract getNavigateToItems: searchValue: string * ?maxResultCount: float * ?fileName: string * ?excludeDtsFiles: bool -> NavigateToItem[] + abstract getNavigationBarItems: fileName: string -> NavigationBarItem[] abstract getNavigationTree: fileName: string -> NavigationTree - abstract prepareCallHierarchy: fileName: string * position: float -> U2> option - abstract provideCallHierarchyIncomingCalls: fileName: string * position: float -> ResizeArray - abstract provideCallHierarchyOutgoingCalls: fileName: string * position: float -> ResizeArray - abstract provideInlayHints: fileName: string * span: TextSpan * preferences: UserPreferences option -> ResizeArray - abstract getOutliningSpans: fileName: string -> ResizeArray - abstract getTodoComments: fileName: string * descriptors: ResizeArray -> ResizeArray - abstract getBraceMatchingAtPosition: fileName: string * position: float -> ResizeArray + abstract prepareCallHierarchy: fileName: string * position: float -> U2 option + abstract provideCallHierarchyIncomingCalls: fileName: string * position: float -> CallHierarchyIncomingCall[] + abstract provideCallHierarchyOutgoingCalls: fileName: string * position: float -> CallHierarchyOutgoingCall[] + abstract provideInlayHints: fileName: string * span: TextSpan * preferences: UserPreferences option -> InlayHint[] + abstract getOutliningSpans: fileName: string -> OutliningSpan[] + abstract getTodoComments: fileName: string * descriptors: TodoCommentDescriptor[] -> TodoComment[] + abstract getBraceMatchingAtPosition: fileName: string * position: float -> TextSpan[] abstract getIndentationAtPosition: fileName: string * position: float * options: U2 -> float - abstract getFormattingEditsForRange: fileName: string * start: float * ``end``: float * options: U2 -> ResizeArray - abstract getFormattingEditsForDocument: fileName: string * options: U2 -> ResizeArray - abstract getFormattingEditsAfterKeystroke: fileName: string * position: float * key: string * options: U2 -> ResizeArray + abstract getFormattingEditsForRange: fileName: string * start: float * ``end``: float * options: U2 -> TextChange[] + abstract getFormattingEditsForDocument: fileName: string * options: U2 -> TextChange[] + abstract getFormattingEditsAfterKeystroke: fileName: string * position: float * key: string * options: U2 -> TextChange[] abstract getDocCommentTemplateAtPosition: fileName: string * position: float * ?options: DocCommentTemplateOptions -> TextInsertion option abstract isValidBraceCompletionAtPosition: fileName: string * position: float * openingBrace: float -> bool - /// This will return a defined result if the position is after the `>` of the opening tag, or somewhere in the text, of a JSXElement with no closing tag. - /// Editors should call this after `>` is typed. + /// + /// This will return a defined result if the position is after the > of the opening tag, or somewhere in the text, of a JSXElement with no closing tag. + /// Editors should call this after > is typed. + /// abstract getJsxClosingTagAtPosition: fileName: string * position: float -> JsxClosingTagInfo option abstract getSpanOfEnclosingComment: fileName: string * position: float * onlyMultiLine: bool -> TextSpan option abstract toLineColumnOffset: fileName: string * position: float -> LineAndCharacter - abstract getCodeFixesAtPosition: fileName: string * start: float * ``end``: float * errorCodes: ResizeArray * formatOptions: FormatCodeSettings * preferences: UserPreferences -> ResizeArray + abstract getCodeFixesAtPosition: fileName: string * start: float * ``end``: float * errorCodes: float[] * formatOptions: FormatCodeSettings * preferences: UserPreferences -> CodeFixAction[] abstract getCombinedCodeFix: scope: CombinedCodeFixScope * fixId: LanguageServiceGetCombinedCodeFixFixId * formatOptions: FormatCodeSettings * preferences: UserPreferences -> CombinedCodeActions abstract applyCodeActionCommand: action: CodeActionCommand * ?formatSettings: FormatCodeSettings -> Promise - abstract applyCodeActionCommand: action: ResizeArray * ?formatSettings: FormatCodeSettings -> Promise> - abstract applyCodeActionCommand: action: U2> * ?formatSettings: FormatCodeSettings -> Promise>> + abstract applyCodeActionCommand: action: CodeActionCommand[] * ?formatSettings: FormatCodeSettings -> Promise + abstract applyCodeActionCommand: action: U2 * ?formatSettings: FormatCodeSettings -> Promise> + [] abstract applyCodeActionCommand: fileName: string * action: CodeActionCommand -> Promise - abstract applyCodeActionCommand: fileName: string * action: ResizeArray -> Promise> - abstract applyCodeActionCommand: fileName: string * action: U2> -> Promise>> - abstract getApplicableRefactors: fileName: string * positionOrRange: U2 * preferences: UserPreferences option * ?triggerReason: RefactorTriggerReason * ?kind: string -> ResizeArray + [] + abstract applyCodeActionCommand: fileName: string * action: CodeActionCommand[] -> Promise + [] + abstract applyCodeActionCommand: fileName: string * action: U2 -> Promise> + abstract getApplicableRefactors: fileName: string * positionOrRange: U2 * preferences: UserPreferences option * ?triggerReason: RefactorTriggerReason * ?kind: string -> ApplicableRefactorInfo[] abstract getEditsForRefactor: fileName: string * formatOptions: FormatCodeSettings * positionOrRange: U2 * refactorName: string * actionName: string * preferences: UserPreferences option -> RefactorEditInfo option - abstract organizeImports: args: OrganizeImportsArgs * formatOptions: FormatCodeSettings * preferences: UserPreferences option -> ResizeArray - abstract getEditsForFileRename: oldFilePath: string * newFilePath: string * formatOptions: FormatCodeSettings * preferences: UserPreferences option -> ResizeArray + abstract organizeImports: args: OrganizeImportsArgs * formatOptions: FormatCodeSettings * preferences: UserPreferences option -> FileTextChanges[] + abstract getEditsForFileRename: oldFilePath: string * newFilePath: string * formatOptions: FormatCodeSettings * preferences: UserPreferences option -> FileTextChanges[] abstract getEmitOutput: fileName: string * ?emitOnlyDtsFiles: bool * ?forceDtsEmit: bool -> EmitOutput abstract getProgram: unit -> Program option - abstract toggleLineComment: fileName: string * textRange: TextRange -> ResizeArray - abstract toggleMultilineComment: fileName: string * textRange: TextRange -> ResizeArray - abstract commentSelection: fileName: string * textRange: TextRange -> ResizeArray - abstract uncommentSelection: fileName: string * textRange: TextRange -> ResizeArray + abstract toggleLineComment: fileName: string * textRange: TextRange -> TextChange[] + abstract toggleMultilineComment: fileName: string * textRange: TextRange -> TextChange[] + abstract commentSelection: fileName: string * textRange: TextRange -> TextChange[] + abstract uncommentSelection: fileName: string * textRange: TextRange -> TextChange[] abstract dispose: unit -> unit type [] LanguageServiceGetCombinedCodeFixFixId = @@ -6474,8 +7307,11 @@ module Ts = | [] Empty type [] CompletionTriggerKind = + /// Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. | Invoked = 1 + /// Completion was triggered by a trigger character. | TriggerCharacter = 2 + /// Completion was re-triggered as the current completion list is incomplete. | TriggerForIncompleteCompletions = 3 type [] GetCompletionsAtPositionOptions = @@ -6484,7 +7320,9 @@ module Ts = /// (as opposed to when the user explicitly requested them) this should be set. abstract triggerCharacter: CompletionsTriggerCharacter option with get, set abstract triggerKind: CompletionTriggerKind option with get, set + [] abstract includeExternalModuleExports: bool option with get, set + [] abstract includeInsertTextCompletions: bool option with get, set type [] InlayHintsOptions = @@ -6508,8 +7346,10 @@ module Ts = type [] SignatureHelpItemsOptions = abstract triggerReason: SignatureHelpTriggerReason option with get, set - type SignatureHelpTriggerReason = - U3 + type [] [] SignatureHelpTriggerReason = + | [] SignatureHelpCharacterTypedReason of SignatureHelpCharacterTypedReason + | [] SignatureHelpInvokedReason of SignatureHelpInvokedReason + | [] SignatureHelpRetriggeredReason of SignatureHelpRetriggeredReason /// Signals that the user manually requested signature help. /// The language service will unconditionally attempt to provide a result. @@ -6524,10 +7364,12 @@ module Ts = /// Character that was responsible for triggering signature help. abstract triggerCharacter: SignatureHelpTriggerCharacter with get, set + /// /// Signals that this signature help request came from typing a character or moving the cursor. /// This should only occur if a signature help session was already active and the editor needs to see if it should adjust. /// The language service will unconditionally attempt to provide a result. - /// `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move. + /// triggerCharacter can be undefined for a retrigger caused by a cursor move. + /// type [] SignatureHelpRetriggeredReason = abstract kind: string with get, set /// Character that was responsible for triggering signature help. @@ -6537,7 +7379,7 @@ module Ts = abstract successMessage: string with get, set type [] Classifications = - abstract spans: ResizeArray with get, set + abstract spans: float[] with get, set abstract endOfLineState: EndOfLineState with get, set type [] ClassifiedSpan = @@ -6548,16 +7390,18 @@ module Ts = abstract textSpan: TextSpan with get, set abstract classificationType: float with get, set + /// /// Navigation bar interface designed for visual studio's dual-column layout. /// This does not form a proper tree. /// The navbar is returned as a list of top-level items, each of which has a list of child items. - /// Child items always have an empty array for their `childItems`. + /// Child items always have an empty array for their childItems. + /// type [] NavigationBarItem = abstract text: string with get, set abstract kind: ScriptElementKind with get, set abstract kindModifiers: string with get, set - abstract spans: ResizeArray with get, set - abstract childItems: ResizeArray with get, set + abstract spans: TextSpan[] with get, set + abstract childItems: NavigationBarItem[] with get, set abstract indent: float with get, set abstract bolded: bool with get, set abstract grayed: bool with get, set @@ -6572,10 +7416,10 @@ module Ts = abstract kindModifiers: string with get, set /// Spans of the nodes that generated this declaration. /// There will be more than one if this is the result of merging. - abstract spans: ResizeArray with get, set + abstract spans: TextSpan[] with get, set abstract nameSpan: TextSpan option with get, set /// Present if non-empty - abstract childItems: ResizeArray option with get, set + abstract childItems: NavigationTree[] option with get, set type [] CallHierarchyItem = abstract name: string with get, set @@ -6588,11 +7432,11 @@ module Ts = type [] CallHierarchyIncomingCall = abstract from: CallHierarchyItem with get, set - abstract fromSpans: ResizeArray with get, set + abstract fromSpans: TextSpan[] with get, set type [] CallHierarchyOutgoingCall = abstract ``to``: CallHierarchyItem with get, set - abstract fromSpans: ResizeArray with get, set + abstract fromSpans: TextSpan[] with get, set type [] [] InlayHintKind = | [] Type @@ -6621,17 +7465,19 @@ module Ts = type [] FileTextChanges = abstract fileName: string with get, set - abstract textChanges: ResizeArray with get, set + abstract textChanges: TextChange[] with get, set abstract isNewFile: bool option with get, set type [] CodeAction = /// Description of the code action to display in the UI of the editor abstract description: string with get, set /// Text changes to apply to each file as part of the code action - abstract changes: ResizeArray with get, set - /// If the user accepts the code fix, the editor should send the action back in a `applyAction` request. + abstract changes: FileTextChanges[] with get, set + /// + /// If the user accepts the code fix, the editor should send the action back in a applyAction request. /// This allows the language service to have side effects (e.g. installing dependencies) upon a code fix. - abstract commands: ResizeArray option with get, set + /// + abstract commands: CodeActionCommand[] option with get, set type [] CodeFixAction = inherit CodeAction @@ -6643,8 +7489,8 @@ module Ts = abstract fixAllDescription: string option with get, set type [] CombinedCodeActions = - abstract changes: ResizeArray with get, set - abstract commands: ResizeArray option with get, set + abstract changes: FileTextChanges[] with get, set + abstract commands: CodeActionCommand[] option with get, set type CodeActionCommand = InstallPackageAction @@ -6665,7 +7511,7 @@ module Ts = /// /// If not specified, this value is assumed to be 'true' abstract inlineable: bool option with get, set - abstract actions: ResizeArray with get, set + abstract actions: RefactorActionInfo[] with get, set /// Represents a single refactoring action - for example, the "Extract Method..." refactor might /// offer several actions, each corresponding to a surround class or closure to extract into. @@ -6685,10 +7531,10 @@ module Ts = /// A set of edits to make in response to a refactor action, plus an optional /// location where renaming should be invoked from type [] RefactorEditInfo = - abstract edits: ResizeArray with get, set + abstract edits: FileTextChanges[] with get, set abstract renameFilename: string option with get, set abstract renameLocation: float option with get, set - abstract commands: ResizeArray option with get, set + abstract commands: CodeActionCommand[] option with get, set type [] [] RefactorTriggerReason = | Implicit @@ -6720,12 +7566,12 @@ module Ts = inherit DocumentSpan abstract isWriteAccess: bool with get, set abstract isDefinition: bool with get, set - abstract isInString: obj option with get, set + abstract isInString: bool option with get, set type [] ImplementationLocation = inherit DocumentSpan abstract kind: ScriptElementKind with get, set - abstract displayParts: ResizeArray with get, set + abstract displayParts: SymbolDisplayPart[] with get, set type [] [] HighlightSpanKind = | None @@ -6735,7 +7581,7 @@ module Ts = type [] HighlightSpan = abstract fileName: string option with get, set - abstract isInString: obj option with get, set + abstract isInString: bool option with get, set abstract textSpan: TextSpan with get, set abstract contextSpan: TextSpan option with get, set abstract kind: HighlightSpanKind with get, set @@ -6828,16 +7674,16 @@ module Ts = abstract unverified: bool option with get, set type [] DefinitionInfoAndBoundSpan = - abstract definitions: ResizeArray option with get, set + abstract definitions: DefinitionInfo[] option with get, set abstract textSpan: TextSpan with get, set type [] ReferencedSymbolDefinitionInfo = inherit DefinitionInfo - abstract displayParts: ResizeArray with get, set + abstract displayParts: SymbolDisplayPart[] with get, set type [] ReferencedSymbol = abstract definition: ReferencedSymbolDefinitionInfo with get, set - abstract references: ResizeArray with get, set + abstract references: ReferenceEntry[] with get, set type [] SymbolDisplayPartKind = | AliasName = 0 @@ -6876,23 +7722,26 @@ module Ts = type [] JSDocTagInfo = abstract name: string with get, set - abstract text: ResizeArray option with get, set + abstract text: SymbolDisplayPart[] option with get, set type [] QuickInfo = abstract kind: ScriptElementKind with get, set abstract kindModifiers: string with get, set abstract textSpan: TextSpan with get, set - abstract displayParts: ResizeArray option with get, set - abstract documentation: ResizeArray option with get, set - abstract tags: ResizeArray option with get, set + abstract displayParts: SymbolDisplayPart[] option with get, set + abstract documentation: SymbolDisplayPart[] option with get, set + abstract tags: JSDocTagInfo[] option with get, set - type RenameInfo = - U2 + type [] [] RenameInfo = + | [] RenameInfoFailure of RenameInfoFailure + | [] RenameInfoSuccess of RenameInfoSuccess type [] RenameInfoSuccess = - abstract canRename: obj with get, set + abstract canRename: bool with get, set + /// /// File or directory to rename. - /// If set, `getEditsForFileRename` should be called instead of `findRenameLocations`. + /// If set, getEditsForFileRename should be called instead of findRenameLocations. + /// abstract fileToRename: string option with get, set abstract displayName: string with get, set abstract fullDisplayName: string with get, set @@ -6901,7 +7750,7 @@ module Ts = abstract triggerSpan: TextSpan with get, set type [] RenameInfoFailure = - abstract canRename: obj with get, set + abstract canRename: bool with get, set abstract localizedErrorMessage: string with get, set type [] RenameInfoOptions = @@ -6912,8 +7761,8 @@ module Ts = type [] SignatureHelpParameter = abstract name: string with get, set - abstract documentation: ResizeArray with get, set - abstract displayParts: ResizeArray with get, set + abstract documentation: SymbolDisplayPart[] with get, set + abstract displayParts: SymbolDisplayPart[] with get, set abstract isOptional: bool with get, set abstract isRest: bool option with get, set @@ -6928,34 +7777,36 @@ module Ts = /// questions like 'what parameter is the user currently contained within?'. type [] SignatureHelpItem = abstract isVariadic: bool with get, set - abstract prefixDisplayParts: ResizeArray with get, set - abstract suffixDisplayParts: ResizeArray with get, set - abstract separatorDisplayParts: ResizeArray with get, set - abstract parameters: ResizeArray with get, set - abstract documentation: ResizeArray with get, set - abstract tags: ResizeArray with get, set + abstract prefixDisplayParts: SymbolDisplayPart[] with get, set + abstract suffixDisplayParts: SymbolDisplayPart[] with get, set + abstract separatorDisplayParts: SymbolDisplayPart[] with get, set + abstract parameters: SignatureHelpParameter[] with get, set + abstract documentation: SymbolDisplayPart[] with get, set + abstract tags: JSDocTagInfo[] with get, set /// Represents a set of signature help items, and the preferred item that should be selected. type [] SignatureHelpItems = - abstract items: ResizeArray with get, set + abstract items: SignatureHelpItem[] with get, set abstract applicableSpan: TextSpan with get, set abstract selectedItemIndex: float with get, set abstract argumentIndex: float with get, set abstract argumentCount: float with get, set type [] CompletionInfo = - /// Not true for all global completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. + /// Not true for all global completions. This will be true if the enclosing scope matches a few syntax kinds. See isSnippetScope. abstract isGlobalCompletion: bool with get, set abstract isMemberCompletion: bool with get, set + /// /// In the absence of `CompletionEntry["replacementSpan"], the editor may choose whether to use - /// this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span + /// this span or its default one. If CompletionEntry["replacementSpan"] is defined, that span /// must be used to commit that completion entry. + /// abstract optionalReplacementSpan: TextSpan option with get, set /// true when the current location also allows for a new identifier abstract isNewIdentifierLocation: bool with get, set /// Indicates to client to continue requesting completions on subsequent keystrokes. - abstract isIncomplete: obj option with get, set - abstract entries: ResizeArray with get, set + abstract isIncomplete: bool option with get, set + abstract entries: CompletionEntry[] with get, set type [] CompletionEntryDataAutoImport = /// The name of the property or export in the module's symbol table. Differs from the completion name @@ -6967,11 +7818,11 @@ module Ts = /// The module name (with quotes stripped) of the export's module symbol, if it was an ambient module abstract ambientModuleName: string option with get, set /// True if the export was found in the package.json AutoImportProvider - abstract isPackageJsonImport: obj option with get, set + abstract isPackageJsonImport: bool option with get, set type [] CompletionEntryDataUnresolved = inherit CompletionEntryDataAutoImport - /// The key in the `ExportMapCache` where the completion entry's `SymbolExportInfo[]` is found + /// The key in the ExportMapCache where the completion entry's SymbolExportInfo[] is found abstract exportMapKey: string with get, set type [] CompletionEntryDataResolved = @@ -6987,36 +7838,39 @@ module Ts = abstract kindModifiers: string option with get, set abstract sortText: string with get, set abstract insertText: string option with get, set - abstract isSnippet: obj option with get, set + abstract isSnippet: bool option with get, set /// An optional span that indicates the text to be replaced by this completion item. /// If present, this span should be used instead of the default one. /// It will be set if the required span differs from the one generated by the default replacement behavior. abstract replacementSpan: TextSpan option with get, set - abstract hasAction: obj option with get, set + abstract hasAction: bool option with get, set abstract source: string option with get, set - abstract sourceDisplay: ResizeArray option with get, set - abstract isRecommended: obj option with get, set - abstract isFromUncheckedFile: obj option with get, set - abstract isPackageJsonImport: obj option with get, set - abstract isImportStatementCompletion: obj option with get, set - /// A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`, + abstract sourceDisplay: SymbolDisplayPart[] option with get, set + abstract isRecommended: bool option with get, set + abstract isFromUncheckedFile: bool option with get, set + abstract isPackageJsonImport: bool option with get, set + abstract isImportStatementCompletion: bool option with get, set + /// + /// A property to be sent back to TS Server in the CompletionDetailsRequest, along with name, /// that allows TS Server to look up the symbol represented by the completion item, disambiguating /// items with the same name. Currently only defined for auto-import completions, but the type is - /// `unknown` in the protocol, so it can be changed as needed to support other kinds of completions. + /// unknown in the protocol, so it can be changed as needed to support other kinds of completions. /// The presence of this property should generally not be used to assume that this completion entry /// is an auto-import. + /// abstract data: CompletionEntryData option with get, set type [] CompletionEntryDetails = abstract name: string with get, set abstract kind: ScriptElementKind with get, set abstract kindModifiers: string with get, set - abstract displayParts: ResizeArray with get, set - abstract documentation: ResizeArray option with get, set - abstract tags: ResizeArray option with get, set - abstract codeActions: ResizeArray option with get, set - abstract source: ResizeArray option with get, set - abstract sourceDisplay: ResizeArray option with get, set + abstract displayParts: SymbolDisplayPart[] with get, set + abstract documentation: SymbolDisplayPart[] option with get, set + abstract tags: JSDocTagInfo[] option with get, set + abstract codeActions: CodeAction[] option with get, set + [] + abstract source: SymbolDisplayPart[] option with get, set + abstract sourceDisplay: SymbolDisplayPart[] option with get, set type [] OutliningSpan = /// The span of the document to actually collapse. @@ -7032,9 +7886,13 @@ module Ts = abstract kind: OutliningSpanKind with get, set type [] [] OutliningSpanKind = + /// Single or multi-line comments | Comment + /// Sections marked by '// #region' and '// #endregion' comments | Region + /// Declarations and expressions | Code + /// Contiguous blocks of import declarations | Imports type [] OutputFileType = @@ -7065,56 +7923,85 @@ module Ts = type [] ClassificationResult = abstract finalLexState: EndOfLineState with get, set - abstract entries: ResizeArray with get, set + abstract entries: ClassificationInfo[] with get, set type [] ClassificationInfo = abstract length: float with get, set abstract classification: TokenClass with get, set type [] Classifier = - /// Gives lexical classifications of tokens on a line without any syntactic context. + /// + /// Gives lexical classifications of tokens on a line without any syntactic context. /// For instance, a token consisting of the text 'string' can be either an identifier /// named 'string' or the keyword 'string', however, because this classifier is not aware, /// it relies on certain heuristics to give acceptable results. For classifications where /// speed trumps accuracy, this function is preferable; however, for true accuracy, the /// syntactic classifier is ideal. In fact, in certain editing scenarios, combining the - /// lexical, syntactic, and semantic classifiers may issue the best user experience. + /// lexical, syntactic, and semantic classifiers may issue the best user experience. + /// /// The text of a line to classify. /// The state of the lexical classifier at the end of the previous line. - /// Whether the client is *not* using a syntactic classifier. + /// + /// Whether the client is *not* using a syntactic classifier. /// If there is no syntactic classifier (syntacticClassifierAbsent=true), /// certain heuristics may be used in its place; however, if there is a /// syntactic classifier (syntacticClassifierAbsent=false), certain /// classifications which may be incorrectly categorized will be given /// back as Identifiers in order to allow the syntactic classifier to - /// subsume the classification. + /// subsume the classification. + /// + [] abstract getClassificationsForLine: text: string * lexState: EndOfLineState * syntacticClassifierAbsent: bool -> ClassificationResult abstract getEncodedLexicalClassifications: text: string * endOfLineState: EndOfLineState * syntacticClassifierAbsent: bool -> Classifications type [] [] ScriptElementKind = | [] Unknown | Warning + /// predefined type (void) or keyword (class) | Keyword + /// top level script node | [] ScriptElement + /// module foo {} | [] ModuleElement + /// class X {} | [] ClassElement + /// var x = class X {} | [] LocalClassElement + /// interface Y {} | [] InterfaceElement + /// type T = ... | [] TypeElement + /// enum E | [] EnumElement | [] EnumMemberElement + /// Inside module and script only + /// const v = .. | [] VariableElement + /// Inside function | [] LocalVariableElement + /// Inside module and script only + /// function f() { } | [] FunctionElement + /// Inside function | [] LocalFunctionElement + /// class X { [public|private]* foo() {} } | [] MemberFunctionElement + /// class X { [public|private]* [get|set] foo:number; } | [] MemberGetAccessorElement | [] MemberSetAccessorElement + /// class X { [public|private]* foo:number; } + /// interface Y { foo:number; } | [] MemberVariableElement + /// class X { constructor() { } } + /// class X { static { } } | [] ConstructorImplementationElement + /// interface Y { ():number; } | [] CallSignatureElement + /// interface Y { []:number; } | [] IndexSignatureElement + /// interface Y { new():Y; } | [] ConstructSignatureElement + /// function foo(*Y*: string) | [] ParameterElement | [] TypeParameterElement | [] PrimitiveType @@ -7124,10 +8011,16 @@ module Ts = | [] LetElement | Directory | [] ExternalModuleName + /// <JsxTagName attribute1 attribute2={0} /> + /// | [] JsxAttribute + /// String literal | String + /// Jsdoc @link: in {@link C link text}, the before and after text "and "" | Link + /// Jsdoc @link: in {@link C link text}, the entity name "C" | [] LinkName + /// Jsdoc @link: in {@link C link text}, the link text "link text" | [] LinkText type [] [] ScriptElementKindModifier = @@ -7217,7 +8110,7 @@ module Ts = type [] DocumentHighlights = abstract fileName: string with get, set - abstract highlightSpans: ResizeArray with get, set + abstract highlightSpans: HighlightSpan[] with get, set /// The document registry represents a store of SourceFile objects that can be shared between /// multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) @@ -7233,40 +8126,56 @@ module Ts = /// To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it /// to all subsequent createLanguageService calls. type [] DocumentRegistry = - /// Request a stored SourceFile with a given fileName and compilationSettings. + /// + /// Request a stored SourceFile with a given fileName and compilationSettings. /// The first call to acquire will call createLanguageServiceSourceFile to generate - /// the SourceFile if was not found in the registry. + /// the SourceFile if was not found in the registry. + /// /// The name of the file requested - /// Some compilation settings like target affects the + /// + /// Some compilation settings like target affects the /// shape of a the resulting SourceFile. This allows the DocumentRegistry to store - /// multiple copies of the same file for different compilation settings. - /// Text of the file. Only used if the file was not found - /// in the registry and a new one was created. - /// Current version of the file. Only used if the file was not found - /// in the registry and a new one was created. + /// multiple copies of the same file for different compilation settings. + /// + /// + /// Text of the file. Only used if the file was not found + /// in the registry and a new one was created. + /// + /// + /// Current version of the file. Only used if the file was not found + /// in the registry and a new one was created. + /// abstract acquireDocument: fileName: string * compilationSettings: CompilerOptions * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile abstract acquireDocumentWithKey: fileName: string * path: Path * compilationSettings: CompilerOptions * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile - /// Request an updated version of an already existing SourceFile with a given fileName + /// + /// Request an updated version of an already existing SourceFile with a given fileName /// and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile - /// to get an updated SourceFile. + /// to get an updated SourceFile. + /// /// The name of the file requested - /// Some compilation settings like target affects the + /// + /// Some compilation settings like target affects the /// shape of a the resulting SourceFile. This allows the DocumentRegistry to store - /// multiple copies of the same file for different compilation settings. + /// multiple copies of the same file for different compilation settings. + /// /// Text of the file. /// Current version of the file. abstract updateDocument: fileName: string * compilationSettings: CompilerOptions * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile abstract updateDocumentWithKey: fileName: string * path: Path * compilationSettings: CompilerOptions * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile abstract getKeyForCompilationSettings: settings: CompilerOptions -> DocumentRegistryBucketKey + [] abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions -> unit - /// Informs the DocumentRegistry that a file is not needed any longer. + /// + /// Informs the DocumentRegistry that a file is not needed any longer. /// /// Note: It is not allowed to call release on a SourceFile that was not acquired from - /// this registry originally. + /// this registry originally. + /// /// The name of the file to be released /// The compilation settings used to acquire the file /// The script kind of the file to be released abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions * scriptKind: ScriptKind -> unit + [] abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey -> unit abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey * scriptKind: ScriptKind -> unit abstract reportStats: unit -> string @@ -7284,82 +8193,12 @@ module Ts = type [] TranspileOutput = abstract outputText: string with get, set - abstract diagnostics: ResizeArray option with get, set + abstract diagnostics: Diagnostic[] option with get, set abstract sourceMapText: string option with get, set - type [] IExportsCreateStringLiteral = - [] abstract Invoke: text: string * ?isSingleQuote: bool -> StringLiteral - [] abstract Invoke: text: string * ?isSingleQuote: bool * ?hasExtendedUnicodeEscape: bool -> StringLiteral - - type [] IExportsCreateTemplateHead = - [] abstract Invoke: text: string * ?rawText: string * ?templateFlags: TokenFlags -> TemplateHead - [] abstract Invoke: text: string option * rawText: string * ?templateFlags: TokenFlags -> TemplateHead - - type [] IExportsCreateTemplateMiddle = - [] abstract Invoke: text: string * ?rawText: string * ?templateFlags: TokenFlags -> TemplateMiddle - [] abstract Invoke: text: string option * rawText: string * ?templateFlags: TokenFlags -> TemplateMiddle - - type [] IExportsCreateTemplateTail = - [] abstract Invoke: text: string * ?rawText: string * ?templateFlags: TokenFlags -> TemplateTail - [] abstract Invoke: text: string option * rawText: string * ?templateFlags: TokenFlags -> TemplateTail - - type [] IExportsCreateNoSubstitutionTemplateLiteral = - [] abstract Invoke: text: string * ?rawText: string -> NoSubstitutionTemplateLiteral - [] abstract Invoke: text: string option * rawText: string -> NoSubstitutionTemplateLiteral - - type [] IExportsCreateImmediatelyInvokedFunctionExpression = - [] abstract Invoke: statements: ResizeArray -> CallExpression - [] abstract Invoke: statements: ResizeArray * param: ParameterDeclaration * paramValue: Expression -> CallExpression - - type [] IExportsCreateLiteral = - [] abstract Invoke: value: U5 -> StringLiteral - [] abstract Invoke: value: U2 -> NumericLiteral - [] abstract Invoke: value: bool -> BooleanLiteral - [] abstract Invoke: value: U4 -> PrimaryExpression - - type [] IExportsCreateTypeOperatorNode = - [] abstract Invoke: ``type``: TypeNode -> TypeOperatorNode - [] abstract Invoke: operator: SyntaxKind * ``type``: TypeNode -> TypeOperatorNode - - type [] IExportsCreateTaggedTemplate = - [] abstract Invoke: tag: Expression * template: TemplateLiteral -> TaggedTemplateExpression - [] abstract Invoke: tag: Expression * typeArguments: ResizeArray option * template: TemplateLiteral -> TaggedTemplateExpression - - type [] IExportsUpdateTaggedTemplate = - [] abstract Invoke: node: TaggedTemplateExpression * tag: Expression * template: TemplateLiteral -> TaggedTemplateExpression - [] abstract Invoke: node: TaggedTemplateExpression * tag: Expression * typeArguments: ResizeArray option * template: TemplateLiteral -> TaggedTemplateExpression - - type [] IExportsCreateConditional = - [] abstract Invoke: condition: Expression * whenTrue: Expression * whenFalse: Expression -> ConditionalExpression - [] abstract Invoke: condition: Expression * questionToken: QuestionToken * whenTrue: Expression * colonToken: ColonToken * whenFalse: Expression -> ConditionalExpression - - type [] IExportsCreateYield = - [] abstract Invoke: ?expression: Expression -> YieldExpression - [] abstract Invoke: asteriskToken: AsteriskToken option * expression: Expression -> YieldExpression - - type [] IExportsCreateArrowFunction = - [] abstract Invoke: modifiers: ResizeArray option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * equalsGreaterThanToken: EqualsGreaterThanToken option * body: ConciseBody -> ArrowFunction - [] abstract Invoke: modifiers: ResizeArray option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * body: ConciseBody -> ArrowFunction - - type [] IExportsUpdateArrowFunction = - [] abstract Invoke: node: ArrowFunction * modifiers: ResizeArray option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * equalsGreaterThanToken: EqualsGreaterThanToken * body: ConciseBody -> ArrowFunction - [] abstract Invoke: node: ArrowFunction * modifiers: ResizeArray option * typeParameters: ResizeArray option * parameters: ResizeArray * ``type``: TypeNode option * body: ConciseBody -> ArrowFunction - - type [] IExportsCreateVariableDeclaration = - [] abstract Invoke: name: U2 * ?``type``: TypeNode * ?initializer: Expression -> VariableDeclaration - [] abstract Invoke: name: U2 * exclamationToken: ExclamationToken option * ``type``: TypeNode option * initializer: Expression option -> VariableDeclaration - - type [] IExportsUpdateVariableDeclaration = - [] abstract Invoke: node: VariableDeclaration * name: BindingName * ``type``: TypeNode option * initializer: Expression option -> VariableDeclaration - [] abstract Invoke: node: VariableDeclaration * name: BindingName * exclamationToken: ExclamationToken option * ``type``: TypeNode option * initializer: Expression option -> VariableDeclaration - - type [] IteratorNext<'T> = - abstract value: 'T with get, set - abstract ``done``: obj option with get, set - - type [] IteratorNext2 = - abstract value: obj with get, set - abstract ``done``: obj with get, set + type [] [] IExportsCreateUnparsedSourceFile = + | Js + | Dts type [] DiagnosticMessageReportsUnnecessary = interface end diff --git a/lib/Extensions.fs b/lib/Extensions.fs index 1fe55f5f..8bf57769 100644 --- a/lib/Extensions.fs +++ b/lib/Extensions.fs @@ -57,6 +57,8 @@ module Option = | None -> f (); None module Result = + let ofOption opt = + match opt with Some x -> Ok x | None -> Error (Unchecked.defaultof<_>) let toOption result = match result with Ok x -> Some x | Error _ -> None diff --git a/lib/Parser.fs b/lib/Parser.fs index cd17f5b8..4d8aa1d1 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -54,7 +54,7 @@ module private ParserImpl = let hasModifier (kind: Ts.SyntaxKind) (modifiers: Ts.ModifiersArray option) = match modifiers with | None -> false - | Some mds -> mds |> Seq.exists (fun md -> md.kind = kind) + | Some mds -> mds |> Array.exists (fun md -> md.kind = kind) let getAccessibility (modifiersOpt: Ts.ModifiersArray option) : Accessibility option = if modifiersOpt |> hasModifier Kind.PublicKeyword then @@ -82,30 +82,19 @@ module private ParserImpl = let getText (x: 'a) : string = (!!x : Ts.Node).getText() |> removeQuotesAndTrim - let getPropertyName (pn: Ts.PropertyName) : string option = - let node : Node = !!pn - match node.kind with - | Kind.Identifier -> Some (!!pn : Ts.Identifier).text - | Kind.PrivateIdentifier -> Some (!!pn : Ts.PrivateIdentifier).text - | Kind.StringLiteral -> Some (!!pn : Ts.StringLiteral).text - | Kind.NumericLiteral -> Some (!!pn : Ts.NumericLiteral).text - | _ -> None - - let getPropertyExpression (pn: Ts.PropertyName) : Ts.Expression option = - let node : Node = !!pn - match node.kind with - | Kind.ComputedPropertyName -> Some (!!pn : Ts.ComputedPropertyName).expression - | _ -> None - - let getBindingName ctx (bn: Ts.BindingName): string option = - let syntaxNode : Node = !! bn - match syntaxNode.kind with - | Kind.Identifier -> - let id : Ts.Identifier = !! bn - Some id.text - | Kind.ObjectBindingPattern - | Kind.ArrayBindingPattern -> None - | _ -> nodeError ctx syntaxNode "unknown Binding Name kind: %s" (Enum.pp syntaxNode.kind) + let getPropertyName (pn: Ts.PropertyName) : Result = + match pn with + | Ts.PropertyName.Identifier i -> Ok i.text + | Ts.PropertyName.PrivateIdentifier i -> Ok i.text + | Ts.PropertyName.StringLiteral s -> Ok s.text + | Ts.PropertyName.NumericLiteral n -> Ok n.text + | Ts.PropertyName.ComputedPropertyName c -> Error c.expression + + let getBindingName (bn: Ts.BindingName): string option = + match bn with + | Ts.BindingName.Identifier i -> Some i.text + | Ts.BindingName.ObjectBindingPattern _ + | Ts.BindingName.ArrayBindingPattern _ -> None let rec extractNestedName (node: Node) = seq { @@ -173,12 +162,12 @@ module private ParserImpl = s.declarations |> Option.toList |> List.collect (fun decs -> - decs |> Seq.map (fun dec -> dec.getSourceFile()) |> List.ofSeq) + decs |> Array.map (fun dec -> dec.getSourceFile()) |> List.ofArray) |> List.map (fun x -> x.fileName) |> List.distinct let getRootAndAliasedSymbols (s: Ts.Symbol) = - let roots = ctx.checker.getRootSymbols(s) + let roots = ctx.checker.getRootSymbols(s) |> ResizeArray try let s = ctx.checker.getAliasedSymbol(s) if not (ctx.checker.isUnknownSymbol s || ctx.checker.isUndefinedSymbol s) then @@ -240,13 +229,13 @@ module private ParserImpl = let sanitizeCommentText str : string list = str |> String.toLines |> List.ofArray - let readCommentText (comment: U2>) : string list = + let readCommentText (comment: U2) : string list = let str = if JS.typeof comment = "string" then box comment :?> string else - let texts = box comment :?> ResizeArray // TODO: do not ignore links - texts |> Seq.map (fun x -> x.text) |> String.concat "" + let texts = box comment :?> Ts.JSDocText[] // TODO: do not ignore links + texts |> Array.map (fun x -> x.text) |> String.concat "" sanitizeCommentText str let readNonJSDocComments (ctx: ParserContext) (node: Node) : Comment list = @@ -256,10 +245,10 @@ module private ParserImpl = | None -> [] | Some ranges -> ranges - |> Seq.map (fun range -> + |> Array.map (fun range -> fullText.[int range.pos .. int range.``end``] |> sanitizeCommentText |> Summary) - |> Seq.toList + |> Array.toList let readJSDocTag (tag: Ts.JSDocTag) : Comment = let text = tag.comment |> Option.map readCommentText |> Option.defaultValue [] @@ -280,18 +269,18 @@ module private ParserImpl = | tagName -> Other (tagName, text, tag) - let readJSDocComments (docComment: ResizeArray) (tags: Ts.JSDocTag seq) : Comment list = + let readJSDocComments (docComment: Ts.SymbolDisplayPart[]) (tags: Ts.JSDocTag[]) : Comment list = let desc = let text = docComment - |> List.ofSeq + |> List.ofArray |> List.collect (fun sdp -> sdp.text |> sanitizeCommentText) if List.isEmpty text then [] else [Description text] let tags = tags - |> Seq.map readJSDocTag - |> List.ofSeq + |> Array.map readJSDocTag + |> List.ofArray desc @ tags let readCommentsForNamedDeclaration (ctx: ParserContext) (nd: Ts.NamedDeclaration) : Comment list = @@ -313,7 +302,7 @@ module private ParserImpl = | Kind.MethodDeclaration | Kind.Constructor | Kind.GetAccessor | Kind.SetAccessor | Kind.FunctionExpression | Kind.ArrowFunction -> try - match ctx.checker.getSignatureFromDeclaration nd with + match ctx.checker.getSignatureFromDeclaration !!nd with | None -> fallback () | Some signature -> @@ -372,10 +361,10 @@ module private ParserImpl = | Kind.ThisType -> PolymorphicThis | Kind.UnionType -> let t = t :?> Ts.UnionTypeNode - Union { types = t.types |> Seq.map (readTypeNode typrm ctx) |> List.ofSeq } + Union { types = t.types |> Array.map (readTypeNode typrm ctx) |> List.ofArray } | Kind.IntersectionType -> let t = t :?> Ts.IntersectionTypeNode - Intersection { types = t.types |> Seq.map (readTypeNode typrm ctx) |> List.ofSeq } + Intersection { types = t.types |> Array.map (readTypeNode typrm ctx) |> List.ofArray } | Kind.ParenthesizedType -> readTypeNode typrm ctx ((t :?> Ts.ParenthesizedTypeNode).``type``) // ident, possibly tyapp @@ -392,7 +381,7 @@ module private ParserImpl = | Choice1Of2 lt -> match t.typeArguments with | None -> Ident lt - | Some args -> App (AIdent lt, args |> Seq.map (readTypeNode typrm ctx) |> List.ofSeq, Node.location t) + | Some args -> App (AIdent lt, args |> Array.map (readTypeNode typrm ctx) |> List.ofArray, Node.location t) | Choice2Of2 x -> TypeVar x | Kind.FunctionType -> let t = t :?> Ts.FunctionTypeNode @@ -418,9 +407,9 @@ module private ParserImpl = // anonymous interface | Kind.TypeLiteral -> let t = t :?> Ts.TypeLiteralNode - if t.members.Count = 0 then Prim Object // treat {} as just object + if t.members.Length = 0 then Prim Object // treat {} as just object else - let members = t.members |> List.ofSeq |> List.map (readNamedDeclaration typrm ctx) + let members = t.members |> List.ofArray |> List.map (readNamedDeclaration typrm ctx) let temp = { name = Anonymous; isInterface = true; isExported = Exported.No comments = []; implements = []; typeParams = []; accessibility = Public @@ -488,16 +477,16 @@ module private ParserImpl = {| value = readTypeNode typrm ctx x.``type``; name = Some x.name.text |} | _ -> {| value = readTypeNode typrm ctx (xNode :?> Ts.TypeNode); name = None |} - Tuple { types = Seq.map f tuple.elements |> List.ofSeq; isReadOnly = isReadOnly } + Tuple { types = Array.map f tuple.elements |> List.ofArray; isReadOnly = isReadOnly } - and readParameters<'retType> (typrm: Set) (ctx: ParserContext) (ps: Ts.ParameterDeclaration seq) (parent: Ts.Node) (retType: 'retType) : FuncType<'retType> = + and readParameters<'retType> (typrm: Set) (ctx: ParserContext) (ps: Ts.ParameterDeclaration[]) (parent: Ts.Node) (retType: 'retType) : FuncType<'retType> = let isVariadic = - ps |> Seq.exists (fun p -> p.dotDotDotToken |> Option.isSome) + ps |> Array.exists (fun p -> p.dotDotDotToken |> Option.isSome) let args = ps - |> Seq.mapi (fun i p -> + |> Array.mapi (fun i p -> let isOptional = p.questionToken |> Option.isSome - let nameOpt = p.name |> getBindingName ctx + let nameOpt = p.name |> getBindingName let ty = match p.``type`` with | Some t -> readTypeNode typrm ctx t @@ -515,7 +504,7 @@ module private ParserImpl = assert (not isOptional); Choice2Of2 ty ) - |> Seq.toList + |> Array.toList { args = args; isVariadic = isVariadic; returnType = retType; loc = Node.location parent } and readMemberAttribute (ctx: ParserContext) (nd: Ts.NamedDeclaration) : MemberAttribute = @@ -566,21 +555,18 @@ module private ParserImpl = | Some t -> readTypeNode typrm ctx t | None -> UnknownType None match getPropertyName nd.name with - | Some name -> + | Ok name -> match ty with | UnknownType None -> nodeWarn ctx nd "type not specified for field '%s'" (getText nd.name) | _ -> () let fl = { name = name; isOptional = false; value = ty } attr, Field (fl, (if isReadOnly nd.modifiers then ReadOnly else Mutable)) - | None -> - match getPropertyExpression nd.name with - | Some expr -> readSymbolIndexer expr (Choice1Of2 ty) fail - | None -> fail () + | Error expr -> readSymbolIndexer expr (Choice1Of2 ty) fail | Kind.PropertyDeclaration -> let nd = nd :?> Ts.PropertyDeclaration match getPropertyName nd.name with - | Some name -> + | Ok name -> let ty = match nd.``type`` with | Some t -> readTypeNode typrm ctx t @@ -592,7 +578,7 @@ module private ParserImpl = | _ -> () let fl = { name = name; isOptional = false; value = ty } attr, Field (fl, (if isReadOnly nd.modifiers then ReadOnly else Mutable)) - | None -> nodeWarn ctx nd "unsupported property name '%s' in PropertyDeclaration" (getText nd.name); (attr, UnknownMember (Some (getText nd))) + | Error _ -> nodeWarn ctx nd "unsupported property name '%s' in PropertyDeclaration" (getText nd.name); (attr, UnknownMember (Some (getText nd))) | Kind.CallSignature -> let nd = nd :?> Ts.CallSignatureDeclaration let localTyprm, ty = extractType nd @@ -605,13 +591,10 @@ module private ParserImpl = let localTyprm, retTy = extractType sdb let typrm = Set.union typrm (localTyprm |> List.map (fun x -> x.name) |> Set.ofList) let func = readParameters typrm ctx sdb.parameters sdb retTy - match sdb.name |> Option.bind getPropertyName with - | Some name -> + match sdb.name |> Result.ofOption |> Result.bind getPropertyName with + | Ok name -> attr, Method (name, func, localTyprm) - | None -> - match sdb.name |> Option.bind getPropertyExpression with - | Some expr -> readSymbolIndexer expr (Choice2Of2 func) fail - | None -> fail () + | Error expr -> readSymbolIndexer expr (Choice2Of2 func) fail | Kind.IndexSignature -> let nd = nd :?> Ts.IndexSignatureDeclaration let localTyprm, ty = extractType nd @@ -637,16 +620,16 @@ module private ParserImpl = | Kind.GetAccessor -> let nd = nd :?> Ts.GetAccessorDeclaration match getPropertyName nd.name with - | Some name -> + | Ok name -> let localTyprm, ty = extractType nd if not (List.isEmpty localTyprm) then nodeWarn ctx nd "getter with type argument is not supported" let fl = { name = name; isOptional = false; value = ty } attr, Getter fl - | None -> nodeWarn ctx nd "unsupported property name '%s' in GetAccessor" (getText nd.name); (attr, UnknownMember (Some (getText nd))) + | Error _ -> nodeWarn ctx nd "unsupported property name '%s' in GetAccessor" (getText nd.name); (attr, UnknownMember (Some (getText nd))) | Kind.SetAccessor -> let nd = nd :?> Ts.SetAccessorDeclaration match getPropertyName nd.name with - | Some name -> + | Ok name -> let localTyprm, retTy = extractType nd assert (match retTy with UnknownType _ -> true | _ -> false) if not (List.isEmpty localTyprm) then nodeWarn ctx nd "setter with type argument is not supported" @@ -660,30 +643,30 @@ module private ParserImpl = | _ -> nodeWarn ctx nd "invalid setter for '%s'" (getText nd.name) attr, UnknownMember (Some (getText nd)) - | None -> nodeWarn ctx nd "unsupported property name '%s' in SetAccessor" (getText nd.name); (attr, UnknownMember (Some (getText nd))) + | Error _ -> nodeWarn ctx nd "unsupported property name '%s' in SetAccessor" (getText nd.name); (attr, UnknownMember (Some (getText nd))) | _ -> nodeWarn ctx nd "unsupported NamedDeclaration kind: '%s'" (Enum.pp nd.kind) attr, UnknownMember (Some (getText nd)) - and readTypeParameters (typrm: Set) (ctx: ParserContext) (tps: Ts.TypeParameterDeclaration ResizeArray option) : TypeParam list = + and readTypeParameters (typrm: Set) (ctx: ParserContext) (tps: Ts.TypeParameterDeclaration[] option) : TypeParam list = match tps with | None -> [] | Some tps -> - let names = tps |> Seq.map (fun tp -> tp.name.text) |> Set.ofSeq |> Set.union typrm + let names = tps |> Array.map (fun tp -> tp.name.text) |> Set.ofArray |> Set.union typrm tps - |> Seq.map (fun tp -> + |> Array.map (fun tp -> let dt = tp.``default`` |> Option.map (readTypeNode names ctx) let et = tp.``constraint`` |> Option.map (readTypeNode names ctx) { name = tp.name.text; extends = et; defaultType = dt } ) - |> Seq.toList + |> Array.toList - let readInherits (typrm: Set) (ctx: ParserContext) (hcs: Ts.HeritageClause ResizeArray option) : Type list = + let readInherits (typrm: Set) (ctx: ParserContext) (hcs: Ts.HeritageClause[] option) : Type list = match hcs with | None -> [] | Some hcs -> - hcs |> Seq.collect (fun hc -> hc.types |> Seq.map (readTypeNode typrm ctx)) - |> Seq.toList + hcs |> Array.collect (fun hc -> hc.types |> Array.map (readTypeNode typrm ctx)) + |> Array.toList let readInterface (ctx: ParserContext) (i: Ts.InterfaceDeclaration) : Class = let name = i.name.getText() @@ -697,7 +680,7 @@ module private ParserImpl = implements = readInherits typrmsSet ctx i.heritageClauses isInterface = true isExported = getExported i.modifiers - members = i.members |> List.ofSeq |> List.map (readNamedDeclaration typrmsSet ctx) + members = i.members |> Array.map (readNamedDeclaration typrmsSet ctx) |> List.ofArray loc = Node.location i } @@ -712,13 +695,13 @@ module private ParserImpl = implements = readInherits typrmsSet ctx i.heritageClauses isInterface = false isExported = getExported i.modifiers - members = i.members |> List.ofSeq |> List.map (readNamedDeclaration typrmsSet ctx) + members = i.members |> Array.map (readNamedDeclaration typrmsSet ctx) |> List.ofArray loc = Node.location i } let readEnumCase (ctx: ParserContext) (em: Ts.EnumMember) : EnumCase option = match getPropertyName em.name with - | Some name -> + | Ok name -> let value = let inline fallback () = match ctx.checker.getConstantValue(!^em) with @@ -737,13 +720,13 @@ module private ParserImpl = nodeWarn ctx ep "enum value '%s' for case '%s' not supported" (ep.getText()) name) let comments = readCommentsForNamedDeclaration ctx em Some { comments = comments; loc = Node.location em; name = name; value = value } - | None -> nodeWarn ctx em "unsupported enum case name '%s'" (getText em.name); None + | Error _ -> nodeWarn ctx em "unsupported enum case name '%s'" (getText em.name); None let readEnum (ctx: ParserContext) (ed: Ts.EnumDeclaration) : Enum = { name = ed.name.text comments = readCommentsForNamedDeclaration ctx ed - cases = ed.members |> List.ofSeq |> List.choose (readEnumCase ctx) + cases = ed.members |> Array.choose (readEnumCase ctx) |> List.ofArray isExported = getExported ed.modifiers loc = Node.location ed } @@ -755,9 +738,9 @@ module private ParserImpl = { name = a.name.text; typeParams = typrm; target = ty; comments = comments; isExported = getExported a.modifiers; loc = Node.location a } let readVariable (ctx: ParserContext) (v: Ts.VariableStatement) : Statement list = - v.declarationList.declarations |> List.ofSeq |> List.map (fun vd -> + v.declarationList.declarations |> Array.map (fun vd -> let comments = readCommentsForNamedDeclaration ctx vd - match getBindingName ctx vd.name with + match getBindingName vd.name with | None -> nodeWarn ctx vd "name is not defined for variable" UnknownStatement {| origText = Some (vd.getText()); loc = Node.location vd; comments = comments |} @@ -783,7 +766,7 @@ module private ParserImpl = let isExported = getExported vd.modifiers let accessibility = getAccessibility vd.modifiers Variable { comments = comments; loc = Node.location vd; name = name; typ = ty; isConst = isConst; isExported = isExported; accessibility = accessibility } - ) + ) |> List.ofArray let readFunction (ctx: ParserContext) (f: Ts.FunctionDeclaration) : Function option = match f.name with @@ -836,12 +819,12 @@ module private ParserImpl = let nes = bindings |> box :?> Ts.NamedExports let clauses = nes.elements - |> Seq.map (fun x -> + |> Array.map (fun x -> let inline ident (name: Ts.Identifier) = readIdent ctx name match x.propertyName with | None -> ES6ReExport {| target = ident x.name; renameAs = None |} | Some propertyName -> ES6ReExport {| target = ident propertyName; renameAs = Some x.name.text |}) - |> Seq.toList + |> List.ofArray Some clauses | _ -> nodeWarn ctx e "invalid syntax kind '%s' for an export declaration" (Enum.pp kind); None clauses |> Option.map (fun clauses -> @@ -860,12 +843,12 @@ module private ParserImpl = let nes = bindings |> box :?> Ts.NamedExports let clauses = nes.elements - |> Seq.map (fun x -> + |> Array.map (fun x -> let inline ident (name: Ts.Identifier) = readIdent ctx name match x.propertyName with | None -> ES6Export {| target = ident x.name; renameAs = None |} | Some propertyName -> ES6Export {| target = ident propertyName; renameAs = Some x.name.text |}) - |> Seq.toList + |> List.ofArray Some [Export { clauses = clauses; loc = Node.location nes; comments = comments; origText = e.getText() }] | _ -> nodeWarn ctx e "invalid syntax kind '%s' for an export declaration" (Enum.pp kind); None | _, _ -> nodeWarn ctx e "this kind of export statement is not supported."; None @@ -875,20 +858,18 @@ module private ParserImpl = let readImportEqualsDeclaration (ctx: ParserContext) (i: Ts.ImportEqualsDeclaration) : Statement option = let comments = readCommentsForNamedDeclaration ctx i - let moduleReference = !!i.moduleReference : Ts.Node - match moduleReference.kind with - | Kind.Identifier | Kind.QualifiedName -> - let kind = getKindFromName ctx moduleReference + match i.moduleReference with + | Ts.ModuleReference.Identifier _ | Ts.ModuleReference.QualifiedName _ -> + let kind = getKindFromName ctx !!i.moduleReference Import { comments = comments; loc = Node.location i; isTypeOnly = i.isTypeOnly; isExported = getExported i.modifiers; - clauses = [LocalImport {| name = i.name.text; kind = kind; target = readIdent ctx moduleReference |}] + clauses = [LocalImport {| name = i.name.text; kind = kind; target = readIdent ctx !!i.moduleReference |}] origText = i.getText() } |> Some - | Kind.ExternalModuleReference -> - let m : Ts.ExternalModuleReference = !!i.moduleReference + | Ts.ModuleReference.ExternalModuleReference m -> match (!!m.expression : Ts.Node).kind with | Kind.StringLiteral -> let moduleSpecifier = (!!m.expression : Ts.StringLiteral).text @@ -903,8 +884,6 @@ module private ParserImpl = } |> Some | kind -> nodeWarn ctx i "invalid kind '%s' for module specifier" (Enum.pp kind); None - | kind -> - nodeWarn ctx i "invalid kind '%s' for import" (Enum.pp kind); None let readImportDeclaration (ctx: ParserContext) (i: Ts.ImportDeclaration) : Statement option = match i.importClause with @@ -918,24 +897,22 @@ module private ParserImpl = Some (Import { comments = comments; loc = Node.location i; isTypeOnly = c.isTypeOnly; isExported = getExported i.modifiers; clauses = clauses; origText = i.getText() }) match c.name, c.namedBindings with | None, None -> create [ES6WildcardImport moduleSpecifier] - | None, Some b when (!!b : Ts.Node).kind = Kind.NamespaceImport -> - let n = (!!b : Ts.NamespaceImport) + | None, Some (Ts.NamedImportBindings.NamespaceImport n) -> let kind = getKindFromName ctx n.name create [NamespaceImport {| name = n.name.text; kind = kind; isES6Import = true; specifier = moduleSpecifier |}] - | _, Some b when (!!b : Ts.Node).kind = Kind.NamedImports -> - let n = (!!b : Ts.NamedImports) + | _, Some (Ts.NamedImportBindings.NamedImports n) -> let spec = {| specifier = moduleSpecifier |} let defaultImport = c.name |> Option.map (fun i -> ES6DefaultImport {| spec with name = i.text; kind = getKindFromName ctx i |}) let bindings = n.elements - |> Seq.toList - |> List.map (fun e -> + |> Array.map (fun e -> let kind = getKindFromName ctx e.name let name, renameAs = match e.propertyName with | Some i -> i.text, Some e.name.text | None -> e.name.text, None ES6Import {| spec with name = name; kind = kind; renameAs = renameAs |}) + |> List.ofArray create (Option.toList defaultImport @ bindings) | Some i, None -> create [ES6DefaultImport {| name = i.text; kind = getKindFromName ctx i; specifier = moduleSpecifier |}] @@ -951,7 +928,7 @@ module private ParserImpl = |> Option.defaultValue [] let tags = doc.tags - |> Option.map (Seq.map readJSDocTag >> List.ofSeq) + |> Option.map (Array.map readJSDocTag >> List.ofArray) |> Option.defaultValue [] desc @ tags @@ -960,28 +937,27 @@ module private ParserImpl = | [] -> None | xs -> FloatingComment {| comments = xs; loc = Node.location doc |} |> Some + type ModuleName = Ts.ModuleName let rec readModule (ctx: ParserContext) (md: Ts.ModuleDeclaration) : Statement = let name = - match (!!md.name : Ts.Node).kind with - | Kind.GlobalKeyword -> None - | Kind.Identifier -> - match (!!md.name : Ts.Identifier).text with + match md.name with + | ModuleName.Identifier i -> + match i.text with | "global" -> None | name -> Some name - | Kind.StringLiteral -> (!!md.name : Ts.StringLiteral).text |> Some - | _ -> nodeError ctx !!md.name "unsupported module name '%s'" (getText md.name) + | ModuleName.StringLiteral s -> s.text |> Some let check kind = - md.getChildren() |> Seq.exists (fun nd -> nd.kind = kind) + md.getChildren() |> Array.exists (fun nd -> nd.kind = kind) let isNamespace = check Kind.NamespaceKeyword let isExported = getExported md.modifiers let statements = md.getChildren() - |> Seq.toList + |> Array.toList |> List.collect (fun nd -> match nd.kind with | Kind.ModuleBlock -> let mb = nd :?> Ts.ModuleBlock - mb.statements |> List.ofSeq |> List.collect (readStatement ctx) + mb.statements |> List.ofArray |> List.collect (readStatement ctx) | Kind.NamespaceKeyword | Kind.ExportKeyword | Kind.Identifier | Kind.DeclareKeyword | Kind.StringLiteral | Kind.DotToken | Kind.SyntaxList | Kind.ModuleKeyword -> [] | Kind.JSDocComment -> [] @@ -992,8 +968,8 @@ module private ParserImpl = []) let comments = md.getChildren() - |> Seq.filter (fun nd -> nd.kind = Kind.JSDocComment) - |> List.ofSeq + |> Array.filter (fun nd -> nd.kind = Kind.JSDocComment) + |> List.ofArray |> List.collect (fun nd -> nd :?> Ts.JSDoc |> readJSDocImpl ctx) match name with | Some name -> @@ -1030,7 +1006,7 @@ module private ParserImpl = module Node = Node.Api /// works on NodeJS only. -let private getAllLocalReferences (ctx: #IContext<#IOptions>) (sourceFiles: Ts.SourceFile seq) = +let private getAllLocalReferences (ctx: #IContext<#IOptions>) (sourceFiles: Ts.SourceFile[]) = let sourceFilesMap = new MutableMap<_, _>() for sourceFile in sourceFiles do sourceFilesMap.Add(Path.absolute sourceFile.fileName, sourceFile) @@ -1094,8 +1070,7 @@ let private getAllLocalReferences (ctx: #IContext<#IOptions>) (sourceFiles: Ts.S open DataTypes -let createDependencyGraph (sourceFiles: Ts.SourceFile seq) = - let sourceFiles = Array.ofSeq sourceFiles +let createDependencyGraph (sourceFiles: Ts.SourceFile[]) = let files = sourceFiles |> Array.map (fun sf -> sf.fileName, sf) |> Map.ofArray let mutable graph = Graph.empty @@ -1113,7 +1088,7 @@ let createDependencyGraph (sourceFiles: Ts.SourceFile seq) = |> Option.iter (fun target -> graph <- graph |> Graph.add sourceFile.fileName target.fileName) - let go (sourceFile: Ts.SourceFile) (ns: Ts.Node seq) = + let go (sourceFile: Ts.SourceFile) (ns: Ts.Node[]) = for n in ns do match n.kind with | Ts.SyntaxKind.ImportEqualsDeclaration -> @@ -1126,11 +1101,11 @@ let createDependencyGraph (sourceFiles: Ts.SourceFile seq) = n.moduleSpecifier |> handleModuleSpecifier sourceFile | _ -> () - ns |> Seq.collect (fun n -> n.getChildren(sourceFile)) + ns |> Array.collect (fun n -> n.getChildren(sourceFile)) let goSourceFile (sourceFile: Ts.SourceFile) = - let mutable nodes : Ts.Node seq = !!sourceFile.statements - while not (nodes |> Seq.isEmpty) do + let mutable nodes : Ts.Node[] = !!sourceFile.statements + while not (nodes |> Array.isEmpty) do nodes <- go sourceFile nodes for source in sourceFiles do goSourceFile source @@ -1154,10 +1129,10 @@ let createContextFromFiles (ctx: #IContext<#IOptions>) compilerOptions (fileName |> Array.map assertFileExistsAndHasCorrectExtension else fileNames - |> Seq.map Path.absolute - |> Seq.map assertFileExistsAndHasCorrectExtension - |> Seq.map (fun a -> a, Node.fs.readFileSync(a, "utf-8")) - |> Seq.map (fun (a, i) -> + |> Array.map Path.absolute + |> Array.map assertFileExistsAndHasCorrectExtension + |> Array.map (fun a -> a, Node.fs.readFileSync(a, "utf-8")) + |> Array.map (fun (a, i) -> ts.createSourceFile (a, i, Ts.ScriptTarget.Latest, setParentNodes=true, scriptKind=Ts.ScriptKind.TS)) |> fun srcs -> ctx.logger.tracef "* following relative references..." @@ -1191,28 +1166,28 @@ let parse (ctx: ParserContext) : Input = let srcs = let targets = ctx.fileNames |> Set.ofArray ctx.program.getSourceFiles() - |> Seq.filter (fun sf -> targets |> Set.contains sf.fileName) + |> Array.filter (fun sf -> targets |> Set.contains sf.fileName) let sources = srcs - |> Seq.map (fun src -> + |> Array.map (fun src -> ctx.logger.tracef "* parsing %s..." src.fileName let references = - Seq.concat [ - src.referencedFiles |> Seq.map (fun x -> FileReference x.fileName) - src.typeReferenceDirectives |> Seq.map (fun x -> TypeReference x.fileName) - src.libReferenceDirectives |> Seq.map (fun x -> LibReference x.fileName) - ] |> Seq.toList + Array.concat [ + src.referencedFiles |> Array.map (fun x -> FileReference x.fileName) + src.typeReferenceDirectives |> Array.map (fun x -> TypeReference x.fileName) + src.libReferenceDirectives |> Array.map (fun x -> LibReference x.fileName) + ] |> Array.toList let statements = src.statements - |> Seq.collect ( + |> Array.toList + |> List.collect ( ParserImpl.readStatement (ctx |> JS.cloneWith (fun ctx -> ctx.currentSource <- src))) - |> Seq.toList { statements = statements fileName = src.fileName hasNoDefaultLib = src.hasNoDefaultLib references = references }) - |> List.ofSeq + |> List.ofArray let info = match sources with diff --git a/lib/TypeScriptHelper.fs b/lib/TypeScriptHelper.fs index 87fd4895..bd03d0e8 100644 --- a/lib/TypeScriptHelper.fs +++ b/lib/TypeScriptHelper.fs @@ -43,12 +43,12 @@ let createDummyCompilerHost (fileNames: string[]) (sourceFiles: Ts.SourceFile[]) !!host let createProgramForNode (fileNames: string[]) (options: Ts.CompilerOptions) = - ts.createProgram(ResizeArray fileNames, options, ts.createCompilerHost(options, true)) + ts.createProgram(fileNames, options, ts.createCompilerHost(options, true)) let createProgramForBrowser (sourceFiles: Ts.SourceFile[]) (options: Ts.CompilerOptions) = let fileNames = sourceFiles |> Array.map (fun s -> s.fileName) ts.createProgram( - ResizeArray (sourceFiles |> Array.map (fun s -> s.fileName)), + sourceFiles |> Array.map (fun s -> s.fileName), options, createDummyCompilerHost fileNames sourceFiles ) From 86f1df708ccc3ffbd478607353cc7f97dd7ffae6 Mon Sep 17 00:00:00 2001 From: cannorin Date: Mon, 9 May 2022 16:08:56 +0900 Subject: [PATCH 02/17] Reverse-merge common files from rescript-support --- lib/DataTypes/Text.fs | 8 + lib/DataTypes/Trie.fs | 8 +- lib/Extensions.fs | 14 +- lib/Naming.fs | 28 +-- lib/Typer.fs | 337 ++++++++++++++++++++++----- src/Common.fs | 26 +++ src/Targets/JsOfOCaml/Common.fs | 24 -- src/Targets/JsOfOCaml/OCamlHelper.fs | 24 +- src/Targets/JsOfOCaml/Writer.fs | 9 +- 9 files changed, 358 insertions(+), 120 deletions(-) diff --git a/lib/DataTypes/Text.fs b/lib/DataTypes/Text.fs index 9571cf99..8feef23d 100644 --- a/lib/DataTypes/Text.fs +++ b/lib/DataTypes/Text.fs @@ -103,3 +103,11 @@ module Text = | Indent x -> isMultiLine x | Concat (x, y) -> isMultiLine x || isMultiLine y | Empty | Str _ -> false + + /// Get the length of a text. Indents are ignored. + let rec length = function + | Empty -> 0 + | Newline -> 1 + | Str s -> s.Length + | Concat (x, y) -> length x + length y + | Indent x -> length x diff --git a/lib/DataTypes/Trie.fs b/lib/DataTypes/Trie.fs index 0f51cd5c..07681abe 100644 --- a/lib/DataTypes/Trie.fs +++ b/lib/DataTypes/Trie.fs @@ -7,10 +7,6 @@ type Trie<'k, 'v when 'k: comparison> = { type Trie<'k when 'k: comparison> = Trie<'k, unit> -type WeakTrie<'k when 'k: comparison> = { - children: Map<'k, WeakTrie<'k>> -} - module Trie = let empty<'k, 'v when 'k: comparison> : Trie<'k, 'v> = { value = None; children = Map.empty } @@ -165,6 +161,10 @@ module Trie = let toMap (t: Trie<'k, 'v>) : Map<'k list, 'v> = t |> fold (fun state ks v -> Map.add ks v state) Map.empty let ofMap (xs: Map<'k list, 'v>) : Trie<'k, 'v> = xs |> Map.fold (fun state ks v -> add ks v state) empty +type WeakTrie<'k when 'k: comparison> = { + children: Map<'k, WeakTrie<'k>> +} + module WeakTrie = let empty<'k when 'k: comparison> : WeakTrie<'k> = { children = Map.empty } diff --git a/lib/Extensions.fs b/lib/Extensions.fs index 8bf57769..cbaac63b 100644 --- a/lib/Extensions.fs +++ b/lib/Extensions.fs @@ -42,7 +42,7 @@ module String = let escape (s: string) = s .Replace("\\", "\\\\") - .Replace("'", "\\'").Replace("\"", "\\\"") + .Replace("\"", "\\\"") .Replace("\b", "\\b").Replace("\n", "\\n").Replace("\r", "\\r") .Replace("\t", "\\t") @@ -51,6 +51,10 @@ module String = state.Replace(e, "\\" + e) ) s + open Fable.Core + [] + let normalize (_: string) : string = jsNative + module Option = let iterNone f = function | Some x -> Some x @@ -71,6 +75,14 @@ module List = ) ([], []) List.rev xs1, List.rev xs2 + let splitChoice3 (xs: Choice<'t1, 't2, 't3> list) : 't1 list * 't2 list * 't3 list = + let xs1, xs2, xs3 = + xs |> List.fold (fun (xs1, xs2, xs3) -> function + | Choice1Of3 x -> x :: xs1, xs2, xs3 + | Choice2Of3 x -> xs1, x :: xs2, xs3 + | Choice3Of3 x -> xs1, xs2, x :: xs3) ([], [], []) + List.rev xs1, List.rev xs2, List.rev xs3 + module Map = let addNoOverwrite k v m = m |> Map.change k (function None -> Some v | Some v -> Some v) diff --git a/lib/Naming.fs b/lib/Naming.fs index 3878d151..4fcbe77d 100644 --- a/lib/Naming.fs +++ b/lib/Naming.fs @@ -127,29 +127,12 @@ let toCase (case: Case) (str: string) = | _, _ -> wordsToCase case words module Keywords = - let keywords = - Set.ofList [ - "and"; "as"; "assert"; "asr"; "begin"; "class"; - "constraint"; "do"; "done"; "downto"; "else"; "end"; - "exception"; "external"; "false"; "for"; "fun"; "function"; - "functor"; "if"; "in"; "include"; "inherit"; "initializer"; - "land"; "lazy"; "let"; "lor"; "lsl"; "lsr"; - "lxor"; "match"; "method"; "mod"; "module"; "mutable"; - "new"; "nonrec"; "object"; "of"; "open"; "or"; - "private"; "rec"; "sig"; "struct"; "then"; "to"; - "true"; "try"; "type"; "val"; "virtual"; "when"; - "while"; "with" - ] - let esKeywords = Set.ofList [ "Readonly"; "Partial"; "Pick"; "HTMLDialogElement"; "HTMLWebViewElement" ] - let primitives = Set.ofList [ "string"; "obj"; "unit"; "float"; "bool"; "int" ] - let basicTypes = Set.ofList [ "list"; "array"; "option" ] - let removeQuotesAndTrim (s: string) = if String.IsNullOrEmpty s then "" else @@ -157,3 +140,14 @@ let removeQuotesAndTrim (s: string) = if (c = '\"' || c = ''') then s.Trim(c).Trim() else s.Trim() + +let isValidJSIdentifier (s: string) = + if String.IsNullOrEmpty s then false + else + let cs = s.ToCharArray() + if cs[0] |> Char.IsDigit then false + else + cs |> Array.forall (fun c -> + Char.IsLetterOrDigit(c) + || c = '_' || c = '$' + ) diff --git a/lib/Typer.fs b/lib/Typer.fs index b6701197..7e15673e 100644 --- a/lib/Typer.fs +++ b/lib/Typer.fs @@ -16,6 +16,10 @@ type TyperOptions = /// Make class inherit `PromiseLike` when it has `then(onfulfilled: T => _, onrejected: _)`. abstract inheritPromiselike: bool with get,set + /// Make class contain all the members inherited from the parent classes. + /// Useful for targets without proper nominal subtyping. + abstract addAllParentMembersToClass: bool with get,set + /// Replaces alias to function type with named interface. /// ```ts /// type F = (...) => T // before @@ -83,11 +87,27 @@ type AnonymousInterfaceInfo = { origin: AnonymousInterfaceOrigin } +type [] KnownType = + | Ident of fullName:FullName + | AnonymousInterface of AnonymousInterface * AnonymousInterfaceInfo + +type [] ExportType = + | Child of ExportType * path:string list + | CommonJS + | ES6Default + | ES6 of renameAs:string option +with + member this.CreateChild(name) = + match this with + | Child (e, path) -> Child (e, path @ [name]) + | e -> Child (e, [name]) + type SourceFileInfo = { sourceFile: SourceFile definitionsMap: Trie typeLiteralsMap: Map anonymousInterfacesMap: Map + exportMap: Trie unknownIdentTypes: Trie> } @@ -167,6 +187,8 @@ module TyperContext = | _ -> List.rev ctx._currentNamespace @ name { name = name; source = ctx._currentSourceFile } + let getFullNameOfCurrentNamespace (ctx: TyperContext<'a, 's>) : FullName = getFullName [] ctx + let getFullNameString (name: string list) (ctx: TyperContext<'a, 's>) = (getFullName name ctx).name |> String.concat "." @@ -188,6 +210,11 @@ module TyperContext = ctx.logger.errorf "%s not in [%s]" ctx._currentSourceFile (ctx._info |> Map.toSeq |> Seq.map fst |> String.concat ", ") ctx._info |> Map.tryFind ctx._currentSourceFile |> Option.bind f + let getExportTypeOfName (name: string list) (ctx: TyperContext<'a, 's>) = + ctx |> bindCurrentSourceInfo (fun info -> + info.exportMap |> Trie.tryFind (ctx.currentNamespace @ name) + ) + module FullName = let getDefinitions (ctx: TyperContext<_, _>) (fullName: FullName) : Definition list = match ctx.info |> Map.tryFind fullName.source with @@ -197,6 +224,11 @@ module FullName = |> Trie.tryFind fullName.name |> Option.defaultValue [] + let getExportType (ctx: TyperContext<_, _>) (fullName: FullName) : ExportType option = + match ctx.info |> Map.tryFind fullName.source with + | None -> None + | Some info -> info.exportMap |> Trie.tryFind fullName.name + let private classify = function | Definition.TypeAlias _ -> Kind.OfTypeAlias | Definition.Class c -> if c.isInterface then Kind.OfInterface else Kind.OfClass @@ -235,6 +267,12 @@ module Ident = let pickDefinitionWithFullName ctx ident (picker: FullName -> Definition -> _ option) = getDefinitionsWithFullName ctx ident |> List.tryPick (fun x -> picker x.fullName x.definition) + let collectDefinition ctx ident collector = + getDefinitions ctx ident |> List.collect collector + + let collectDefinitionWithFullName ctx ident (collector: FullName -> Definition -> _ list) = + getDefinitionsWithFullName ctx ident |> List.collect (fun x -> collector x.fullName x.definition) + let hasKind (ctx: TyperContext<_, _>) (kind: Kind) (ident: Ident) = match ident.kind with | Some kinds -> kinds |> Set.contains kind @@ -270,6 +308,12 @@ module Type = args = List.map (mapInArg mapping ctx) f.args } and mapInClass mapping (ctx: 'Context) (c: Class<'a>) : Class<'a> = + { c with + implements = c.implements |> List.map (mapping ctx) + members = c.members |> List.map (mapInMember mapping ctx) + typeParams = c.typeParams |> List.map (mapInTypeParam mapping ctx) } + + and mapInMember mapping ctx (ma, m) = let mapMember = function | Field (f, m) -> Field (mapInFieldLike mapping ctx f, m) | Callable (f, tps) -> Callable (mapInFuncType mapping ctx f, List.map (mapInTypeParam mapping ctx) tps) @@ -281,10 +325,7 @@ module Type = | Method (name, f, tps) -> Method (name, mapInFuncType mapping ctx f, List.map (mapInTypeParam mapping ctx) tps) | SymbolIndexer (sn, ft, m) -> SymbolIndexer (sn, mapInFuncType mapping ctx ft, m) | UnknownMember msgo -> UnknownMember msgo - { c with - implements = c.implements |> List.map (mapping ctx) - members = c.members |> List.map (fun (a, m) -> a, mapMember m) - typeParams = c.typeParams |> List.map (mapInTypeParam mapping ctx) } + ma, mapMember m and mapInFieldLike mapping (ctx: 'Context) (fl: FieldLike) : FieldLike = { fl with value = mapping ctx fl.value } @@ -507,6 +548,14 @@ module Type = | [] -> [] maxArity :: go maxArity typrms |> Set.ofList + let matchArity arity (typrms: TypeParam list) : TypeParam list option = + let rec go i acc = function + | tp :: rest when i > 0 -> go (i-1) (tp :: acc) rest + | { defaultType = None } :: _ -> None + | { defaultType = Some _ } :: rest -> go 0 acc rest + | [] -> if i = 0 then List.rev acc |> Some else None + go arity [] typrms + let createFunctionInterface (funcs: {| ty: FuncType; typrms: TypeParam list; comments: Comment list; loc: Location; isNewable: bool |} list) = let usedTyprms = funcs |> Seq.collect (fun f -> getTypeVars (Func (f.ty, f.typrms, f.loc))) |> Set.ofSeq @@ -599,6 +648,9 @@ module Type = | App (APrim p, ts, _) -> if includeSelf then yield InheritingType.Prim (p, ts), depth + | Intersection i -> + for t in i.types do + yield! getAllInheritancesImpl (depth+1) includeSelf ctx t | _ -> if includeSelf then yield InheritingType.Other ty, depth @@ -661,6 +713,25 @@ module Type = let getAllInheritancesAndSelf ctx ty = getAllInheritancesImpl 0 true ctx ty |> removeDuplicatesFromInheritingTypes let getAllInheritancesAndSelfFromName ctx fn = getAllInheritancesFromNameImpl 0 true ctx fn |> removeDuplicatesFromInheritingTypes + let isSuperClass ctx (super: Type) (sub: Type) = + Set.isProperSubset (getAllInheritancesAndSelf ctx super) (getAllInheritancesAndSelf ctx sub) + + let isSubClass ctx (sub: Type) (super: Type) = + Set.isProperSuperset (getAllInheritancesAndSelf ctx super) (getAllInheritancesAndSelf ctx sub) + + let getKnownTypes (ctx: TyperContext<_, _>) t = + findTypes (fun state -> function + | Ident { fullName = fns } -> None, state, List.map KnownType.Ident fns + | AnonymousInterface a -> + let info = + ctx |> TyperContext.bindCurrentSourceInfo (fun info -> info.anonymousInterfacesMap |> Map.tryFind a) + None, state, + match info with + | None -> [] + | Some info -> [KnownType.AnonymousInterface (a, info)] + | _ -> None, state, [] + ) () t |> Set.ofSeq + let rec resolveErasedTypeImpl typeQueries ctx = function | PolymorphicThis -> PolymorphicThis | Intrinsic -> Intrinsic | Ident i -> Ident i | TypeVar v -> TypeVar v | Prim p -> Prim p | TypeLiteral l -> TypeLiteral l @@ -921,63 +992,9 @@ module Type = s1 + s2 | UnknownType _ -> "unknown" -type [] KnownType = - | Ident of fullName:FullName - | AnonymousInterface of AnonymousInterface * AnonymousInterfaceInfo - module Statement = open Type - let createDefinitionsMap (stmts: Statement list) : Trie = - let add ns name x trie = - let key = List.rev (name :: ns) - trie |> Trie.addOrUpdate key [x] List.append - let rec go (ns: string list) trie s = - match s with - | Export _ - | ReExport _ - | UnknownStatement _ - | FloatingComment _ -> trie - | Import import -> - import.clauses - |> List.fold (fun trie c -> - match c with - | NamespaceImport i -> trie |> add ns i.name (Definition.Import (c, import)) - | ES6WildcardImport _ -> trie - | ES6Import i -> trie |> add ns i.name (Definition.Import (c, import)) - | ES6DefaultImport i -> trie |> add ns i.name (Definition.Import (c, import)) - | LocalImport i -> trie |> add ns i.name (Definition.Import (c, import)) - ) trie - | TypeAlias a -> trie |> add ns a.name (Definition.TypeAlias a) - | Class c -> - match c.name with - | Name name -> - c.members - |> List.fold (fun trie (ma, m) -> - let ns = name :: ns - let d = Definition.Member (ma, m, c) - match m with - | Field (fl, _) | Getter fl | Setter fl -> trie |> add ns fl.name d - | Method (n, _, _) -> trie |> add ns n d - | _ -> trie - ) trie - |> add ns name (Definition.Class c) - | ExportDefaultUnnamedClass -> trie - | Enum e -> - e.cases - |> List.fold (fun trie c -> trie |> add (e.name :: ns) c.name (Definition.EnumCase (c, e))) trie - |> add ns e.name (Definition.Enum e) - | Variable v -> trie |> add ns v.name (Definition.Variable v) - | Function f -> trie |> add ns f.name (Definition.Function f) - | Pattern p -> p.underlyingStatements |> List.fold (go ns) trie - | Module m -> - m.statements - |> List.fold (go (m.name :: ns)) trie - |> add ns m.name (Definition.Module m) - | Global m -> - m.statements |> List.fold (go []) trie - stmts |> List.fold (go []) Trie.empty - type StatementFinder<'State, 'Result> = string list -> 'State -> Statement -> Statement list option * 'State * 'Result seq @@ -1760,6 +1777,79 @@ let addDefaultConstructorToClass (ctx: TyperContext<_, _>) (stmts: Statement lis | x -> x) go stmts +[] +type private MemberType = + | Getter of string | Setter of string + | Method of string * int | Callable of int | Newable of int | Indexer of int | Constructor of int + +let addParentMembersToClass (ctx: TyperContext<#TyperOptions, _>) (stmts: Statement list) : Statement list = + if not ctx.options.addAllParentMembersToClass then stmts + else + let m = new MutableMap() + let processing = new MutableSet() + let rec addMembers (c: Class) = + match m.TryGetValue(c.loc) with + | true, c -> c + | false, _ when processing.Contains(c.loc) -> c + | false, _ -> + processing.Add(c.loc) |> ignore + // we remove any parent type which is a super type of some other parent type + let implements = + c.implements + |> List.filter (fun t -> c.implements |> List.forall (fun t' -> Type.isSuperClass ctx t t' |> not)) + let getMemberType m = + match m with + | Field (fl, _) | Getter fl -> MemberType.Getter (fl.name |> String.normalize) |> Some + | Setter fl -> MemberType.Setter (fl.name |> String.normalize) |> Some + | Method (name, ft, _) -> MemberType.Method (name |> String.normalize, ft.args.Length) |> Some + | Callable (ft, _) -> MemberType.Callable (ft.args.Length) |> Some + | Newable (ft, _) -> MemberType.Newable (ft.args.Length) |> Some + | Indexer (ft, _) -> MemberType.Indexer (ft.args.Length) |> Some + | Constructor ft -> MemberType.Constructor (ft.args.Length) |> Some + | SymbolIndexer _ | UnknownMember _ -> None + // if a parent member has the same arity as the member in a child, + // we should only keep the one from the child. + let memberTypes : Set = + c.members |> List.choose (snd >> getMemberType) |> Set.ofList + let parentMembers : (MemberAttribute * Member) list = + let (|Dummy|) _ = [] + let rec collector : _ -> _ list = function + | (Ident ({ loc = loc } & i) & Dummy ts) | App (AIdent i, ts, loc) -> + let collect = function + | Definition.TypeAlias a -> + if List.isEmpty ts then collector a.target + else + let bindings = Type.createBindings i.name loc a.typeParams ts + collector a.target |> List.map (Type.mapInMember (Type.substTypeVar bindings) ()) + // we ignore `implements` clauses i.e. interfaces inherited by a class. + | Definition.Class c' when c.isInterface || not c'.isInterface -> + if List.isEmpty ts then (addMembers c').members + else + let members = (addMembers c').members + let bindings = Type.createBindings i.name loc c'.typeParams ts + members |> List.map (Type.mapInMember (Type.substTypeVar bindings) ()) + | _ -> [] + Ident.collectDefinition ctx i collect |> List.distinct + | Intersection i -> i.types |> List.collect collector |> List.distinct + | _ -> [] + implements + |> List.collect collector + |> List.filter (fun (_, m) -> + match getMemberType m with + | None -> false + | Some mt -> memberTypes |> Set.contains mt |> not) + |> List.distinct + let c = { c with members = c.members @ parentMembers } + m[c.loc] <- c + c + let rec go stmts = + stmts |> List.map (function + | Class c when c.isInterface -> Class (addMembers c) + | Module m -> Module { m with statements = go m.statements } + | Global m -> Global { m with statements = go m.statements } + | x -> x) + go stmts + let introduceAdditionalInheritance (ctx: IContext<#TyperOptions>) (stmts: Statement list) : Statement list = let opts = ctx.options let rec go stmts = @@ -1776,7 +1866,14 @@ let introduceAdditionalInheritance (ctx: IContext<#TyperOptions>) (stmts: Statem ) let inline app t ts loc = - App (AIdent { name = [t]; kind = Some (Set.ofList [Kind.Type; Kind.ClassLike; Kind.Statement]); fullName = []; loc = loc; parent = None}, ts, loc) + App ( + AIdent { + name = [t] + kind = Some (Set.ofList [Kind.Type; Kind.ClassLike; Kind.Statement]) + fullName = [{ name = [t]; source = "lib.es.d.ts" }] + loc = loc + parent = None + }, ts, loc) for ma, m in c.members do match m with @@ -1967,16 +2064,128 @@ let replaceFunctions (ctx: #IContext<#TyperOptions>) (stmts: Statement list) = | _ -> None Statement.mapTypeWith goStatement goType (fun _ x -> x) id ctx stmts +let createExportMap (stmts: Statement list) : Trie = + let add ns name xo trie = + match xo with + | Some x -> trie |> Trie.add (List.rev (name :: ns)) x + | None -> trie + let rec go (eo: ExportType option) (ns: string list) trie stmts = + let exportMap = + stmts + |> List.collect (function + | Export e -> + e.clauses |> List.choose (function + | CommonJsExport { name = [name] } -> + Some (name, ExportType.CommonJS) + | ES6DefaultExport { name = [name] } -> + Some (name, ExportType.ES6Default) + | ES6Export e when e.target.name.Length = 1 -> + let name = e.target.name[0] + Some (name, ExportType.ES6 e.renameAs) + | _ -> None + ) + | _ -> []) + |> Map.ofList + let getExportType name (isExported: Exported) = + match isExported with + | Exported.Yes -> Some (ExportType.ES6 None) + | Exported.Default -> Some ExportType.ES6Default + | Exported.Declared | Exported.No -> + match exportMap |> Map.tryFind name with + | Some e -> Some e + | None -> eo |> Option.map (fun e -> e.CreateChild name) + let rec f trie s = + match s with + | Export _ | ReExport _ | UnknownStatement _ | FloatingComment _ | Import _ | TypeAlias _ -> trie + | Pattern p -> p.underlyingStatements |> List.fold f trie + | Module m -> + if m.isNamespace then + let eo = getExportType m.name m.isExported + let trie = trie |> add ns m.name eo + go eo (m.name :: ns) trie m.statements + else + go None (m.name :: ns) trie m.statements + | Global m -> go None [] trie m.statements + | Class c -> + if c.isInterface then trie + else + match c.name with + | ExportDefaultUnnamedClass -> trie + | Name n -> trie |> add ns n (getExportType n c.isExported) + | Enum e -> + let eo = getExportType e.name e.isExported + let trie = trie |> add ns e.name eo + e.cases |> List.fold (fun trie c -> + let ceo = eo |> Option.map (fun e -> e.CreateChild c.name) + trie |> add (e.name :: ns) c.name ceo + ) trie + | Variable { name = name; isExported = isExported } + | Function { name = name; isExported = isExported } -> + trie |> add ns name (getExportType name isExported) + stmts |> List.fold f trie + go None [] Trie.empty stmts + +let createDefinitionsMap (stmts: Statement list) : Trie = + let add ns name x trie = + let key = List.rev (name :: ns) + trie |> Trie.addOrUpdate key [x] List.append + let rec go (ns: string list) trie s = + match s with + | Export _ + | ReExport _ + | UnknownStatement _ + | FloatingComment _ -> trie + | Import import -> + import.clauses + |> List.fold (fun trie c -> + match c with + | NamespaceImport i -> trie |> add ns i.name (Definition.Import (c, import)) + | ES6WildcardImport _ -> trie + | ES6Import i -> trie |> add ns i.name (Definition.Import (c, import)) + | ES6DefaultImport i -> trie |> add ns i.name (Definition.Import (c, import)) + | LocalImport i -> trie |> add ns i.name (Definition.Import (c, import)) + ) trie + | TypeAlias a -> trie |> add ns a.name (Definition.TypeAlias a) + | Class c -> + match c.name with + | Name name -> + c.members + |> List.fold (fun trie (ma, m) -> + let ns = name :: ns + let d = Definition.Member (ma, m, c) + match m with + | Field (fl, _) | Getter fl | Setter fl -> trie |> add ns fl.name d + | Method (n, _, _) -> trie |> add ns n d + | _ -> trie + ) trie + |> add ns name (Definition.Class c) + | ExportDefaultUnnamedClass -> trie + | Enum e -> + e.cases + |> List.fold (fun trie c -> trie |> add (e.name :: ns) c.name (Definition.EnumCase (c, e))) trie + |> add ns e.name (Definition.Enum e) + | Variable v -> trie |> add ns v.name (Definition.Variable v) + | Function f -> trie |> add ns f.name (Definition.Function f) + | Pattern p -> p.underlyingStatements |> List.fold (go ns) trie + | Module m -> + m.statements + |> List.fold (go (m.name :: ns)) trie + |> add ns m.name (Definition.Module m) + | Global m -> + m.statements |> List.fold (go []) trie + stmts |> List.fold (go []) Trie.empty + let private createRootContextForTyper (srcs: SourceFile list) (baseCtx: IContext<'Options>) : TyperContext<'Options, unit> = let info = srcs |> List.map (fun sf -> sf.fileName, { sourceFile = sf - definitionsMap = Statement.createDefinitionsMap sf.statements + definitionsMap = createDefinitionsMap sf.statements typeLiteralsMap = Map.empty anonymousInterfacesMap = Map.empty - unknownIdentTypes = Trie.empty }) + unknownIdentTypes = Trie.empty + exportMap = Trie.empty }) |> Map.ofList { _currentSourceFile = ""; _currentNamespace = []; _info = info; _state = () @@ -1994,10 +2203,12 @@ let createRootContext (srcs: SourceFile list) (baseCtx: IContext<'Options>) : Ty Statement.getAnonymousInterfaces stmts |> Seq.mapi (fun i (c, info) -> c, { id = i; namespace_ = info.namespace_; origin = info.origin }) |> Map.ofSeq let uit = Statement.getUnknownIdentTypes ctx stmts + let exm = createExportMap stmts { v with typeLiteralsMap = tlm anonymousInterfacesMap = aim - unknownIdentTypes = uit } + unknownIdentTypes = uit + exportMap = exm } ) } module Ts = TypeScript.Ts @@ -2070,6 +2281,8 @@ let runAll (srcs: SourceFile list) (baseCtx: IContext<#TyperOptions>) = withSourceFileContext ctx (fun ctx src -> src |> mapStatements (fun stmts -> stmts + // add members inherited from parent classes/interfaces to interfaces + |> addParentMembersToClass ctx |> Statement.resolveErasedTypes ctx // add common inheritances which tends not to be defined by `extends` or `implements` |> introduceAdditionalInheritance ctx diff --git a/src/Common.fs b/src/Common.fs index 8d18701a..a3a1bfd8 100644 --- a/src/Common.fs +++ b/src/Common.fs @@ -1,6 +1,32 @@ [] module Common +open Fable.Core + +[] +type FeatureFlag = + | [] Full + | [] Provide + | [] Consume + | [] Off + | [] Default +with + static member Values = [|Full; Provide; Consume; Off; Default|] + + member this.HasProvide = match this with Full | Provide -> true | _ -> false + member this.HasConsume = match this with Full | Consume -> true | _ -> false + member this.IsOffOrDefault = match this with Off | Default -> true | _ -> false + + member this.WithProvide(b: bool) = + match this with + | Provide | Off | Default -> if b then Provide else Off + | Full | Consume -> if b then Full else Consume + + member this.WithConsume(b: bool) = + match this with + | Consume | Off | Default -> if b then Consume else Off + | Full | Provide -> if b then Full else Provide + open Ts2Ml.Common type GlobalOptions = diff --git a/src/Targets/JsOfOCaml/Common.fs b/src/Targets/JsOfOCaml/Common.fs index 31f396be..1096d358 100644 --- a/src/Targets/JsOfOCaml/Common.fs +++ b/src/Targets/JsOfOCaml/Common.fs @@ -15,30 +15,6 @@ with member this.IsOffOrDefault = match this with Off | Default -> true | _ -> false -[] -type FeatureFlag = - | [] Full - | [] Provide - | [] Consume - | [] Off - | [] Default -with - static member Values = [|Full; Provide; Consume; Off; Default|] - - member this.HasProvide = match this with Full | Provide -> true | _ -> false - member this.HasConsume = match this with Full | Consume -> true | _ -> false - member this.IsOffOrDefault = match this with Off | Default -> true | _ -> false - - member this.WithProvide(b: bool) = - match this with - | Provide | Off | Default -> if b then Provide else Off - | Full | Consume -> if b then Full else Consume - - member this.WithConsume(b: bool) = - match this with - | Consume | Off | Default -> if b then Consume else Off - | Full | Provide -> if b then Full else Provide - [] type Simplify = | [] All diff --git a/src/Targets/JsOfOCaml/OCamlHelper.fs b/src/Targets/JsOfOCaml/OCamlHelper.fs index 37727746..d97565bb 100644 --- a/src/Targets/JsOfOCaml/OCamlHelper.fs +++ b/src/Targets/JsOfOCaml/OCamlHelper.fs @@ -298,6 +298,20 @@ let external_ name tyarg tyret extName = // we don't sanitize names in OCamlHelper; callers should do it themselves module Naming = + let keywords = + Set.ofList [ + "and"; "as"; "assert"; "asr"; "begin"; "class"; + "constraint"; "do"; "done"; "downto"; "else"; "end"; + "exception"; "external"; "false"; "for"; "fun"; "function"; + "functor"; "if"; "in"; "include"; "inherit"; "initializer"; + "land"; "lazy"; "let"; "lor"; "lsl"; "lsr"; + "lxor"; "match"; "method"; "mod"; "module"; "mutable"; + "new"; "nonrec"; "object"; "of"; "open"; "or"; + "private"; "rec"; "sig"; "struct"; "then"; "to"; + "true"; "try"; "type"; "val"; "virtual"; "when"; + "while"; "with" + ] + let ourReservedNames = set [ "create"; "apply"; "invoke"; "get"; "set"; "cast_from" @@ -305,7 +319,7 @@ module Naming = let reservedValueNames = Set.unionMany [ - Naming.Keywords.keywords + keywords ourReservedNames ] @@ -333,12 +347,12 @@ module Naming = else if Char.IsUpper name.[0] then sprintf "%c%s" (Char.ToLower name.[0]) name.[1..] else name - if Naming.Keywords.keywords |> Set.contains result then result + "_" else result + if keywords |> Set.contains result then result + "_" else result let reservedModuleNames = Set.ofList [ "Export"; "Default" - ] |> Set.union Naming.Keywords.keywords + ] |> Set.union keywords let moduleNameReserved (name: string) = let name = removeInvalidChars name @@ -358,7 +372,7 @@ module Naming = if Char.IsLower s.[0] then sprintf "%c%s" (Char.ToUpper s.[0]) s.[1..] else s - if Naming.Keywords.keywords |> Set.contains result then result + "_" else result + if keywords |> Set.contains result then result + "_" else result let structured (baseName: string -> string) (name: string list) = let rec prettify = function @@ -372,7 +386,7 @@ module Naming = let result = if Char.IsUpper s.[0] then "_" + s else s - if Naming.Keywords.keywords |> Set.contains result then result + "_" else result + if keywords |> Set.contains result then result + "_" else result let createTypeNameOfArity arity maxArityOpt name = match maxArityOpt with diff --git a/src/Targets/JsOfOCaml/Writer.fs b/src/Targets/JsOfOCaml/Writer.fs index 537e4fee..8385b4d3 100644 --- a/src/Targets/JsOfOCaml/Writer.fs +++ b/src/Targets/JsOfOCaml/Writer.fs @@ -132,9 +132,7 @@ type EmitTypeFlags = { skipAttributesOnContravariantPosition: bool avoidTheseArgumentNames: Set forceVariadic: bool - hasTypeArgumentsHandled: bool forceSkipAttributes: bool - convertNonIdentityPrimitives: bool simplifyContravariantUnion: bool } @@ -148,9 +146,7 @@ module EmitTypeFlags = skipAttributesOnContravariantPosition = false avoidTheseArgumentNames = Set.empty forceVariadic = false - hasTypeArgumentsHandled = false forceSkipAttributes = false - convertNonIdentityPrimitives = false simplifyContravariantUnion = false } @@ -193,7 +189,7 @@ let rec emitTypeImpl (flags: EmitTypeFlags) (overrideFunc: OverrideFunc) (ctx: C let forceSkipAttr text = if flags.forceSkipAttributes then empty else text let treatIdent (i: Ident) (tyargs: Type list) (loc: Location) = let arity = List.length tyargs - let flagsForArgs = { flags with needParen = true; forceVariadic = false; convertNonIdentityPrimitives = true } + let flagsForArgs = { flags with needParen = true; forceVariadic = false } let withTyargs ty = Type.appOpt ty (tyargs |> List.map (emitTypeImpl flagsForArgs overrideFunc ctx)) let origin = @@ -276,7 +272,7 @@ let rec emitTypeImpl (flags: EmitTypeFlags) (overrideFunc: OverrideFunc) (ctx: C commentStr (sprintf "FIXME: type '%s' cannot be used for variadic argument" (Type.pp ty)) + Type.app Type.array [Type.any] | App (t, ts, loc) -> let emit t ts = - Type.appOpt (emitTypeImpl { flags with hasTypeArgumentsHandled = true } overrideFunc ctx t) (List.map (emitTypeImpl { flags with needParen = true } overrideFunc ctx) ts) + Type.appOpt (emitTypeImpl flags overrideFunc ctx t) (List.map (emitTypeImpl { flags with needParen = true } overrideFunc ctx) ts) match t with | AIdent i -> treatIdent i ts loc | APrim _ | AAnonymousInterface _ -> emit (Type.ofAppLeftHandSide t) ts @@ -1180,7 +1176,6 @@ let rec emitClass flags overrideFunc (ctx: Context) (current: StructuredText) (c let nulls, others = u.types |> List.partition (function Prim Null | Prim Undefined -> true | _ -> false) if List.isEmpty nulls then fl.value, fl.isOptional - else if List.isEmpty others then Prim Null, true else Union { types = others }, true | _ -> fl.value, fl.isOptional {| fl with value = value |> emitType_ innerCtx; isOptional = isOptional |} From 44eb828810c273a7263a29f1ccb39e90891ef265 Mon Sep 17 00:00:00 2001 From: cannorin Date: Mon, 9 May 2022 17:56:20 +0900 Subject: [PATCH 03/17] Use impossible and |? --- lib/Extensions.fs | 6 + lib/JsHelper.fs | 4 +- lib/Parser.fs | 16 +- lib/Typer.fs | 16 +- src/Extensions.fs | 2 +- src/Parser.fs | 954 -------------------------------- src/Targets/JsOfOCaml/Writer.fs | 176 +++--- 7 files changed, 113 insertions(+), 1061 deletions(-) delete mode 100755 src/Parser.fs diff --git a/lib/Extensions.fs b/lib/Extensions.fs index cbaac63b..8a756737 100644 --- a/lib/Extensions.fs +++ b/lib/Extensions.fs @@ -1,6 +1,12 @@ [] module Ts2Ml.Extensions +let inline (|?) (xo: 'a option) (y: 'a) : 'a = Option.defaultValue y xo + +/// Use when a certain code path is impossible or unreachable. +let impossible fmt = + Printf.ksprintf (fun msg -> failwith ("impossible: " + msg)) fmt + open System module Enum = diff --git a/lib/JsHelper.fs b/lib/JsHelper.fs index af5b9d31..610b1fca 100644 --- a/lib/JsHelper.fs +++ b/lib/JsHelper.fs @@ -21,7 +21,7 @@ let getPackageJsonPath (exampleFilePath: string) = match rest with | userName :: packageName :: _ when userName.StartsWith("@") -> [userName; packageName] | packageName :: _ -> [packageName] - | _ -> failwith "impossible_getPackageJsonPath_root" + | _ -> impossible "getPackageJsonPath_root" let path = prefix @ packageName @ ["package.json"] |> String.concat Path.separator @@ -163,7 +163,7 @@ let getJsModuleName (info: Syntax.PackageInfo option) (sourceFile: Path.Absolute match List.rev rest with | "index.d.ts" :: name :: _ -> name | name :: _ -> stripExtension name - | [] -> failwith "impossible" + | [] -> impossible "getJsModuleName_getSubmodule" match info with | Some info -> if info.indexFile |> Option.exists ((=) sourceFile) then diff --git a/lib/Parser.fs b/lib/Parser.fs index 4d8aa1d1..b0ab51d7 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -251,7 +251,7 @@ module private ParserImpl = |> Array.toList let readJSDocTag (tag: Ts.JSDocTag) : Comment = - let text = tag.comment |> Option.map readCommentText |> Option.defaultValue [] + let text = tag.comment |> Option.map readCommentText |? [] match tag.kind with | Kind.JSDocParameterTag -> let tag = tag :?> Ts.JSDocParameterTag @@ -376,7 +376,7 @@ module private ParserImpl = match t.kind with | Kind.TypeReference -> !!(t :?> Ts.TypeReferenceNode).typeName | Kind.ExpressionWithTypeArguments -> !!(t :?> Ts.ExpressionWithTypeArguments).expression - | _ -> failwith "impossible" + | _ -> impossible "readTypeNode_TypeReference" match readIdentOrTypeVar ctx typrm lhs with | Choice1Of2 lt -> match t.typeArguments with @@ -508,7 +508,7 @@ module private ParserImpl = { args = args; isVariadic = isVariadic; returnType = retType; loc = Node.location parent } and readMemberAttribute (ctx: ParserContext) (nd: Ts.NamedDeclaration) : MemberAttribute = - let accessibility = getAccessibility nd.modifiers |> Option.defaultValue Public + let accessibility = getAccessibility nd.modifiers |? Public let isStatic = hasModifier Kind.StaticKeyword nd.modifiers let comments = readCommentsForNamedDeclaration ctx nd { accessibility = accessibility; isStatic = isStatic; comments = comments; loc = Node.location nd } @@ -675,7 +675,7 @@ module private ParserImpl = { comments = readCommentsForNamedDeclaration ctx i name = Name name - accessibility = getAccessibility i.modifiers |> Option.defaultValue Public + accessibility = getAccessibility i.modifiers |? Public typeParams = typrms implements = readInherits typrmsSet ctx i.heritageClauses isInterface = true @@ -689,8 +689,8 @@ module private ParserImpl = let typrmsSet = typrms |> List.map (fun tp -> tp.name) |> Set.ofList { comments = readCommentsForNamedDeclaration ctx i - name = i.name |> Option.map (fun id -> Name id.text) |> Option.defaultValue ExportDefaultUnnamedClass - accessibility = getAccessibility i.modifiers |> Option.defaultValue Public + name = i.name |> Option.map (fun id -> Name id.text) |? ExportDefaultUnnamedClass + accessibility = getAccessibility i.modifiers |? Public typeParams = typrms implements = readInherits typrmsSet ctx i.heritageClauses isInterface = false @@ -925,11 +925,11 @@ module private ParserImpl = let desc = doc.comment |> Option.map (readCommentText >> Description >> List.singleton) - |> Option.defaultValue [] + |? [] let tags = doc.tags |> Option.map (Array.map readJSDocTag >> List.ofArray) - |> Option.defaultValue [] + |? [] desc @ tags let readJSDoc (ctx: ParserContext) (doc: Ts.JSDoc) : Statement option = diff --git a/lib/Typer.fs b/lib/Typer.fs index 7e15673e..337d9c10 100644 --- a/lib/Typer.fs +++ b/lib/Typer.fs @@ -222,7 +222,7 @@ module FullName = | Some info -> info.definitionsMap |> Trie.tryFind fullName.name - |> Option.defaultValue [] + |? [] let getExportType (ctx: TyperContext<_, _>) (fullName: FullName) : ExportType option = match ctx.info |> Map.tryFind fullName.source with @@ -236,7 +236,7 @@ module FullName = | Definition.EnumCase _ -> Kind.OfEnumCase | Definition.Module m -> if m.isNamespace then Kind.OfNamespace else Kind.OfModule | Definition.Variable _ | Definition.Function _ -> Kind.OfValue - | Definition.Import (c, _) -> c.kind |> Option.map Set.toList |> Option.defaultValue [] + | Definition.Import (c, _) -> c.kind |> Option.map Set.toList |? [] | Definition.Member _ -> Kind.OfMember let hasKind (ctx: TyperContext<_, _>) (kind: Kind) (fullName: FullName) = @@ -422,8 +422,8 @@ module Type = let rec findTypesInFieldLike pred s (fl: FieldLike) = findTypes pred s fl.value and findTypesInTypeParam pred s (tp: TypeParam) = seq { - yield! tp.extends |> Option.map (findTypes pred s) |> Option.defaultValue Seq.empty - yield! tp.defaultType |> Option.map (findTypes pred s) |> Option.defaultValue Seq.empty + yield! tp.extends |> Option.map (findTypes pred s) |? Seq.empty + yield! tp.defaultType |> Option.map (findTypes pred s) |? Seq.empty } and findTypesInFuncType pred s (ft: FuncType) = seq { @@ -1080,8 +1080,8 @@ module Statement = and treatTypeParameters (state: {| origin: AnonymousInterfaceOrigin; namespace_: string list |}) (tps: TypeParam list) = seq { for tp in tps do - yield! tp.extends |> Option.map (findTypes typeFinder state) |> Option.defaultValue Seq.empty - yield! tp.defaultType |> Option.map (findTypes typeFinder state) |> Option.defaultValue Seq.empty + yield! tp.extends |> Option.map (findTypes typeFinder state) |? Seq.empty + yield! tp.defaultType |> Option.map (findTypes typeFinder state) |? Seq.empty } and treatNamed (state: {| origin: AnonymousInterfaceOrigin; namespace_: string list |}) name value = findTypes typeFinder {| state with origin = { state.origin with valueName = Some name } |} value @@ -1442,7 +1442,7 @@ module ResolvedUnion = let inline getLiteralFieldsFromClass c = getLiteralFieldsFromClass getLiteralFieldsFromType c match ty with | Intrinsic | PolymorphicThis | TypeVar _ | Prim _ | TypeLiteral _ | Tuple _ | Func _ | NewableFunc _ -> Map.empty - | Erased _ -> failwith "impossible_getDiscriminatedFromUnion_getLiteralFieldsFromType_Erased" + | Erased _ -> impossible "getDiscriminatedFromUnion_getLiteralFieldsFromType_Erased" | Union u -> let result = u.types |> List.map getLiteralFieldsFromType result |> List.fold (fun state fields -> @@ -1708,7 +1708,7 @@ let mergeSources newFileName (srcs: SourceFile list) = srcs |> List.map (fun src -> src.fileName, newFileName) |> Map.ofList let f (i: Ident) = i |> Ident.mapSource (fun path -> - sourceMapping |> Map.tryFind path |> Option.defaultValue path + sourceMapping |> Map.tryFind path |? path ) let statements = srcs diff --git a/src/Extensions.fs b/src/Extensions.fs index f7c8c4ea..352c599d 100644 --- a/src/Extensions.fs +++ b/src/Extensions.fs @@ -59,7 +59,7 @@ type Argv<'T> with :> Argv<'U> member this.addFlag (key: string, f: 'U -> bool, ?descr, ?defaultValue, ?defaultDescr, ?alias) = this.boolean(!^key) - .addImpl(key, descr, dv=(defaultValue |> Option.defaultValue false), ?dd=defaultDescr, ?alias=alias) + .addImpl(key, descr, dv=(defaultValue |? false), ?dd=defaultDescr, ?alias=alias) :> Argv<'U> member this.addCounter (key: string, f: 'U -> int, ?descr, ?alias) = this.count(!^key) diff --git a/src/Parser.fs b/src/Parser.fs deleted file mode 100755 index 59a1fe05..00000000 --- a/src/Parser.fs +++ /dev/null @@ -1,954 +0,0 @@ -// partly borrowed from https://github.com/fable-compiler/ts2fable/ -module Parser - -open Syntax -open Naming -open Fable.Core -open Fable.Core.JsInterop -open TypeScript - -type Node = Ts.Node -type TypeChecker = Ts.TypeChecker -type Kind = Ts.SyntaxKind - -type ParserContext = - inherit GlobalOptions - abstract checker: TypeChecker with get - abstract sourceFile: Ts.SourceFile with get - -module Node = - let location (n: Node) = - let src = n.getSourceFile() - let pos = src.getLineAndCharacterOfPosition (n.getStart()) - LocationTs (src, pos) - - let ppLocation (n: Node) = - let src = n.getSourceFile() - let pos = src.getLineAndCharacterOfPosition (n.getStart()) - sprintf "line %i, col %i of %s" (int pos.line + 1) (int pos.character + 1) src.fileName - - let ppLine (n: Node) = - let src = n.getSourceFile() - let pos = src.getLineAndCharacterOfPosition (n.getStart()) - let startPos = int <| src.getPositionOfLineAndCharacter(pos.line, 0.) - let endPos = int <| src.getLineEndOfPosition(n.getEnd()) - let lines = - src.text.Substring(startPos, endPos - startPos) |> String.toLines - lines |> Array.map (sprintf "> %s") |> String.concat System.Environment.NewLine - -let nodeWarn (ctx: ParserContext) (node: Node) format = - Printf.kprintf (fun s -> - if not ctx.nowarn then - eprintfn "warn: %s at %s" s (Node.ppLocation node) - eprintfn "%s" (Node.ppLine node) - ) format - -let nodeError node format = - Printf.kprintf (fun s -> - failwithf "error: %s at %s\n%s" s (Node.ppLocation node) (Node.ppLine node) - ) format - -let hasModifier (kind: Ts.SyntaxKind) (modifiers: Ts.ModifiersArray option) = - match modifiers with - | None -> false - | Some mds -> mds |> Seq.exists (fun md -> md.kind = kind) - -let getAccessibility (modifiersOpt: Ts.ModifiersArray option) : Accessibility option = - if modifiersOpt |> hasModifier Kind.PublicKeyword then - Some Public - else if modifiersOpt |> hasModifier Kind.ProtectedKeyword then - Some Protected - else if modifiersOpt |> hasModifier Kind.PrivateKeyword then - Some Private - else - None - -let getExported (modifiersOpt: Ts.ModifiersArray option) : Exported = - if modifiersOpt |> hasModifier Kind.DeclareKeyword then - Exported.Declared - else if modifiersOpt |> hasModifier Kind.ExportKeyword |> not then - Exported.No - else if modifiersOpt |> hasModifier Kind.DefaultKeyword then - Exported.Default - else - Exported.Yes - -let isReadOnly (m: Ts.ModifiersArray option) : bool = - m |> hasModifier Kind.ReadonlyKeyword - -let getText (x: 'a) : string = - (!!x : Ts.Node).getText() |> removeQuotesAndTrim - -let getPropertyName (pn: Ts.PropertyName) : string option = - let node : Node = !!pn - match node.kind with - | Kind.Identifier -> Some (!!pn : Ts.Identifier).text - | Kind.PrivateIdentifier -> Some (!!pn : Ts.PrivateIdentifier).text - | Kind.StringLiteral -> Some (!!pn : Ts.StringLiteral).text - | Kind.NumericLiteral -> Some (!!pn : Ts.NumericLiteral).text - | _ -> None - -let getPropertyExpression (pn: Ts.PropertyName) : Ts.Expression option = - let node : Node = !!pn - match node.kind with - | Kind.ComputedPropertyName -> Some (!!pn : Ts.ComputedPropertyName).expression - | _ -> None - -let getBindingName (bn: Ts.BindingName): string option = - let syntaxNode : Node = !! bn - match syntaxNode.kind with - | Kind.Identifier -> - let id : Ts.Identifier = !! bn - Some id.text - | Kind.ObjectBindingPattern - | Kind.ArrayBindingPattern -> None - | _ -> nodeError syntaxNode "unknown Binding Name kind: %s" (Enum.pp syntaxNode.kind) - -let rec extractNestedName (node: Node) = - seq { - if ts.isIdentifier node then - yield (node :?> Ts.Identifier).text - else if ts.isQualifiedName node then - let node = node :?> Ts.QualifiedName - yield! extractNestedName (box node.left :?> Node) - yield node.right.text - else - for child in node.getChildren() do - yield! extractNestedName child - } - -let getKindFromSymbol (ctx: ParserContext) (s: Ts.Symbol) = - let inline check (superset: Ts.SymbolFlags) (subset: Ts.SymbolFlags) = int (subset &&& superset) > 0 - let rec go (symbol: Ts.Symbol) = - let flags = symbol.getFlags() - if flags = Ts.SymbolFlags.Alias then - try - let symbol = ctx.checker.getAliasedSymbol symbol - if isNullOrUndefined symbol then None - else - go symbol - with _ -> None - else if check Ts.SymbolFlags.Transient flags then None - else - let kinds = [ - if flags |> check Ts.SymbolFlags.Type then Kind.Type - if flags |> check Ts.SymbolFlags.Value then Kind.Value - if flags |> check (Ts.SymbolFlags.Class ||| Ts.SymbolFlags.Interface) then Kind.ClassLike - if flags |> check Ts.SymbolFlags.ClassMember then Kind.ClassLikeMember - if flags |> check Ts.SymbolFlags.Enum then Kind.Enum - if flags |> check Ts.SymbolFlags.Module then Kind.Module - if flags |> check Ts.SymbolFlags.EnumMember then Kind.EnumCase - ] - Some (Set.ofList kinds) - go s - -let getFullName (ctx: ParserContext) (nd: Node) = - match ctx.checker.getSymbolAtLocation nd with - | None -> - printfn " x %s" (nd.getText()) - None - | Some s -> - let normalizeQualifiedName (fileNames: string list) (s: string) = - s - |> String.split "." - |> List.ofArray - |> function - | x :: xs when x.StartsWith("\"") -> - let basenames = fileNames |> List.map JsHelper.stripExtension - if basenames |> List.exists (fun basename -> x.EndsWith(basename + "\"")) then xs - else x.Trim('"') :: xs - | xs -> xs - let rec go indent (s: Ts.Symbol) = - let getSources (s: Ts.Symbol) = - s.declarations - |> Option.toList - |> List.collect (fun decs -> - decs |> Seq.map (fun dec -> dec.getSourceFile()) |> List.ofSeq) - |> List.map (fun x -> Path.relative x.fileName) - |> List.distinct - let sources = getSources s - let fullName = - ctx.checker.getFullyQualifiedName s - |> normalizeQualifiedName sources - let kinds = getKindFromSymbol ctx s - let kindText = - match kinds with - | None -> "unknown" - | Some xs -> xs |> Set.toList |> List.map Enum.pp |> String.concat ", " - if sources = [Path.relative ctx.sourceFile.fileName] then - printfn "%s- %s (%s)" (String.replicate indent " ") (fullName |> String.concat ".") kindText - else - printfn "%s- %s (%s) from %A" (String.replicate indent " ") (fullName |> String.concat ".") kindText sources - let roots = ctx.checker.getRootSymbols(s) - try - let s = ctx.checker.getAliasedSymbol(s) - if not (ctx.checker.isUnknownSymbol s || ctx.checker.isUndefinedSymbol s) then - roots.Add(s) - with - _ -> () - for s' in roots do - if getSources s' <> sources then - go (indent+1) s' |> ignore - fullName - - let s = ctx.checker.getExportSymbolOfSymbol s - let fullName = go 1 s - Some fullName - -let getKindFromIdentifier (ctx: ParserContext) (i: Ts.Identifier) : Set option = - match ctx.checker.getSymbolAtLocation i with - | None -> - nodeWarn ctx i "failed to get the kind of an imported identifier '%s'" i.text - None - | Some s -> getKindFromSymbol ctx s - -let sanitizeCommentText str : string list = - str |> String.toLines |> List.ofArray - -let readCommentText (comment: U2>) : string list = - let str = - if JS.jsTypeof comment = "string" then - box comment :?> string - else - let texts = box comment :?> ResizeArray // TODO: do not ignore links - texts |> Seq.map (fun x -> x.text) |> String.concat "" - sanitizeCommentText str - -let readNonJSDocComments (ctx: ParserContext) (node: Node) : Comment list = - let fullText = ctx.sourceFile.getFullText() - let ranges = ts.getLeadingCommentRanges(fullText, node.getFullStart()) - match ranges with - | None -> [] - | Some ranges -> - ranges - |> Seq.map (fun range -> - fullText.[int range.pos .. int range.``end``] - |> sanitizeCommentText |> Summary) - |> Seq.toList - -let readJSDocTag (tag: Ts.JSDocTag) : Comment = - let text = tag.comment |> Option.map readCommentText |> Option.defaultValue [] - match tag.kind with - | Kind.JSDocParameterTag -> - let tag = tag :?> Ts.JSDocParameterTag - Param ((box tag.name :?> Node) |> extractNestedName |> String.concat ".", text) - | Kind.JSDocReturnTag -> Return text - | Kind.JSDocDeprecatedTag -> Deprecated text - | Kind.JSDocSeeTag -> - let tag = tag :?> Ts.JSDocSeeTag - See ((box tag.name :?> Node option) |> Option.map (extractNestedName >> String.concat "."), text) - | _ -> - match tag.tagName.text with - | "description" | "desc" -> Description text - | "summary" -> Summary text - | "example" -> Example text - | tagName -> - Other (tagName, text, tag) - -let readJSDocComments (docComment: ResizeArray) (tags: Ts.JSDocTag seq) : Comment list = - let desc = - let text = - docComment - |> List.ofSeq - |> List.collect (fun sdp -> sdp.text |> sanitizeCommentText) - if List.isEmpty text then [] - else [Description text] - let tags = - tags - |> Seq.map readJSDocTag - |> List.ofSeq - desc @ tags - -let readCommentsForNamedDeclaration (ctx: ParserContext) (nd: Ts.NamedDeclaration) : Comment list = - let fallback () = - match nd.name with - | None -> - readNonJSDocComments ctx nd - | Some name -> - match ctx.checker.getSymbolAtLocation !!name with - | None -> - readNonJSDocComments ctx nd - | Some symbol -> - readJSDocComments (symbol.getDocumentationComment (Some ctx.checker)) (ts.getJSDocTags nd) - - match nd.kind with - // check if it is a SignatureDeclaration - | Kind.CallSignature | Kind.ConstructSignature | Kind.MethodSignature | Kind.IndexSignature - | Kind.FunctionType | Kind.ConstructorType | Kind.JSDocFunctionType | Kind.FunctionDeclaration - | Kind.MethodDeclaration | Kind.Constructor | Kind.GetAccessor | Kind.SetAccessor - | Kind.FunctionExpression | Kind.ArrowFunction -> - try - match ctx.checker.getSignatureFromDeclaration nd with - | None -> - fallback () - | Some signature -> - match readJSDocComments (signature.getDocumentationComment (Some ctx.checker)) (ts.getJSDocTags nd) with - | [] -> - fallback () - | xs -> xs - with e -> - nodeWarn ctx nd "exception while trying to read comments from a signature declaration" - eprintfn "%s" (e.StackTrace) - fallback () - | _ -> - fallback () - -let readLiteral (node: Node) : Literal option = - match node.kind with - | Kind.StringLiteral -> - Some (LString ((node :?> Ts.StringLiteral).text)) - | Kind.TrueKeyword -> Some (LBool true) - | Kind.FalseKeyword -> Some (LBool false) - | _ -> - let text = node.getText() - let parsedAsInt, intValue = System.Int32.TryParse text - let parsedAsFloat, floatValue = System.Double.TryParse text - if parsedAsInt then Some (LInt intValue) - else if parsedAsFloat then Some (LFloat floatValue) - else None - -let getFullNameAtNodeLocation (ctx: ParserContext) (nd: Node) = - match ctx.checker.getSymbolAtLocation nd with - | None -> None - | Some smb -> ctx.checker.getFullyQualifiedName smb |> Option.ofObj |> Option.map (fun s -> s |> String.split "." |> Array.toList) - -let rec readTypeNode (typrm: Set) (ctx: ParserContext) (t: Ts.TypeNode) : Type = - match t.kind with - // primitives - | Kind.StringKeyword -> Prim String - | Kind.BooleanKeyword -> Prim Bool - | Kind.NumberKeyword -> Prim Number - | Kind.AnyKeyword -> Prim Any - | Kind.VoidKeyword -> Prim Void - | Kind.UnknownKeyword -> Prim Unknown - | Kind.NullKeyword -> Prim Null - | Kind.NeverKeyword -> Prim Never - | Kind.UndefinedKeyword -> Prim Undefined - | Kind.ObjectKeyword -> Prim Object - | Kind.SymbolKeyword -> Prim (PrimType.Symbol false) - | Kind.BigIntKeyword -> Prim BigInt - | Kind.ArrayType -> - let t = t :?> Ts.ArrayTypeNode - let elem = readTypeNode typrm ctx t.elementType - if isReadOnly t.modifiers then - App (APrim ReadonlyArray, [elem], Node.location t) - else - App (APrim Array, [elem], Node.location t) - | Kind.TupleType -> - let t = t :?> Ts.TupleTypeNode - readTupleTypeNode typrm ctx t (isReadOnly t.modifiers) - // complex types - | Kind.IntrinsicKeyword -> Intrinsic - | Kind.ThisType -> PolymorphicThis - | Kind.UnionType -> - let t = t :?> Ts.UnionTypeNode - Union { types = t.types |> Seq.map (readTypeNode typrm ctx) |> List.ofSeq } - | Kind.IntersectionType -> - let t = t :?> Ts.IntersectionTypeNode - Intersection { types = t.types |> Seq.map (readTypeNode typrm ctx) |> List.ofSeq } - | Kind.ParenthesizedType -> - readTypeNode typrm ctx ((t :?> Ts.ParenthesizedTypeNode).``type``) - // ident, possibly tyapp - | Kind.TypeReference - // ident, possibly tyapp, appearing in extends / implements - | Kind.ExpressionWithTypeArguments -> - let t = t :?> Ts.NodeWithTypeArguments - let lhs : Node = - match t.kind with - | Kind.TypeReference -> !!(t :?> Ts.TypeReferenceNode).typeName - | Kind.ExpressionWithTypeArguments -> !!(t :?> Ts.ExpressionWithTypeArguments).expression - | _ -> failwith "impossible" - match extractNestedName lhs |> List.ofSeq with - | [x] when typrm |> Set.contains x -> TypeVar x - | [] -> nodeError lhs "cannot parse node '%s' as identifier" (lhs.getText()) - | ts -> - let loc = Node.location lhs - let lt = { name = ts; fullName = getFullName ctx lhs; loc = loc } - match t.typeArguments with - | None -> Ident lt - | Some args -> App (AIdent lt, args |> Seq.map (readTypeNode typrm ctx) |> List.ofSeq, Node.location t) - | Kind.FunctionType -> - let t = t :?> Ts.FunctionTypeNode - let typrms = readTypeParameters typrm ctx t.typeParameters - let typrm = Set.union typrm (typrms |> List.map (fun x -> x.name) |> Set.ofList) - let retTy = readTypeNode typrm ctx t.``type`` - Function (readParameters typrm ctx t.parameters t retTy) - | Kind.ConstructorType -> - let t = t :?> Ts.ConstructorTypeNode - let typrms = readTypeParameters typrm ctx t.typeParameters - let typrm' = Set.union typrm (typrms |> List.map (fun x -> x.name) |> Set.ofList) - let retTy = readTypeNode typrm' ctx t.``type`` - Erased (NewableFunction (readParameters typrm' ctx t.parameters t retTy, typrms), Node.location t, t.getText()) - | Kind.LiteralType -> - let t = t :?> Ts.LiteralTypeNode - if t.getText() = "null" then Prim Null // handle NullLiteral - else - match readLiteral (!!t.literal) with - | Some l -> TypeLiteral l - | None -> - nodeWarn ctx t "unsupported literal type '%s'" (t.getText()); - UnknownType (Some (t.getText())) - // anonymous interface - | Kind.TypeLiteral -> - let t = t :?> Ts.TypeLiteralNode - let members = t.members |> List.ofSeq |> List.map (readNamedDeclaration typrm ctx) - let temp = - { name = None; isInterface = true; isExported = Exported.No - comments = []; implements = []; typeParams = []; accessibility = Public - members = members; loc = Node.location t } - let freeTypeVars = Typer.Type.getFreeTypeVars (AnonymousInterface temp) - let usedTyprms = Set.intersect typrm freeTypeVars - if Set.isEmpty usedTyprms then AnonymousInterface temp - else - let usedTyprms = usedTyprms |> Set.toList - let typeParams = usedTyprms |> List.map (fun name -> { name = name; extends = None; defaultType = None }) - let typeArgs = usedTyprms |> List.map TypeVar - let ai = { temp with typeParams = typeParams } - App (AAnonymousInterface ai, typeArgs, Node.location t) - // readonly types - | Kind.TypeOperator -> - let t = t :?> Ts.TypeOperatorNode - match t.operator with - | Kind.ReadonlyKeyword -> - let t' = t.``type`` - match t'.kind with - | Kind.ArrayType -> - let t' = t' :?> Ts.ArrayTypeNode - let elem = readTypeNode typrm ctx t'.elementType - App (APrim ReadonlyArray, [elem], Node.location t') - | Kind.TupleType -> - let t' = t' :?> Ts.TupleTypeNode - readTupleTypeNode typrm ctx t' true - | _ -> - nodeWarn ctx t "unsupported 'readonly' modifier for type '%s'" (t.getText()) - UnknownType (Some (t.getText())) - | Kind.KeyOfKeyword -> - Erased (Keyof (readTypeNode typrm ctx t.``type``), Node.location t, t.getText()) - | Kind.UniqueKeyword -> - let t' = t.``type`` - match t'.kind with - | Kind.SymbolKeyword -> Prim (PrimType.Symbol true) - | _ -> - nodeWarn ctx t "unsupported 'unique' modifier for type '%s'" (t.getText()) - UnknownType (Some (t.getText())) - | _ -> - nodeWarn ctx t "unsupported type operator '%s'" (Enum.pp t.operator) - UnknownType (Some (t.getText())) - | Kind.IndexedAccessType -> - let t = t :?> Ts.IndexedAccessTypeNode - let lhs = readTypeNode typrm ctx t.objectType - let rhs = readTypeNode typrm ctx t.indexType - Erased (IndexedAccess (lhs, rhs), Node.location t, t.getText()) - | Kind.TypeQuery -> - let t = t :?> Ts.TypeQueryNode - let nameNode = box t.exprName :?> Node - let name = extractNestedName nameNode - Erased (TypeQuery ({ name = List.ofSeq name; fullName = getFullName ctx nameNode; loc = Node.location nameNode }), Node.location t, t.getText()) - // fallbacks - | Kind.TypePredicate -> - nodeWarn ctx t "type predicate is not supported and treated as boolean" - Prim Bool - | _ -> - nodeWarn ctx t "unsupported TypeNode kind: %s" (Enum.pp t.kind); - UnknownType (Some (t.getText())) - -and readTupleTypeNode (typrm: Set) (ctx: ParserContext) (tuple: Ts.TupleTypeNode) isReadOnly : Type = - let f (x: U2) = - let xNode = box x :?> Ts.Node - match xNode.kind with - | Kind.NamedTupleMember -> - let x = xNode :?> Ts.NamedTupleMember - {| value = readTypeNode typrm ctx x.``type``; name = Some x.name.text |} - | _ -> - {| value = readTypeNode typrm ctx (xNode :?> Ts.TypeNode); name = None |} - Tuple { types = Seq.map f tuple.elements |> List.ofSeq; isReadOnly = isReadOnly } - -and readParameters<'retType> (typrm: Set) (ctx: ParserContext) (ps: Ts.ParameterDeclaration seq) (parent: Ts.Node) (retType: 'retType) : FuncType<'retType> = - let isVariadic = - ps |> Seq.exists (fun p -> p.dotDotDotToken |> Option.isSome) - let args = - ps - |> Seq.mapi (fun i p -> - let isOptional = p.questionToken |> Option.isSome - let nameOpt = p.name |> getBindingName - let ty = - match p.``type`` with - | Some t -> readTypeNode typrm ctx t - | None -> - match nameOpt with - | Some name -> - nodeWarn ctx p "type not specified for param '%s'" name - | None -> - nodeWarn ctx p "type not specified for param %i" i - UnknownType None - match nameOpt with - | Some name -> - Choice1Of2 { name = name; isOptional = isOptional; value = ty } - | None -> - assert (not isOptional); - Choice2Of2 ty - ) - |> Seq.toList - { args = args; isVariadic = isVariadic; returnType = retType; loc = Node.location parent } - -and readMemberAttribute (ctx: ParserContext) (nd: Ts.NamedDeclaration) : MemberAttribute = - let accessibility = getAccessibility nd.modifiers |> Option.defaultValue Public - let isStatic = hasModifier Kind.StaticKeyword nd.modifiers - let comments = readCommentsForNamedDeclaration ctx nd - { accessibility = accessibility; isStatic = isStatic; comments = comments; loc = Node.location nd } - -and readNamedDeclaration (typrm: Set) (ctx: ParserContext) (nd: Ts.NamedDeclaration) : MemberAttribute * Member = - let attr = readMemberAttribute ctx nd - let extractType (sdb: Ts.SignatureDeclarationBase) = - let localTyprm = readTypeParameters typrm ctx sdb.typeParameters - match sdb.``type`` with - | Some t -> - localTyprm, - readTypeNode (Set.union typrm (localTyprm |> List.map (fun x -> x.name) |> Set.ofList)) ctx t - | None -> - if nd.kind <> Kind.Constructor && nd.kind <> Kind.SetAccessor then - match sdb.name with - | Some name -> - nodeWarn ctx sdb "type not specified for '%s' (%s)" (getText name) (Enum.pp nd.kind) - | None -> - nodeWarn ctx sdb "type not specified (%s)" (Enum.pp nd.kind) - localTyprm, UnknownType None - - let readSymbolIndexer (e: Ts.Expression) (ty: Choice>) (fail: unit -> _) = - match e.kind with - | Kind.PropertyAccessExpression -> - let e = !!e : Ts.PropertyAccessExpression - let name = e.getText() |> String.split "." |> List.ofArray - match name with - | ["Symbol"; symbolName] -> - let ft = - match ty with - | Choice1Of2 t -> { args = []; isVariadic = false; returnType = t; loc = Node.location nd } - | Choice2Of2 ft -> ft - attr, SymbolIndexer (symbolName, ft, if isReadOnly nd.modifiers then ReadOnly else Mutable) - | _ -> fail () - | _ -> fail () - - match nd.kind with - | Kind.PropertySignature -> - let fail () = - nodeWarn ctx nd "unsupported property name '%s' in PropertySignature" (getText nd.name); (attr, UnknownMember (Some (getText nd))) - let nd = nd :?> Ts.PropertySignature - let ty = - match nd.``type`` with - | Some t -> readTypeNode typrm ctx t - | None -> UnknownType None - match getPropertyName nd.name with - | Some name -> - match ty with - | UnknownType None -> - nodeWarn ctx nd "type not specified for field '%s'" (getText nd.name) - | _ -> () - let fl = { name = name; isOptional = false; value = ty } - attr, Field (fl, (if isReadOnly nd.modifiers then ReadOnly else Mutable), []) - | None -> - match getPropertyExpression nd.name with - | Some expr -> readSymbolIndexer expr (Choice1Of2 ty) fail - | None -> fail () - | Kind.PropertyDeclaration -> - let nd = nd :?> Ts.PropertyDeclaration - match getPropertyName nd.name with - | Some name -> - let ty = - match nd.``type`` with - | Some t -> readTypeNode typrm ctx t - | None -> - UnknownType None - match ty with - | UnknownType None -> - nodeWarn ctx nd "type not specified for field '%s'" (getText nd.name) - | _ -> () - let fl = { name = name; isOptional = false; value = ty } - attr, Field (fl, (if isReadOnly nd.modifiers then ReadOnly else Mutable), []) - | None -> nodeWarn ctx nd "unsupported property name '%s' in PropertyDeclaration" (getText nd.name); (attr, UnknownMember (Some (getText nd))) - | Kind.CallSignature -> - let nd = nd :?> Ts.CallSignatureDeclaration - let localTyprm, ty = extractType nd - let typrm = Set.union typrm (localTyprm |> List.map (fun x -> x.name) |> Set.ofList) - (attr, FunctionInterface (readParameters typrm ctx nd.parameters nd ty, localTyprm)) - | Kind.MethodSignature | Kind.MethodDeclaration -> - let sdb = nd :?> Ts.SignatureDeclarationBase - let fail () = - nodeWarn ctx sdb "unsupported method name '%s' in %s" (getText sdb.name) (Enum.pp nd.kind); (attr, UnknownMember (Some (getText sdb))) - let localTyprm, retTy = extractType sdb - let typrm = Set.union typrm (localTyprm |> List.map (fun x -> x.name) |> Set.ofList) - let func = readParameters typrm ctx sdb.parameters sdb retTy - match sdb.name |> Option.bind getPropertyName with - | Some name -> - attr, Method (name, func, localTyprm) - | None -> - match sdb.name |> Option.bind getPropertyExpression with - | Some expr -> readSymbolIndexer expr (Choice2Of2 func) fail - | None -> fail () - | Kind.IndexSignature -> - let nd = nd :?> Ts.IndexSignatureDeclaration - let localTyprm, ty = extractType nd - if not (List.isEmpty localTyprm) then nodeWarn ctx nd "indexer with type argument is not supported" - (attr, - Indexer (readParameters typrm ctx nd.parameters nd ty, - if isReadOnly nd.modifiers then ReadOnly else Mutable)) - | Kind.ConstructSignature -> - let nd = nd :?> Ts.ConstructSignatureDeclaration - let localTyprm, retTy = extractType nd - let typrm = Set.union typrm (localTyprm |> List.map (fun x -> x.name) |> Set.ofList) - let ty = readParameters typrm ctx nd.parameters nd retTy - { attr with isStatic = false }, New (ty, localTyprm) - | Kind.Constructor -> - let nd = nd :?> Ts.ConstructorDeclaration - let localTyprm, retTy = extractType nd - assert (match retTy with UnknownType _ -> true | _ -> false) - let typrm = Set.union typrm (localTyprm |> List.map (fun x -> x.name) |> Set.ofList) - let ty = readParameters typrm ctx nd.parameters nd () - { attr with isStatic = true }, Constructor (ty, localTyprm) - | Kind.GetAccessor -> - let nd = nd :?> Ts.GetAccessorDeclaration - match getPropertyName nd.name with - | Some name -> - let localTyprm, ty = extractType nd - if not (List.isEmpty localTyprm) then nodeWarn ctx nd "getter with type argument is not supported" - let fl = { name = name; isOptional = false; value = ty } - attr, Getter fl - | None -> nodeWarn ctx nd "unsupported property name '%s' in GetAccessor" (getText nd.name); (attr, UnknownMember (Some (getText nd))) - | Kind.SetAccessor -> - let nd = nd :?> Ts.SetAccessorDeclaration - match getPropertyName nd.name with - | Some name -> - let localTyprm, retTy = extractType nd - assert (match retTy with UnknownType _ -> true | _ -> false) - if not (List.isEmpty localTyprm) then nodeWarn ctx nd "setter with type argument is not supported" - match readParameters typrm ctx nd.parameters nd () with - | { args = [ty]; isVariadic = false } -> - match ty with - | Choice1Of2 named -> - attr, Setter { named with name = name } - | Choice2Of2 ty -> - attr, Setter { name = name; isOptional = false; value = ty } - | _ -> - nodeWarn ctx nd "invalid setter for '%s'" (getText nd.name) - attr, UnknownMember (Some (getText nd)) - | None -> nodeWarn ctx nd "unsupported property name '%s' in SetAccessor" (getText nd.name); (attr, UnknownMember (Some (getText nd))) - | _ -> - nodeWarn ctx nd "unsupported NamedDeclaration kind: '%s'" (Enum.pp nd.kind) - attr, UnknownMember (Some (getText nd)) - -and readTypeParameters (typrm: Set) (ctx: ParserContext) (tps: Ts.TypeParameterDeclaration ResizeArray option) : TypeParam list = - match tps with - | None -> [] - | Some tps -> - let names = tps |> Seq.map (fun tp -> tp.name.text) |> Set.ofSeq |> Set.union typrm - tps - |> Seq.map (fun tp -> - let dt = tp.``default`` |> Option.map (readTypeNode names ctx) - let et = tp.``constraint`` |> Option.map (readTypeNode names ctx) - { name = tp.name.text; extends = et; defaultType = dt } - ) - |> Seq.toList - -let readInherits (typrm: Set) (ctx: ParserContext) (hcs: Ts.HeritageClause ResizeArray option) : Type list = - match hcs with - | None -> [] - | Some hcs -> - hcs |> Seq.collect (fun hc -> hc.types |> Seq.map (readTypeNode typrm ctx)) - |> Seq.toList - -let readInterface (ctx: ParserContext) (i: Ts.InterfaceDeclaration) : Class = - let name = i.name.getText() - let typrms = readTypeParameters Set.empty ctx i.typeParameters - let typrmsSet = typrms |> List.map (fun tp -> tp.name) |> Set.ofList - { - comments = readCommentsForNamedDeclaration ctx i - name = Some name - accessibility = getAccessibility i.modifiers |> Option.defaultValue Public - typeParams = typrms - implements = readInherits typrmsSet ctx i.heritageClauses - isInterface = true - isExported = getExported i.modifiers - members = i.members |> List.ofSeq |> List.map (readNamedDeclaration typrmsSet ctx) - loc = Node.location i - } - -let readClass (ctx: ParserContext) (i: Ts.ClassDeclaration) : Class = - let typrms = readTypeParameters Set.empty ctx i.typeParameters - let typrmsSet = typrms |> List.map (fun tp -> tp.name) |> Set.ofList - { - comments = readCommentsForNamedDeclaration ctx i - name = i.name |> Option.map (fun id -> id.getText()) - accessibility = getAccessibility i.modifiers |> Option.defaultValue Public - typeParams = typrms - implements = readInherits typrmsSet ctx i.heritageClauses - isInterface = false - isExported = getExported i.modifiers - members = i.members |> List.ofSeq |> List.map (readNamedDeclaration typrmsSet ctx) - loc = Node.location i - } - -let readEnumCase (ctx: ParserContext) (em: Ts.EnumMember) : EnumCase option = - match getPropertyName em.name with - | Some name -> - let value = - let inline fallback whenNone = - match ctx.checker.getConstantValue(!^em) with - | None -> whenNone () - | Some (U2.Case1 str) -> Some (LString str) - | Some (U2.Case2 num) -> Some (LFloat num) - match em.initializer with - | None -> fallback (fun () -> None) - | Some ep -> - match readLiteral ep with - | Some ((LInt _ | LFloat _ | LString _) as l) -> Some l - | _ -> - fallback <| fun () -> - nodeWarn ctx ep "enum value '%s' for case '%s' not supported" (ep.getText()) name; None - let comments = readCommentsForNamedDeclaration ctx em - Some { comments = comments; loc = Node.location em; name = name; value = value } - | None -> nodeWarn ctx em "unsupported enum case name '%s'" (getText em.name); None - -let readEnum (ctx: ParserContext) (ed: Ts.EnumDeclaration) : Enum = - { - name = ed.name.text - comments = readCommentsForNamedDeclaration ctx ed - cases = ed.members |> List.ofSeq |> List.choose (readEnumCase ctx) - isExported = getExported ed.modifiers - loc = Node.location ed - } - -let readTypeAlias (ctx: ParserContext) (a: Ts.TypeAliasDeclaration) : TypeAlias = - let typrm = readTypeParameters Set.empty ctx a.typeParameters - let ty = readTypeNode (typrm |> List.map (fun x -> x.name) |> Set.ofList) ctx a.``type`` - let comments = readCommentsForNamedDeclaration ctx a - { name = a.name.text; typeParams = typrm; target = ty; comments = comments; isExported = getExported a.modifiers; loc = Node.location a } - -let readVariable (ctx: ParserContext) (v: Ts.VariableStatement) : Statement list = - v.declarationList.declarations |> List.ofSeq |> List.map (fun vd -> - let comments = readCommentsForNamedDeclaration ctx vd - match getBindingName vd.name with - | None -> - nodeWarn ctx vd "name is not defined for variable" - UnknownStatement {| origText = Some (vd.getText()); loc = Node.location vd; comments = comments |} - | Some name -> - let ty = - match vd.``type`` with - | Some tn -> readTypeNode Set.empty ctx tn - | None -> - match vd.initializer with - | Some e -> - match e.kind with - | Kind.StringLiteral -> Prim String - | Kind.RegularExpressionLiteral -> Prim RegExp - | Kind.NumericLiteral | Kind.BigIntLiteral -> Prim Number - | Kind.TrueKeyword | Kind.FalseKeyword -> Prim Bool - | _ -> - nodeWarn ctx vd "type missing for variable '%s'" name - UnknownType None - | None -> - nodeWarn ctx vd "type missing for variable '%s'" name - UnknownType None - let isConst = (int vd.flags) ||| (int Ts.NodeFlags.Const) <> 0 - let isExported = getExported vd.modifiers - let accessibility = getAccessibility vd.modifiers - Value { comments = comments; loc = Node.location vd; name = name; typ = ty; typeParams = []; isConst = isConst; isExported = isExported; accessibility = accessibility } - ) - -let readFunction (ctx: ParserContext) (f: Ts.FunctionDeclaration) : Value option = - match f.name with - | None -> - nodeWarn ctx f "name is not defined for function"; None - | Some name -> - let name = name.text - let comments = readCommentsForNamedDeclaration ctx f - let isExported = getExported f.modifiers - let accessibility = getAccessibility f.modifiers - let typrm = readTypeParameters Set.empty ctx f.typeParameters - let ty = - let typrm = typrm |> List.map (fun x -> x.name) |> Set.ofList - let retTy = - match f.``type`` with - | Some tn -> readTypeNode typrm ctx tn - | None -> - nodeWarn ctx f "return type missing for function '%s'" name - UnknownType None - Function (readParameters typrm ctx f.parameters f retTy) - Some { comments = comments; loc = Node.location f; name = name; typ = ty; typeParams = typrm; isConst = false; isExported = isExported; accessibility = accessibility } - -let readExportAssignment (ctx: ParserContext) (e: Ts.ExportAssignment) : Statement option = - let comments = readCommentsForNamedDeclaration ctx e - match extractNestedName e.expression |> Seq.toList with - | [] -> nodeWarn ctx e.expression "cannot parse node '%s' as identifier" (e.expression.getText()); None - | ts -> - let ident = { name = ts; fullName = getFullName ctx e.expression; loc = Node.location e.expression } - match e.isExportEquals with - | Some true -> Export { clause = CommonJsExport ident; loc = Node.location e; comments = comments; origText = e.getText() } |> Some - | _ -> Export { clause = ES6DefaultExport ident; loc = Node.location e; comments = comments; origText = e.getText() } |> Some - -let readExportDeclaration (ctx: ParserContext) (e: Ts.ExportDeclaration) : Statement list option = - let comments = readCommentsForNamedDeclaration ctx e - match e.exportClause, e.moduleSpecifier with - | None, _ - | _, Some _ -> - nodeWarn ctx e "re-exporting an external module is not supported."; None - | Some bindings, None -> - let kind = (bindings |> box :?> Ts.Node).kind - match kind with - | Kind.NamespaceExport -> - let ne = bindings |> box :?> Ts.NamespaceExport - Some [Export { clause = NamespaceExport ne.name.text; loc = Node.location ne; comments = comments; origText = e.getText() }] - | Kind.NamedExports -> - let nes = bindings |> box :?> Ts.NamedExports - nes.elements - |> Seq.map (fun x -> - let ident (name: Ts.Identifier) = { name = [name.text]; fullName = getFullName ctx name; loc = Node.location name } - match x.propertyName with - | None -> {| target = ident x.name; renameAs = None |} - | Some propertyName -> {| target = ident propertyName; renameAs = Some x.name.text |}) - |> Seq.toList - |> List.map (fun elem -> Export { clause = ES6Export elem; loc = Node.location nes; comments = comments; origText = e.getText() }) - |> Some - | _ -> - nodeWarn ctx e "invalid syntax kind '%s' for an export declaration" (Enum.pp kind); None - -let readNamespaceExportDeclaration (ctx: ParserContext) (e: Ts.NamespaceExportDeclaration) : Statement = - Export { clause = NamespaceExport e.name.text; loc = Node.location e; comments = readCommentsForNamedDeclaration ctx e; origText = e.getText() } - -let readImportEqualsDeclaration (ctx: ParserContext) (i: Ts.ImportEqualsDeclaration) : Statement option = - let comments = readCommentsForNamedDeclaration ctx i - match (!!i.moduleReference : Ts.Node).kind with - | Kind.Identifier | Kind.QualifiedName -> - nodeWarn ctx i "importing an identifier is not supported"; None - | Kind.ExternalModuleReference -> - let m : Ts.ExternalModuleReference = !!i.moduleReference - match (!!m.expression : Ts.Node).kind with - | Kind.StringLiteral -> - let moduleSpecifier = (!!m.expression : Ts.StringLiteral).text - let kind = getKindFromIdentifier ctx i.name - Import { - comments = comments; - loc = Node.location i; - isTypeOnly = i.isTypeOnly; - isExported = getExported i.modifiers; - moduleSpecifier = moduleSpecifier; - clause = NamespaceImport {| name = i.name.text; isES6Import = false; kind = kind |} - origText = i.getText() - } |> Some - | kind -> - nodeWarn ctx i "invalid kind '%s' for module specifier" (Enum.pp kind); None - | kind -> - nodeWarn ctx i "invalid kind '%s' for import" (Enum.pp kind); None - -let readImportDeclaration (ctx: ParserContext) (i: Ts.ImportDeclaration) : Statement option = - match i.importClause with - | None -> nodeWarn ctx i "side-effect only import will be ignored"; None - | Some c -> - match i.moduleSpecifier.kind with - | Kind.StringLiteral -> - let comments = readCommentsForNamedDeclaration ctx c - let moduleSpecifier = (!!i.moduleSpecifier : Ts.StringLiteral).text - let inline create clause = - Some (Import { comments = comments; loc = Node.location i; isTypeOnly = c.isTypeOnly; isExported = getExported i.modifiers; moduleSpecifier = moduleSpecifier; clause = clause; origText = i.getText() }) - match c.name, c.namedBindings with - | None, None -> create ES6WildcardImport - | None, Some b when (!!b : Ts.Node).kind = Kind.NamespaceImport -> - let n = (!!b : Ts.NamespaceImport) - let kind = getKindFromIdentifier ctx n.name - create (NamespaceImport {| name = n.name.text; kind = kind; isES6Import = true |}) - | _, Some b when (!!b : Ts.Node).kind = Kind.NamedImports -> - let n = (!!b : Ts.NamedImports) - let defaultImport = c.name |> Option.map (fun i -> {| name = i.text; kind = getKindFromIdentifier ctx i |}) - let bindings = - n.elements - |> Seq.toList - |> List.map (fun e -> - let kind = getKindFromIdentifier ctx e.name - let name, renameAs = - match e.propertyName with - | Some i -> i.text, Some e.name.text - | None -> e.name.text, None - {| name = name; kind = kind; renameAs = renameAs |}) - create (ES6Import {| defaultImport = defaultImport; bindings = bindings |}) - | Some i, None -> - let defaultImport = {| name = i.text; kind = getKindFromIdentifier ctx i |} - create (ES6Import {| defaultImport = Some defaultImport; bindings = [] |}) - | _, _ -> - nodeWarn ctx i "invalid import statement"; None - | kind -> - nodeWarn ctx i "invalid kind '%s' for module specifier" (Enum.pp kind); None - -let readJSDocImpl (ctx: ParserContext) (doc: Ts.JSDoc) : Comment list = - let desc = - doc.comment - |> Option.map (readCommentText >> Description >> List.singleton) - |> Option.defaultValue [] - let tags = - doc.tags - |> Option.map (Seq.map readJSDocTag >> List.ofSeq) - |> Option.defaultValue [] - desc @ tags - -let readJSDoc (ctx: ParserContext) (doc: Ts.JSDoc) : Statement option = - match readJSDocImpl ctx doc with - | [] -> None - | xs -> FloatingComment {| comments = xs; loc = Node.location doc |} |> Some - -let rec readModule (ctx: ParserContext) (md: Ts.ModuleDeclaration) : Module = - let name = - match (!!md.name : Ts.Node).kind with - | Kind.Identifier -> (!!md.name : Ts.Identifier).text - | Kind.StringLiteral -> (!!md.name : Ts.StringLiteral).text - | _ -> nodeError !!md.name "unsupported module name '%s'" (getText md.name) - let check kind = - md.getChildren() |> Seq.exists (fun nd -> nd.kind = kind) - let isNamespace = check Kind.NamespaceKeyword - let isExported = getExported md.modifiers - let statements = - md.getChildren() - |> Seq.toList - |> List.collect (fun nd -> - match nd.kind with - | Kind.ModuleBlock -> - let mb = nd :?> Ts.ModuleBlock - mb.statements |> List.ofSeq |> List.collect (readStatement ctx) - | Kind.NamespaceKeyword | Kind.ExportKeyword | Kind.Identifier - | Kind.DeclareKeyword | Kind.StringLiteral | Kind.DotToken | Kind.SyntaxList | Kind.ModuleKeyword -> [] - | Kind.JSDocComment -> [] - | Kind.ModuleDeclaration -> - [ Module (readModule ctx (nd :?> Ts.ModuleDeclaration)) ] - | _ -> - nodeWarn ctx nd "unknown kind in ModuleDeclaration: %s" (Enum.pp nd.kind) - []) - let comments = - md.getChildren() - |> Seq.filter (fun nd -> nd.kind = Kind.JSDocComment) - |> List.ofSeq - |> List.collect (fun nd -> nd :?> Ts.JSDoc |> readJSDocImpl ctx) - { isExported = isExported; isNamespace = isNamespace; name = name; statements = statements; comments = comments; loc = Node.location md } - -and readStatement (ctx: ParserContext) (stmt: Ts.Statement) : Statement list = - let onError () = - let comments = readCommentsForNamedDeclaration ctx (stmt :?> Ts.DeclarationStatement) - UnknownStatement {| origText = Some (stmt.getText()); loc = Node.location stmt; comments = comments |} - try - match stmt.kind with - | Kind.TypeAliasDeclaration -> [readTypeAlias ctx (stmt :?> _) |> TypeAlias] - | Kind.InterfaceDeclaration -> [readInterface ctx (stmt :?> _) |> ClassDef] - | Kind.ClassDeclaration -> [readClass ctx (stmt :?> _) |> ClassDef] - | Kind.EnumDeclaration -> [readEnum ctx (stmt :?> _) |> EnumDef] - | Kind.ModuleDeclaration -> [readModule ctx (stmt :?> _) |> Module] - | Kind.VariableStatement -> readVariable ctx (stmt :?> _) - | Kind.FunctionDeclaration -> [readFunction ctx (stmt :?> _) |> Option.map Value |> Option.defaultWith onError] - | Kind.ExportAssignment -> [readExportAssignment ctx (stmt :?> _) |> Option.defaultWith onError] - | Kind.ExportDeclaration -> readExportDeclaration ctx (stmt :?> _) |> Option.defaultWith (onError >> List.singleton) - | Kind.NamespaceExportDeclaration -> [readNamespaceExportDeclaration ctx (stmt :?> _)] - | Kind.ImportEqualsDeclaration -> [readImportEqualsDeclaration ctx (stmt :?> _) |> Option.defaultWith onError] - | Kind.ImportDeclaration -> [readImportDeclaration ctx (stmt :?> _) |> Option.defaultWith onError] - | _ -> - nodeWarn ctx stmt "skipping unsupported Statement kind: %s" (Enum.pp stmt.kind) - [onError ()] - with - | _ -> - eprintfn "%s" (Node.ppLine stmt) - reraise () - diff --git a/src/Targets/JsOfOCaml/Writer.fs b/src/Targets/JsOfOCaml/Writer.fs index 8385b4d3..ef4f5da3 100644 --- a/src/Targets/JsOfOCaml/Writer.fs +++ b/src/Targets/JsOfOCaml/Writer.fs @@ -100,13 +100,13 @@ let anonymousInterfaceToIdentifier (ctx: Context) (a: AnonymousInterface) : text tprintf "%s.t" (anonymousInterfaceModuleName ctx i) else tprintf "anonymous_interface_%d" i.id - | None -> failwithf "impossible_anonymousInterfaceToIdentifier(%s)" a.loc.AsString + | None -> impossible "anonymousInterfaceToIdentifier(%s)" a.loc.AsString let enumCaseToIdentifier (e: Enum) (c: EnumCase) = let duplicateCases = e.cases |> List.filter (fun c' -> c.value = c'.value) match duplicateCases with - | [] -> failwith "impossible_enumCaseToIdentifier" + | [] -> impossible "enumCaseToIdentifier" | [c'] -> assert (c = c') Naming.constructorName [c.name] @@ -352,9 +352,9 @@ let rec emitTypeImpl (flags: EmitTypeFlags) (overrideFunc: OverrideFunc) (ctx: C | [] -> Type.void_ | [t] -> emitTypeImpl flags overrideFunc ctx t.value | ts -> Type.tuple (ts |> List.map (fun x -> emitTypeImpl flags overrideFunc ctx x.value)) - | Erased (_, loc, origText) -> failwithf "impossible_emitTypeImpl_erased: %s (%s)" loc.AsString origText - | Func (_, _ :: _, loc) -> failwithf "impossible_emitTypeImpl_Func_poly: %s (%s)" loc.AsString (Type.pp ty) - | NewableFunc (_, _, loc) -> failwithf "impossible_emitTypeImpl_NewableFunc: %s (%s)" loc.AsString (Type.pp ty) + | Erased (_, loc, origText) -> impossible "emitTypeImpl_erased: %s (%s)" loc.AsString origText + | Func (_, _ :: _, loc) -> impossible "emitTypeImpl_Func_poly: %s (%s)" loc.AsString (Type.pp ty) + | NewableFunc (_, _, loc) -> impossible "emitTypeImpl_NewableFunc: %s (%s)" loc.AsString (Type.pp ty) | UnknownType msgo -> match msgo with None -> commentStr "FIXME: unknown type" + Type.any | Some msg -> commentStr (sprintf "FIXME: unknown type '%s'" msg) + Type.any @@ -405,7 +405,7 @@ and emitUnion (flags: EmitTypeFlags) (overrideFunc: OverrideFunc) (ctx: Context) yield body + skipOnContravariant (Attr.js (Term.literal l)) ]) + forceSkipAttr (tprintf " [@js.union on_field \"%s\"]" tagName) |> between "(" ")" if Map.isEmpty du then - failwith "impossible_emitResolvedUnion_baseType_go" + impossible "emitResolvedUnion_baseType_go" else Map.toList du |> List.map (fun (tagName, cases) -> treatDU tagName cases) @@ -453,7 +453,7 @@ and emitUnion (flags: EmitTypeFlags) (overrideFunc: OverrideFunc) (ctx: Context) Type.app (str "Primitive.t") [cases] match baseType, Set.toList ru.typeofableTypes, ru.caseNull, ru.caseUndefined with - | None, [], false, false -> failwith "impossible_emitUnion_empty_union" + | None, [], false, false -> impossible "emitUnion_empty_union" | None, [], true, false -> Type.null_ | None, [], false, true -> Type.undefined | None, [], true, true when flags.variance = Covariant -> Type.option Type.undefined @@ -559,7 +559,7 @@ with match s1, s2 with | No, No -> No | Force s1, Force s2 when s1 <> s2 -> - failwithf "impossible_Scoped_union(%s, %s)" s1 s2 + impossible "Scoped_union(%s, %s)" s1 s2 | Force s, _ | _, Force s -> Force s | Yes, _ | _, Yes -> Yes @@ -617,7 +617,7 @@ module StructuredText = state |> WeakTrie.add (i.namespace_ @ [anonymousInterfaceModuleName ctx i]) | _ -> state ) WeakTrie.empty) - |> Option.defaultValue WeakTrie.empty + |? WeakTrie.empty let trie = x.children |> Map.fold (fun state k child -> @@ -633,12 +633,12 @@ module StructuredText = let refs = getReferences (ctx |> Context.ofChildNamespace k) child |> WeakTrie.getSubTrie parent - |> Option.defaultValue WeakTrie.empty + |? WeakTrie.empty |> WeakTrie.ofDepth 1 |> WeakTrie.toList |> List.map (function | [x] -> k, x - | xs -> failwithf "impossible_StructuredText_getDependencyGraphOfChildren_refs(%s): %A" (ctx |> Context.getFullNameString [k]) xs) + | xs -> impossible "StructuredText_getDependencyGraphOfChildren_refs(%s): %A" (ctx |> Context.getFullNameString [k]) xs) refs :: state) [] |> List.rev |> List.concat @@ -812,7 +812,7 @@ let emitTypeAliasesImpl for tyarg in tyargs' do yield tyarg for t in typrms |> List.skip arity do match t.defaultType with - | None -> failwith "impossible_emitTypeAliases" + | None -> impossible "emitTypeAliases" | Some t -> yield emitType_ ctx t ] yield! lines {| name = name; tyargs = List.zip typrms' tyargs'; target = target; isOverload = true |} @@ -891,14 +891,14 @@ let getExportFromStatement (ctx: Context) (name: string) (kind: Kind list) (kind Some (ExportItem.Export {| comments = []; clauses = [clause, Set.ofList kind]; loc = s.loc; origText = sprintf "%s %s %s" prefix kindString name |}) let getTrie name current = - current |> Trie.getSubTrie name |> Option.defaultValue Trie.empty + current |> Trie.getSubTrie name |? Trie.empty let setTrie name trie current = current |> Trie.setSubTrie name trie let inTrie name f current = let m = current |> Trie.getSubTrie name - |> Option.defaultValue Trie.empty + |? Trie.empty |> f current |> Trie.setSubTrie name m let set node current = current |> Trie.setOrUpdate node StructuredTextNode.union @@ -931,7 +931,7 @@ let rec emitClass flags overrideFunc (ctx: Context) (current: StructuredText) (c | Choice2Of2 Anonymous -> let ai = c.MapName (fun _ -> Anonymous) match ctx |> Context.bindCurrentSourceInfo (fun info -> info.anonymousInterfacesMap |> Map.tryFind ai) with - | None -> failwith "impossible_emitClass_unknown_anonymousInterface" + | None -> impossible "emitClass_unknown_anonymousInterface" | Some i -> let selfTy = if List.isEmpty c.typeParams then AnonymousInterface ai @@ -1067,7 +1067,7 @@ let rec emitClass flags overrideFunc (ctx: Context) (current: StructuredText) (c match kind with | ClassKind.ExportDefaultClass _ -> Scoped.No | _ -> - let scoped = forceScoped |> Option.defaultValue Scoped.No + let scoped = forceScoped |? Scoped.No let shouldBeScoped = c.members |> List.exists (fun (ma, m) -> if ma.isStatic then true @@ -1277,7 +1277,7 @@ and addAnonymousInterfaceExcluding emitTypeFlags (ctx: Context) knownTypes ais ( let shouldSkip = current.value |> Option.map (fun v -> v.anonymousInterfaces |> Set.contains a) - |> Option.defaultValue false + |? false if shouldSkip then current else emitClass emitTypeFlags OverrideFunc.noOverride ctx current (a.MapName Choice2Of2) ((fun _ _ _ -> []), Set.empty, None) @@ -1333,16 +1333,16 @@ let emitImport (ctx: Context) (i: Import) : StructuredTextItem list = | None -> JsHelper.resolveRelativeImportPath (ctx.state.info |> Result.toOption) ctx.currentSourceFile ctx.state.fileNames specifier |> JsHelper.InferenceResult.tryUnwrap - |> Option.defaultValue specifier + |? specifier |> Naming.jsModuleNameToOCamlModuleName |> Some let isModule (name: string) (kind: Set option) = i.isTypeOnly || kind |> Option.map Kind.generatesOCamlModule - |> Option.defaultValue false + |? false || ctx |> Context.tryCurrentSourceInfo (fun i -> i.unknownIdentTypes |> Trie.containsKey [name]) - |> Option.defaultValue false + |? false || name |> Naming.isCase Naming.PascalCase match c with @@ -1358,16 +1358,16 @@ let emitImport (ctx: Context) (i: Import) : StructuredTextItem list = getModuleName x.specifier |> Option.map (fun moduleName -> [moduleAlias (Naming.moduleName x.name) (sprintf "%s.Export" moduleName) |> ImportText]) - |> Option.defaultValue [] + |? [] | ES6WildcardImport s -> getModuleName s |> Option.map (fun moduleName -> [open_ [sprintf "%s.Export" moduleName] |> ImportText]) - |> Option.defaultValue [] + |? [] | ES6DefaultImport x when isModule x.name x.kind -> getModuleName x.specifier |> Option.map (fun moduleName -> [moduleAlias (Naming.moduleName x.name) (sprintf "%s.Export.Default" moduleName) |> ImportText]) - |> Option.defaultValue [] + |? [] | ES6Import x when isModule x.name x.kind -> let name = match x.renameAs with @@ -1376,7 +1376,7 @@ let emitImport (ctx: Context) (i: Import) : StructuredTextItem list = getModuleName x.specifier |> Option.map (fun moduleName -> [moduleAlias name (sprintf "%s.Export.%s" moduleName (Naming.moduleName x.name)) |> ImportText]) - |> Option.defaultValue [] + |? [] | NamespaceImport _ | ES6DefaultImport _ | ES6Import _ -> [] [ yield! i.comments |> List.map (emitCommentBody >> comment >> ImportText) @@ -1427,7 +1427,7 @@ let createStructuredText (rootCtx: Context) (stmts: Statement list) : Structured let ty = emitType_ ctx (func ft) yield! cmt yield overloaded (fun rename -> [val_ (rename "invoke") ty + str " " + Attr.js_invoke]) - | Constructor _ -> failwith "impossible_emitStructuredDefinition_Pattern_intfToModule_Constructor" // because interface! + | Constructor _ -> impossible "emitStructuredDefinition_Pattern_intfToModule_Constructor" // because interface! | Indexer (ft, _) -> yield ScopeIndependent (comment (tprintf "unsupported indexer of type: %s" (Type.pp (func ft)))) | UnknownMember (Some msg) -> yield ScopeIndependent (commentStr msg) | SymbolIndexer _ | UnknownMember None -> () ] @@ -1626,7 +1626,65 @@ module ModuleEmitter = type ExportWithKind = {| comments: Comment list; clauses: (ExportClause * Set) list; loc: Location; origText: string |} -let rec emitExportModule (moduleEmitter: ModuleEmitter) (ctx: Context) (exports: ExportItem list) : text list = +let rec private emitStructuredText (reserved: bool) (moduleEmitter: ModuleEmitter) (ctx: Context) (st: StructuredText) : {| scoped: Scoped; imports: text list; content: text list; docCommentBody: text list |} = + let renamer = new OverloadRenamer() + let modules : TextModuleSig list = + st.children + |> Map.toList + |> List.map (fun (k, v) -> + let name = + let name = + if reserved then Naming.moduleNameReserved k + else Naming.moduleName k + name |> renamer.Rename "module" + let ctx = ctx |> Context.ofChildNamespace k + let result = emitStructuredText reserved moduleEmitter ctx v + {| + name = name + origName = k + scope = + match result.scoped with + | Scoped.Force s -> Some s + | Scoped.Yes -> Some k + | Scoped.No -> None + content = result.imports @ result.content + docCommentBody = result.docCommentBody + |} + ) + let emitModules = moduleEmitter ctx st + let imports, typedefs, items, functors, docCommentBody = + match st.value with + | None -> [], [], [], [], [] + | Some node -> + let imports, typedefs, functors, items = + List.fold (fun (imports, typedefs, functors, items) -> function + | ImportText x -> (x :: imports, typedefs, functors, items) + | TypeDef x -> (imports, x :: typedefs, functors, items) + | ScopeIndependent x -> (imports, typedefs, functors, [x] :: items) + | OverloadedText f -> (imports, typedefs, functors, f renamer :: items) + | Functor (n, ais, f) -> (imports, typedefs, (n, ais, f) :: functors, items) + ) ([], [], [], []) node.items + List.rev imports, List.rev typedefs, List.rev items, List.rev functors, node.docCommentLines + let scoped = + match st.value with + | Some v -> v.scoped + | None -> Scoped.No + let content = + [ + yield! emitModules modules + for (name, ais, functor) in functors do + let ais = emitStructuredText reserved moduleEmitter ctx ais + yield functor (Naming.moduleName name) ais.content + yield! typedefs + for item in items do yield! item + match st.value with + | None -> () + | Some v -> + yield! emitExportModule moduleEmitter ctx v.exports + ] + {| scoped = scoped; imports = imports; content = content; docCommentBody = docCommentBody |} + +and emitExportModule (moduleEmitter: ModuleEmitter) (ctx: Context) (exports: ExportItem list) : text list = let emitComment isFirst comments origText = [ let hasDocComment = not (List.isEmpty comments) if not isFirst && hasDocComment then yield ScopeIndependent empty @@ -1636,7 +1694,7 @@ let rec emitExportModule (moduleEmitter: ModuleEmitter) (ctx: Context) (exports: ] let emitModuleAlias name (i: Ident) = - if i.kind |> Option.map Kind.generatesOCamlModule |> Option.defaultValue false then + if i.kind |> Option.map Kind.generatesOCamlModule |? false then [ moduleAlias (name |> Naming.moduleNameReserved) (i.name |> Naming.structured Naming.moduleName) |> ScopeIndependent] @@ -1663,7 +1721,7 @@ let rec emitExportModule (moduleEmitter: ModuleEmitter) (ctx: Context) (exports: | ES6DefaultExport e :: rest -> go' (acc |> setItems ["Export"] (emitModuleAlias "Default" e)) rest | ES6Export e :: rest -> - let name = e.renameAs |> Option.defaultValue (e.target.name |> List.last) + let name = e.renameAs |? List.last e.target.name go' (acc |> setItems ["Export"] (emitModuleAlias name e.target)) rest let acc = let generatesExportModule = @@ -1687,64 +1745,6 @@ let rec emitExportModule (moduleEmitter: ModuleEmitter) (ctx: Context) (exports: else [] -and private emitStructuredText (reserved: bool) (moduleEmitter: ModuleEmitter) (ctx: Context) (st: StructuredText) : {| scoped: Scoped; imports: text list; content: text list; docCommentBody: text list |} = - let renamer = new OverloadRenamer() - let modules : TextModuleSig list = - st.children - |> Map.toList - |> List.map (fun (k, v) -> - let name = - let name = - if reserved then Naming.moduleNameReserved k - else Naming.moduleName k - name |> renamer.Rename "module" - let ctx = ctx |> Context.ofChildNamespace k - let result = emitStructuredText reserved moduleEmitter ctx v - {| - name = name - origName = k - scope = - match result.scoped with - | Scoped.Force s -> Some s - | Scoped.Yes -> Some k - | Scoped.No -> None - content = result.imports @ result.content - docCommentBody = result.docCommentBody - |} - ) - let emitModules = moduleEmitter ctx st - let imports, typedefs, items, functors, docCommentBody = - match st.value with - | None -> [], [], [], [], [] - | Some node -> - let imports, typedefs, functors, items = - List.fold (fun (imports, typedefs, functors, items) -> function - | ImportText x -> (x :: imports, typedefs, functors, items) - | TypeDef x -> (imports, x :: typedefs, functors, items) - | ScopeIndependent x -> (imports, typedefs, functors, [x] :: items) - | OverloadedText f -> (imports, typedefs, functors, f renamer :: items) - | Functor (n, ais, f) -> (imports, typedefs, (n, ais, f) :: functors, items) - ) ([], [], [], []) node.items - List.rev imports, List.rev typedefs, List.rev items, List.rev functors, node.docCommentLines - let scoped = - match st.value with - | Some v -> v.scoped - | None -> Scoped.No - let content = - [ - yield! emitModules modules - for (name, ais, functor) in functors do - let ais = emitStructuredText reserved moduleEmitter ctx ais - yield functor (Naming.moduleName name) ais.content - yield! typedefs - for item in items do yield! item - match st.value with - | None -> () - | Some v -> - yield! emitExportModule moduleEmitter ctx v.exports - ] - {| scoped = scoped; imports = imports; content = content; docCommentBody = docCommentBody |} - let emitFlattenedDefinitions (ctx: Context) (stmts: Statement list) : text list = let flags = { EmitTypeFlags.defaultValue with failContravariantTypeVar = true } let emitType_ = emitTypeImpl flags OverrideFunc.noOverride @@ -1825,7 +1825,7 @@ let emitFlattenedDefinitions (ctx: Context) (stmts: Statement list) : text list else "and" let aim = - ctx |> Context.tryCurrentSourceInfo (fun info -> info.anonymousInterfacesMap) |> Option.defaultValue Map.empty + ctx |> Context.tryCurrentSourceInfo (fun info -> info.anonymousInterfacesMap) |? Map.empty List.distinct [ for a in aim |> Map.toList |> List.map fst do @@ -2047,7 +2047,7 @@ let private emitImpl (sources: SourceFile list) (info: PackageInfo option) (ctx: let sources, mergedFileName = match sources with - | [] -> failwith "impossible_emitImpl (empty sources)" + | [] -> impossible "emitImpl (empty sources)" | [src] -> [src], src.fileName | _ -> [mergeSources "input.d.ts" sources], "input.d.ts" From d103b90cb6df9fed6ec42d07b49a08d76011db03 Mon Sep 17 00:00:00 2001 From: cannorin Date: Mon, 9 May 2022 19:43:23 +0900 Subject: [PATCH 04/17] Separate ambient modules from namespaces --- lib/Parser.fs | 24 ++++---- lib/Syntax.fs | 34 ++++++----- lib/Typer.fs | 102 +++++++++++++++++++++----------- src/Targets/JsOfOCaml/Writer.fs | 7 +-- 4 files changed, 98 insertions(+), 69 deletions(-) diff --git a/lib/Parser.fs b/lib/Parser.fs index b0ab51d7..79055c51 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -939,17 +939,8 @@ module private ParserImpl = type ModuleName = Ts.ModuleName let rec readModule (ctx: ParserContext) (md: Ts.ModuleDeclaration) : Statement = - let name = - match md.name with - | ModuleName.Identifier i -> - match i.text with - | "global" -> None - | name -> Some name - | ModuleName.StringLiteral s -> s.text |> Some let check kind = md.getChildren() |> Array.exists (fun nd -> nd.kind = kind) - let isNamespace = check Kind.NamespaceKeyword - let isExported = getExported md.modifiers let statements = md.getChildren() |> Array.toList @@ -971,11 +962,16 @@ module private ParserImpl = |> Array.filter (fun nd -> nd.kind = Kind.JSDocComment) |> List.ofArray |> List.collect (fun nd -> nd :?> Ts.JSDoc |> readJSDocImpl ctx) - match name with - | Some name -> - Module { isExported = isExported; isNamespace = isNamespace; name = name; statements = statements; comments = comments; loc = Node.location md } - | None -> - Global { isExported = isExported; isNamespace = isNamespace; name = (); statements = statements; comments = comments; loc = Node.location md } + let loc = Node.location md + match md.name with + | ModuleName.Identifier i -> + if i.text = "global" then + Global { name = (); isExported = (); statements = statements; comments = comments; loc = loc } + else + let isExported = getExported md.modifiers + Namespace { name = i.text; isExported = isExported; statements = statements; comments = comments; loc = loc } + | ModuleName.StringLiteral s -> + AmbientModule { name = s.text; isExported = (); statements = statements; comments = comments; loc = loc } and readStatement (ctx: ParserContext) (stmt: Ts.Statement) : Statement list = let onError () = diff --git a/lib/Syntax.fs b/lib/Syntax.fs index cdda94db..6027b372 100644 --- a/lib/Syntax.fs +++ b/lib/Syntax.fs @@ -357,15 +357,15 @@ and Statement = /// ``` | Enum of Enum /// ```ts - /// module Name { ... } + /// namespace Name { ... } /// ``` - /// or + | Namespace of Namespace /// ```ts - /// namespace Name { ... } + /// declare module "name" { ... } /// ``` - | Module of Module + | AmbientModule of AmbientModule /// ```ts - /// namespace global { ... } + /// declare global { ... } /// ``` | Global of Global /// ```ts @@ -399,23 +399,26 @@ and Statement = member this.loc = match this with | TypeAlias ta -> ta.loc | Class c -> c.loc | Enum e -> e.loc - | Module m -> m.loc | Global m -> m.loc | Variable v -> v.loc | Function f -> f.loc + | Namespace m -> m.loc | AmbientModule m -> m.loc | Global m -> m.loc + | Variable v -> v.loc | Function f -> f.loc | Import i -> i.loc | Export e -> e.loc | ReExport e -> e.loc | Pattern p -> p.loc | UnknownStatement u -> u.loc | FloatingComment c -> c.loc member this.isExported = match this with | TypeAlias { isExported = i } | Class { isExported = i } - | Enum { isExported = i } | Module { isExported = i } + | Enum { isExported = i } | Namespace { isExported = i } | Variable { isExported = i } | Function { isExported = i } | Import { isExported = i } -> i | Pattern p -> p.isExported + | AmbientModule _ -> Exported.Declared | Export _ | ReExport _ | UnknownStatement _ | FloatingComment _ | Global _ -> Exported.No interface ICommented with member this.getComments() = match this with | TypeAlias ta -> ta.comments | Class c -> c.comments - | Enum e -> e.comments | Module m -> m.comments | Global m -> m.comments + | Enum e -> e.comments + | Namespace m -> m.comments | AmbientModule m -> m.comments | Global m -> m.comments | Variable v -> v.comments | Function f -> f.comments | Import i -> i.comments | Export e -> e.comments | ReExport e -> e.comments @@ -428,7 +431,8 @@ and Statement = | TypeAlias ta -> TypeAlias (map f ta) | Class c -> Class (map f c) | Enum e -> Enum (map f e) - | Module m -> Module (map f m) + | Namespace m -> Namespace (map f m) + | AmbientModule m -> AmbientModule (map f m) | Global m -> Global (map f m) | Variable v -> Variable (map f v) | Function g -> Function (map f g) @@ -483,20 +487,20 @@ and Pattern = | ImmediateConstructor (bi, ci, v) -> ImmediateConstructor ((bi :> ICommented<_>).mapComments f, (ci :> ICommented<_>).mapComments f, (v :> ICommented<_>).mapComments f) -and Module<'name> = { +and NamespaceLike<'name, 'exported> = { name: 'name - isExported: Exported - isNamespace: bool + isExported: 'exported statements: Statement list comments: Comment list loc: Location } with - interface ICommented> with + interface ICommented> with member this.getComments() = this.comments member this.mapComments f = { this with comments = f this.comments } -and Module = Module -and Global = Module +and Namespace = NamespaceLike +and AmbientModule = NamespaceLike +and Global = NamespaceLike and Export = { comments: Comment list diff --git a/lib/Typer.fs b/lib/Typer.fs index 337d9c10..710ef47b 100644 --- a/lib/Typer.fs +++ b/lib/Typer.fs @@ -48,7 +48,7 @@ type [] Definition = | Class of Class | Enum of Enum | EnumCase of EnumCase * Enum - | Module of Module + | Namespace of Namespace | Variable of Variable | Function of Function | Import of ImportClause * Import @@ -234,7 +234,7 @@ module FullName = | Definition.Class c -> if c.isInterface then Kind.OfInterface else Kind.OfClass | Definition.Enum _ -> Kind.OfEnum | Definition.EnumCase _ -> Kind.OfEnumCase - | Definition.Module m -> if m.isNamespace then Kind.OfNamespace else Kind.OfModule + | Definition.Namespace _ -> Kind.OfNamespace | Definition.Variable _ | Definition.Function _ -> Kind.OfValue | Definition.Import (c, _) -> c.kind |> Option.map Set.toList |? [] | Definition.Member _ -> Kind.OfMember @@ -1007,14 +1007,14 @@ module Statement = match stmts with | Some stmts -> match stmt with - | Module { name = name } -> + | Namespace { name = name } -> yield! go (name :: ns) state stmts | _ -> yield! go ns state stmts | None -> match stmt with - | Module { name = name; statements = statements } -> + | Namespace { name = name; statements = statements } -> yield! go (name :: ns) state statements - | Global { statements = statements } -> + | Global { statements = statements } | AmbientModule { statements = statements } -> yield! go [] state statements | Pattern p -> yield! go ns state p.underlyingStatements @@ -1051,11 +1051,11 @@ module Statement = | Pattern p -> for stmt in p.underlyingStatements do yield! go ns state stmt - | Module m -> + | Namespace m -> for stmt in m.statements do yield! go (m.name :: ns) state stmt - | Global m -> - for stmt in m.statements do + | AmbientModule { statements = statements } | Global { statements = statements } -> + for stmt in statements do yield! go [] state stmt } stmts |> Seq.collect (go [] state) @@ -1196,8 +1196,8 @@ module Statement = | ReExport e -> ReExport e | Variable v -> Variable (mapVariable v) | Function f -> Function (mapFunction f) - | Module m -> - Module { + | Namespace m -> + Namespace { m with statements = mapTypeWith @@ -1220,6 +1220,18 @@ module Statement = (ctx |> ctxOfRoot) m.statements } + | AmbientModule m -> + AmbientModule { + m with + statements = + mapTypeWith + overrideFunc + mapping + ctxOfChildNamespace + ctxOfRoot + (ctx |> ctxOfRoot) + m.statements + } | UnknownStatement u -> UnknownStatement u | FloatingComment c -> FloatingComment c | Pattern (ImmediateInstance (i, v)) -> Pattern (ImmediateInstance (mapInClass mapping ctx i, mapVariable v)) @@ -1607,16 +1619,17 @@ let inferEnumCaseValue (stmts: Statement list) : Statement list = | Some _ -> None { c with value = v }, v Enum { e with cases = e.cases |> List.mapFold f None |> fst } - | Module m -> Module { m with statements = m.statements |> List.map go } + | Namespace m -> Namespace { m with statements = m.statements |> List.map go } | Global m -> Global { m with statements = m.statements |> List.map go } | s -> s stmts |> List.map go let rec mergeStatements (stmts: Statement list) = - let mutable result : Choice list = [] + let mutable result : Choice list = [] let mutable intfMap = Map.empty let mutable nsMap = Map.empty + let mutable amMap = Map.empty let mutable globalM = None let mutable otherStmtSet = Set.empty let mergeTypeParams tps1 tps2 = @@ -1651,7 +1664,7 @@ let rec mergeStatements (stmts: Statement list) = | None -> let iref = ref i intfMap <- (intfMap |> Map.add i.name iref) - result <- Choice2Of4 iref :: result + result <- Choice2Of5 iref :: result | Some iref' -> let i' = iref'.Value assert (i.accessibility = i'.accessibility) @@ -1664,12 +1677,25 @@ let rec mergeStatements (stmts: Statement list) = implements = List.distinct (i.implements @ i'.implements) members = i.members @ i'.members } iref'.Value <- i - | Module n (* when n.isNamespace *) -> + | Namespace n -> match nsMap |> Map.tryFind n.name with | None -> let nref = ref n nsMap <- (nsMap |> Map.add n.name nref) - result <- Choice3Of4 nref :: result + result <- Choice3Of5 nref :: result + | Some nref' -> + let n' = nref'.Value + nref'.Value <- + { n with + loc = n.loc ++ n'.loc + comments = n.comments @ n'.comments |> List.distinct + statements = n'.statements @ n.statements } + | AmbientModule n -> + match amMap |> Map.tryFind n.name with + | None -> + let nref = ref n + amMap <- (amMap |> Map.add n.name nref) + result <- Choice4Of5 nref :: result | Some nref' -> let n' = nref'.Value nref'.Value <- @@ -1682,7 +1708,7 @@ let rec mergeStatements (stmts: Statement list) = | None -> let nref = ref n globalM <- Some nref - result <- Choice4Of4 nref :: result + result <- Choice5Of5 nref :: result | Some nref -> let n' = nref.Value nref.Value <- @@ -1693,14 +1719,15 @@ let rec mergeStatements (stmts: Statement list) = | stmt -> if otherStmtSet |> Set.contains stmt |> not then otherStmtSet <- otherStmtSet |> Set.add stmt - result <- Choice1Of4 stmt :: result + result <- Choice1Of5 stmt :: result result |> List.rev |> List.map (function - | Choice1Of4 s -> s - | Choice2Of4 i -> Class i.Value - | Choice3Of4 n -> Module { n.Value with statements = mergeStatements n.Value.statements } - | Choice4Of4 n -> Global { n.Value with statements = mergeStatements n.Value.statements } + | Choice1Of5 s -> s + | Choice2Of5 i -> Class i.Value + | Choice3Of5 n -> Namespace { n.Value with statements = mergeStatements n.Value.statements } + | Choice4Of5 n -> AmbientModule { n.Value with statements = mergeStatements n.Value.statements } + | Choice5Of5 n -> Global { n.Value with statements = mergeStatements n.Value.statements } ) let mergeSources newFileName (srcs: SourceFile list) = @@ -1772,7 +1799,8 @@ let addDefaultConstructorToClass (ctx: TyperContext<_, _>) (stmts: Statement lis let rec go stmts = stmts |> List.map (function | Class c when not c.isInterface -> Class (addConstructors c |> fst) - | Module m -> Module { m with statements = go m.statements } + | Namespace m -> Namespace { m with statements = go m.statements } + | AmbientModule m -> AmbientModule { m with statements = go m.statements } | Global m -> Global { m with statements = go m.statements } | x -> x) go stmts @@ -1845,7 +1873,8 @@ let addParentMembersToClass (ctx: TyperContext<#TyperOptions, _>) (stmts: Statem let rec go stmts = stmts |> List.map (function | Class c when c.isInterface -> Class (addMembers c) - | Module m -> Module { m with statements = go m.statements } + | Namespace m -> Namespace { m with statements = go m.statements } + | AmbientModule m -> AmbientModule { m with statements = go m.statements } | Global m -> Global { m with statements = go m.statements } | x -> x) go stmts @@ -1916,7 +1945,8 @@ let introduceAdditionalInheritance (ctx: IContext<#TyperOptions>) (stmts: Statem | _ -> () Class { c with implements = List.ofSeq inherits |> List.distinct } - | Module m -> Module { m with statements = go m.statements } + | Namespace m -> Namespace { m with statements = go m.statements } + | AmbientModule m -> AmbientModule { m with statements = go m.statements } | Global m -> Global { m with statements = go m.statements } | x -> x ) @@ -1979,7 +2009,8 @@ let detectPatterns (stmts: Statement list) : Statement list = if immediateCtors.Contains origName then None else Some (Class intf) else Some (Class intf) - | Module m -> Some (Module { m with statements = go m.statements }) + | Namespace m -> Some (Namespace { m with statements = go m.statements }) + | AmbientModule m -> Some (AmbientModule { m with statements = go m.statements }) | Global m -> Global { m with statements = go m.statements } |> Some | x -> Some x ) @@ -1987,7 +2018,8 @@ let detectPatterns (stmts: Statement list) : Statement list = let replaceAliasToFunction (ctx: #IContext<#TyperOptions>) stmts = let rec go = function - | Module m -> Module { m with statements = List.map go m.statements } + | Namespace m -> Namespace { m with statements = List.map go m.statements } + | AmbientModule m -> AmbientModule { m with statements = List.map go m.statements } | Global m -> Global { m with statements = List.map go m.statements } | TypeAlias ta -> match ta.target with @@ -2098,13 +2130,10 @@ let createExportMap (stmts: Statement list) : Trie = match s with | Export _ | ReExport _ | UnknownStatement _ | FloatingComment _ | Import _ | TypeAlias _ -> trie | Pattern p -> p.underlyingStatements |> List.fold f trie - | Module m -> - if m.isNamespace then - let eo = getExportType m.name m.isExported - let trie = trie |> add ns m.name eo - go eo (m.name :: ns) trie m.statements - else - go None (m.name :: ns) trie m.statements + | Namespace m -> + let eo = getExportType m.name m.isExported + let trie = trie |> add ns m.name eo + go eo (m.name :: ns) trie m.statements | Global m -> go None [] trie m.statements | Class c -> if c.isInterface then trie @@ -2167,10 +2196,10 @@ let createDefinitionsMap (stmts: Statement list) : Trie | Variable v -> trie |> add ns v.name (Definition.Variable v) | Function f -> trie |> add ns f.name (Definition.Function f) | Pattern p -> p.underlyingStatements |> List.fold (go ns) trie - | Module m -> + | Namespace m -> m.statements |> List.fold (go (m.name :: ns)) trie - |> add ns m.name (Definition.Module m) + |> add ns m.name (Definition.Namespace m) | Global m -> m.statements |> List.fold (go []) trie stmts |> List.fold (go []) Trie.empty @@ -2255,7 +2284,8 @@ let mergeESLibDefinitions (srcs: SourceFile list) = let rec mapStmt (s: Statement) = let vo, s = map None s.loc s match s with - | Module m -> Module { m with statements = List.map mapStmt m.statements } + | Namespace m -> Namespace { m with statements = List.map mapStmt m.statements } + | AmbientModule m -> AmbientModule { m with statements = List.map mapStmt m.statements } | Global m -> Global { m with statements = List.map mapStmt m.statements } | Enum e -> Enum { e with cases = e.cases |> List.map (fun c -> map vo c.loc c |> snd) } | Class c -> Class { c with members = c.members |> List.map (fun (a, m) -> map vo a.loc a |> snd, m) } diff --git a/src/Targets/JsOfOCaml/Writer.fs b/src/Targets/JsOfOCaml/Writer.fs index ef4f5da3..51169fc4 100644 --- a/src/Targets/JsOfOCaml/Writer.fs +++ b/src/Targets/JsOfOCaml/Writer.fs @@ -1449,7 +1449,7 @@ let createStructuredText (rootCtx: Context) (stmts: Statement list) : Structured let addAnonymousInterfaceExcluding ais current = addAnonymousInterfaceExcludingWithKnownTypes (knownTypes ()) ais current match s with - | Module m -> + | Namespace m -> let module' = let node = {| StructuredTextNode.empty with docCommentLines = comments; knownTypes = knownTypes () |} let module' = current |> getTrie [m.name] |> set node @@ -1463,7 +1463,7 @@ let createStructuredText (rootCtx: Context) (stmts: Statement list) : Structured let kind = if v.scoped <> Scoped.No then Kind.OfModule else Kind.OfNamespace - current |> addExport m.name kind (if m.isNamespace then "namespace" else "module") + current |> addExport m.name kind "namespace" | Global m -> m.statements |> List.fold (folder ctx) current | Class c -> emitClass emitTypeFlags OverrideFunc.noOverride ctx current (c.MapName Choice1Of2) ((fun _ _ _ -> []), Set.empty, None) @@ -1785,7 +1785,7 @@ let emitFlattenedDefinitions (ctx: Context) (stmts: Statement list) : text list let selfTyText = emitType_ ctx target [prefix() @+ " " @+ emitTypeName fn.name typrm +@ " = " + selfTyText] // TODO: emit extends of type parameters - | Module m -> m.statements |> List.collect (go prefix (ctx |> Context.ofChildNamespace m.name)) + | Namespace m -> m.statements |> List.collect (go prefix (ctx |> Context.ofChildNamespace m.name)) | Global m -> m.statements |> List.collect (go prefix (ctx |> Context.ofRoot)) | Pattern p -> match p with @@ -1802,7 +1802,6 @@ let emitFlattenedDefinitions (ctx: Context) (stmts: Statement list) : text list | Import _ | Variable _ | Function _ - | Module _ | Export _ | ReExport _ | UnknownStatement _ From 026fd45f21e68f68f55d984a6679233f2a8b8af2 Mon Sep 17 00:00:00 2001 From: cannorin Date: Tue, 17 May 2022 18:26:25 +0900 Subject: [PATCH 05/17] Emit ambient modules again --- lib/Extensions.fs | 7 +++++++ lib/Parser.fs | 31 ++++++++++++++++++---------- lib/Syntax.fs | 7 ++++++- lib/Typer.fs | 5 ++++- src/Targets/JsOfOCaml/OCamlHelper.fs | 2 +- src/Targets/JsOfOCaml/Writer.fs | 8 +++++++ 6 files changed, 46 insertions(+), 14 deletions(-) diff --git a/lib/Extensions.fs b/lib/Extensions.fs index 8a756737..fa65fbbc 100644 --- a/lib/Extensions.fs +++ b/lib/Extensions.fs @@ -93,6 +93,13 @@ module Map = let addNoOverwrite k v m = m |> Map.change k (function None -> Some v | Some v -> Some v) + let mergeWith f m1 m2 = + m2 |> Map.fold (fun m1 k v2 -> + match m1 |> Map.tryFind k with + | None -> m1 |> Map.add k v2 + | Some v1 -> m1 |> Map.add k (f v1 v2) + ) m1 + type MutableMap<'k, 'v> = Collections.Generic.Dictionary<'k, 'v> type MutableSet<'v> = Collections.Generic.HashSet<'v> diff --git a/lib/Parser.fs b/lib/Parser.fs index 79055c51..78417f82 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -12,11 +12,13 @@ open TypeScript type Node = Ts.Node type TypeChecker = Ts.TypeChecker type Kind = Ts.SyntaxKind +type ModuleName = Ts.ModuleName type ParserContext = inherit IContext abstract checker: TypeChecker abstract currentSource: Ts.SourceFile with get, set + abstract currentAmbientModule: string option with get, set abstract program: Ts.Program abstract fileNames: Path.Absolute[] @@ -137,15 +139,19 @@ module private ParserImpl = ] |> Some go s - let normalizeQualifiedName (fileNames: string list) (s: string) = + let normalizeQualifiedName (ctx: ParserContext) (fileNames: string list) (s: string) = s |> String.split "." |> List.ofArray |> function | x :: xs when x.StartsWith("\"") -> let basenames = fileNames |> List.map JsHelper.stripExtension - if basenames |> List.exists (fun basename -> x.EndsWith(basename + "\"")) then xs - else x.Trim('"') :: xs + if basenames |> List.exists (fun basename -> x.Contains basename) then xs + else x :: xs + | x :: xs -> + match ctx.currentAmbientModule with + | None -> x :: xs + | Some amb -> amb :: x :: xs // workaround the bug which omits the enclosing ambient module from the full name | xs -> xs let getFullName (ctx: ParserContext) (nd: Node) = @@ -154,7 +160,7 @@ module private ParserImpl = | Some s -> let source = ctx.currentSource.fileName let fullName = - ctx.checker.getFullyQualifiedName s |> normalizeQualifiedName [source] + ctx.checker.getFullyQualifiedName s |> normalizeQualifiedName ctx [source] Some { source = source; name = fullName } let getFullNames (ctx: ParserContext) (nd: Node) = @@ -163,7 +169,7 @@ module private ParserImpl = |> Option.toList |> List.collect (fun decs -> decs |> Array.map (fun dec -> dec.getSourceFile()) |> List.ofArray) - |> List.map (fun x -> x.fileName) + |> List.map (fun x -> x.fileName |> Path.absolute) |> List.distinct let getRootAndAliasedSymbols (s: Ts.Symbol) = @@ -183,7 +189,7 @@ module private ParserImpl = let sources = getSources s let fullName = ctx.checker.getFullyQualifiedName s - |> normalizeQualifiedName sources + |> normalizeQualifiedName ctx sources let newItems = sources |> List.map (fun source -> { source = source; name = fullName }) @@ -937,11 +943,10 @@ module private ParserImpl = | [] -> None | xs -> FloatingComment {| comments = xs; loc = Node.location doc |} |> Some - type ModuleName = Ts.ModuleName let rec readModule (ctx: ParserContext) (md: Ts.ModuleDeclaration) : Statement = let check kind = md.getChildren() |> Array.exists (fun nd -> nd.kind = kind) - let statements = + let statements ctx = md.getChildren() |> Array.toList |> List.collect (fun nd -> @@ -966,12 +971,14 @@ module private ParserImpl = match md.name with | ModuleName.Identifier i -> if i.text = "global" then - Global { name = (); isExported = (); statements = statements; comments = comments; loc = loc } + Global { name = (); isExported = (); statements = statements ctx; comments = comments; loc = loc } else let isExported = getExported md.modifiers - Namespace { name = i.text; isExported = isExported; statements = statements; comments = comments; loc = loc } + Namespace { name = i.text; isExported = isExported; statements = statements ctx; comments = comments; loc = loc } | ModuleName.StringLiteral s -> - AmbientModule { name = s.text; isExported = (); statements = statements; comments = comments; loc = loc } + let orig = $"\"{s.text}\"" + let ctx = ctx |> JS.cloneWith (fun x -> x.currentAmbientModule <- Some orig) + AmbientModule { name = { orig = orig; unquoted = s.text }; isExported = (); statements = statements ctx; comments = comments; loc = loc } and readStatement (ctx: ParserContext) (stmt: Ts.Statement) : Statement list = let onError () = @@ -1141,6 +1148,7 @@ let createContextFromFiles (ctx: #IContext<#IOptions>) compilerOptions (fileName checker = program.getTypeChecker() fileNames = fileNames currentSource = (null : Ts.SourceFile) + currentAmbientModule = (None : string option) |} let createContextFromString (ctx: #IContext<#IOptions>) compilerOptions (files: {| fileName: string; text: string |} seq) : ParserContext = @@ -1156,6 +1164,7 @@ let createContextFromString (ctx: #IContext<#IOptions>) compilerOptions (files: checker = program.getTypeChecker() fileNames = files |> Seq.map (fun x -> x.fileName) |> Seq.toArray currentSource = (null : Ts.SourceFile) + currentAmbientModule = (None : string option) |} let parse (ctx: ParserContext) : Input = diff --git a/lib/Syntax.fs b/lib/Syntax.fs index 6027b372..26333d49 100644 --- a/lib/Syntax.fs +++ b/lib/Syntax.fs @@ -499,7 +499,12 @@ and NamespaceLike<'name, 'exported> = { member this.mapComments f = { this with comments = f this.comments } and Namespace = NamespaceLike -and AmbientModule = NamespaceLike +and QuotedString = { + /// This is used in TyperContext. + orig: string + unquoted: string +} +and AmbientModule = NamespaceLike and Global = NamespaceLike and Export = { diff --git a/lib/Typer.fs b/lib/Typer.fs index 710ef47b..4ed6a1a3 100644 --- a/lib/Typer.fs +++ b/lib/Typer.fs @@ -1229,7 +1229,7 @@ module Statement = mapping ctxOfChildNamespace ctxOfRoot - (ctx |> ctxOfRoot) + (ctx |> ctxOfChildNamespace m.name.orig) m.statements } | UnknownStatement u -> UnknownStatement u @@ -2134,6 +2134,7 @@ let createExportMap (stmts: Statement list) : Trie = let eo = getExportType m.name m.isExported let trie = trie |> add ns m.name eo go eo (m.name :: ns) trie m.statements + | AmbientModule m -> go None (m.name.orig :: ns) trie m.statements | Global m -> go None [] trie m.statements | Class c -> if c.isInterface then trie @@ -2200,6 +2201,8 @@ let createDefinitionsMap (stmts: Statement list) : Trie m.statements |> List.fold (go (m.name :: ns)) trie |> add ns m.name (Definition.Namespace m) + | AmbientModule m -> + m.statements |> List.fold (go (m.name.orig :: ns)) trie | Global m -> m.statements |> List.fold (go []) trie stmts |> List.fold (go []) Trie.empty diff --git a/src/Targets/JsOfOCaml/OCamlHelper.fs b/src/Targets/JsOfOCaml/OCamlHelper.fs index d97565bb..a36031b7 100644 --- a/src/Targets/JsOfOCaml/OCamlHelper.fs +++ b/src/Targets/JsOfOCaml/OCamlHelper.fs @@ -324,7 +324,7 @@ module Naming = ] let removeInvalidChars (s: string) = - s.ToCharArray() + s.Trim('"').ToCharArray() |> Array.map (fun c -> if Char.isAlphabetOrDigit c || c = '_' then c else '_') |> System.String diff --git a/src/Targets/JsOfOCaml/Writer.fs b/src/Targets/JsOfOCaml/Writer.fs index 51169fc4..77a67ba7 100644 --- a/src/Targets/JsOfOCaml/Writer.fs +++ b/src/Targets/JsOfOCaml/Writer.fs @@ -1464,6 +1464,13 @@ let createStructuredText (rootCtx: Context) (stmts: Statement list) : Structured if v.scoped <> Scoped.No then Kind.OfModule else Kind.OfNamespace current |> addExport m.name kind "namespace" + | AmbientModule m -> + let module' = + let node = {| StructuredTextNode.empty with docCommentLines = comments; knownTypes = knownTypes (); scoped = Scoped.Force (m.name.unquoted) |} + let module' = current |> getTrie [m.name.orig] |> set node + let ctx = ctx |> Context.ofChildNamespace m.name.orig + m.statements |> List.fold (folder ctx) module' + current |> setTrie [m.name.orig] module' | Global m -> m.statements |> List.fold (folder ctx) current | Class c -> emitClass emitTypeFlags OverrideFunc.noOverride ctx current (c.MapName Choice1Of2) ((fun _ _ _ -> []), Set.empty, None) @@ -1786,6 +1793,7 @@ let emitFlattenedDefinitions (ctx: Context) (stmts: Statement list) : text list [prefix() @+ " " @+ emitTypeName fn.name typrm +@ " = " + selfTyText] // TODO: emit extends of type parameters | Namespace m -> m.statements |> List.collect (go prefix (ctx |> Context.ofChildNamespace m.name)) + | AmbientModule m -> m.statements |> List.collect (go prefix (ctx |> Context.ofChildNamespace m.name.orig)) | Global m -> m.statements |> List.collect (go prefix (ctx |> Context.ofRoot)) | Pattern p -> match p with From 2ef595191c3b797d68134777d41a55c9c20f46ea Mon Sep 17 00:00:00 2001 From: cannorin Date: Thu, 26 May 2022 15:17:47 +0900 Subject: [PATCH 06/17] Upgrade to TypeScript 4.7.2 --- lib/Bindings/TypeScript.fs | 2249 ++++++++++++++++++++++-------------- lib/Parser.fs | 6 +- lib/TypeScriptHelper.fs | 2 +- package.json | 2 +- src/Main.fs | 8 +- yarn.lock | 8 +- 6 files changed, 1372 insertions(+), 903 deletions(-) diff --git a/lib/Bindings/TypeScript.fs b/lib/Bindings/TypeScript.fs index 20425670..93db86c3 100644 --- a/lib/Bindings/TypeScript.fs +++ b/lib/Bindings/TypeScript.fs @@ -1,4 +1,4 @@ -// ts2fable 0.0.0 +// ts2fable 0.8.0-build.658 module rec TypeScript #nowarn "3390" // disable warnings for invalid XML comments @@ -51,7 +51,7 @@ module Ts = abstract isIdentifierPart: ch: float * languageVersion: ScriptTarget option * ?identifierVariant: LanguageVariant -> bool abstract createScanner: languageVersion: ScriptTarget * skipTrivia: bool * ?languageVariant: LanguageVariant * ?textInitial: string * ?onError: ErrorCallback * ?start: float * ?length: float -> Scanner abstract isExternalModuleNameRelative: moduleName: string -> bool - abstract sortAndDeduplicateDiagnostics: diagnostics: 'T[] -> SortedReadonlyArray<'T> + abstract sortAndDeduplicateDiagnostics: diagnostics: 'T[] -> SortedReadonlyArray<'T> when 'T :> Diagnostic abstract getDefaultLibFileName: options: CompilerOptions -> string abstract textSpanEnd: span: TextSpan -> float abstract textSpanIsEmpty: span: TextSpan -> bool @@ -88,14 +88,14 @@ module Ts = /// and if it is, attempts to set the appropriate language. abstract validateLocaleAndSetLanguage: locale: string * sys: {| getExecutingFilePath: unit -> string; resolvePath: string -> string; fileExists: string -> bool; readFile: string -> string option |} * ?errors: Push -> unit abstract getOriginalNode: node: Node -> Node - abstract getOriginalNode: node: Node * nodeTest: (Node -> bool) -> 'T + abstract getOriginalNode: node: Node * nodeTest: (Node -> bool) -> 'T when 'T :> Node abstract getOriginalNode: node: Node option -> Node option - abstract getOriginalNode: node: Node option * nodeTest: (Node option -> bool) -> 'T option + abstract getOriginalNode: node: Node option * nodeTest: (Node option -> bool) -> 'T option when 'T :> Node /// Iterates through the parent chain of a node and performs the callback on each parent until the callback /// returns a truthy value, then returns that value. /// If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" /// At that point findAncestor returns undefined. - abstract findAncestor: node: Node option * callback: (Node -> bool) -> 'T option + abstract findAncestor: node: Node option * callback: (Node -> bool) -> 'T option when 'T :> Node abstract findAncestor: node: Node option * callback: (Node -> U2) -> Node option /// Gets a value indicating whether a node originated in the parse tree. /// The node to test. @@ -108,7 +108,7 @@ module Ts = /// The original node. /// A callback used to ensure the correct type of parse tree node is returned. /// The original parse tree node if found; otherwise, undefined. - abstract getParseTreeNode: node: 'T option * ?nodeTest: (Node -> bool) -> 'T option + abstract getParseTreeNode: node: 'T option * ?nodeTest: (Node -> bool) -> 'T option when 'T :> Node /// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' abstract escapeLeadingUnderscores: identifier: string -> __String /// Remove extra underscore from escaped identifier text content. @@ -194,7 +194,7 @@ module Ts = /// Get all JSDoc tags related to a node, including those on parent nodes. abstract getJSDocTags: node: Node -> JSDocTag[] /// Gets all JSDoc tags that match a specified predicate - abstract getAllJSDocTags: node: Node * predicate: (JSDocTag -> bool) -> 'T[] + abstract getAllJSDocTags: node: Node * predicate: (JSDocTag -> bool) -> 'T[] when 'T :> JSDocTag /// Gets all JSDoc tags of a specified kind abstract getAllJSDocTagsOfKind: node: Node * kind: SyntaxKind -> JSDocTag[] /// Gets the text of a jsdoc comment, flattening links to their text. @@ -279,39 +279,39 @@ module Ts = abstract createInputFiles: javascriptText: string * declarationText: string * javascriptMapPath: string option * javascriptMapText: string option * declarationMapPath: string option * declarationMapText: string option -> InputFiles /// Create an external source map source file reference abstract createSourceMapSource: fileName: string * text: string * ?skipTrivia: (float -> float) -> SourceMapSource - abstract setOriginalNode: node: 'T * original: Node option -> 'T + abstract setOriginalNode: node: 'T * original: Node option -> 'T when 'T :> Node /// Clears any EmitNode entries from parse-tree nodes. /// A source file. abstract disposeEmitNodes: sourceFile: SourceFile option -> unit /// Sets flags that control emit behavior of a node. - abstract setEmitFlags: node: 'T * emitFlags: EmitFlags -> 'T + abstract setEmitFlags: node: 'T * emitFlags: EmitFlags -> 'T when 'T :> Node /// Gets a custom text range to use when emitting source maps. abstract getSourceMapRange: node: Node -> SourceMapRange /// Sets a custom text range to use when emitting source maps. - abstract setSourceMapRange: node: 'T * range: SourceMapRange option -> 'T + abstract setSourceMapRange: node: 'T * range: SourceMapRange option -> 'T when 'T :> Node /// Gets the TextRange to use for source maps for a token of a node. abstract getTokenSourceMapRange: node: Node * token: SyntaxKind -> SourceMapRange option /// Sets the TextRange to use for source maps for a token of a node. - abstract setTokenSourceMapRange: node: 'T * token: SyntaxKind * range: SourceMapRange option -> 'T + abstract setTokenSourceMapRange: node: 'T * token: SyntaxKind * range: SourceMapRange option -> 'T when 'T :> Node /// Gets a custom text range to use when emitting comments. abstract getCommentRange: node: Node -> TextRange /// Sets a custom text range to use when emitting comments. - abstract setCommentRange: node: 'T * range: TextRange -> 'T + abstract setCommentRange: node: 'T * range: TextRange -> 'T when 'T :> Node abstract getSyntheticLeadingComments: node: Node -> SynthesizedComment[] option - abstract setSyntheticLeadingComments: node: 'T * comments: SynthesizedComment[] option -> 'T - abstract addSyntheticLeadingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T + abstract setSyntheticLeadingComments: node: 'T * comments: SynthesizedComment[] option -> 'T when 'T :> Node + abstract addSyntheticLeadingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T when 'T :> Node abstract getSyntheticTrailingComments: node: Node -> SynthesizedComment[] option - abstract setSyntheticTrailingComments: node: 'T * comments: SynthesizedComment[] option -> 'T - abstract addSyntheticTrailingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T - abstract moveSyntheticComments: node: 'T * original: Node -> 'T + abstract setSyntheticTrailingComments: node: 'T * comments: SynthesizedComment[] option -> 'T when 'T :> Node + abstract addSyntheticTrailingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T when 'T :> Node + abstract moveSyntheticComments: node: 'T * original: Node -> 'T when 'T :> Node /// Gets the constant value to emit for an expression representing an enum. abstract getConstantValue: node: AccessExpression -> U2 option /// Sets the constant value to emit for an expression. abstract setConstantValue: node: AccessExpression * value: U2 -> AccessExpression /// Adds an EmitHelper to a node. - abstract addEmitHelper: node: 'T * helper: EmitHelper -> 'T + abstract addEmitHelper: node: 'T * helper: EmitHelper -> 'T when 'T :> Node /// Add EmitHelpers to a node. - abstract addEmitHelpers: node: 'T * helpers: EmitHelper[] option -> 'T + abstract addEmitHelpers: node: 'T * helpers: EmitHelper[] option -> 'T when 'T :> Node /// Removes an EmitHelper from a node. abstract removeEmitHelper: node: Node * helper: EmitHelper -> bool /// Gets the EmitHelpers of a node. @@ -516,7 +516,7 @@ module Ts = abstract isJSDocUnknownTag: node: Node -> bool abstract isJSDocPropertyTag: node: Node -> bool abstract isJSDocImplementsTag: node: Node -> bool - abstract setTextRange: range: 'T * location: TextRange option -> 'T + abstract setTextRange: range: 'T * location: TextRange option -> 'T when 'T :> TextRange /// /// Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes /// stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -531,7 +531,7 @@ module Ts = /// that they appear in the source code. The language service depends on this property to locate nodes by position. /// abstract forEachChild: node: Node * cbNode: (Node -> 'T option) * ?cbNodes: (Node[] -> 'T option) -> 'T option - abstract createSourceFile: fileName: string * sourceText: string * languageVersion: ScriptTarget * ?setParentNodes: bool * ?scriptKind: ScriptKind -> SourceFile + abstract createSourceFile: fileName: string * sourceText: string * languageVersionOrOptions: U2 * ?setParentNodes: bool * ?scriptKind: ScriptKind -> SourceFile abstract parseIsolatedEntityName: text: string * languageVersion: ScriptTarget -> EntityName option /// Parse json text into SyntaxTree and return node and parse errors if any /// @@ -578,7 +578,7 @@ module Ts = /// This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups /// is assumed to be the same as root directory of the project. /// - abstract resolveTypeReferenceDirective: typeReferenceDirectiveName: string * containingFile: string option * options: CompilerOptions * host: ModuleResolutionHost * ?redirectedReference: ResolvedProjectReference * ?cache: TypeReferenceDirectiveResolutionCache -> ResolvedTypeReferenceDirectiveWithFailedLookupLocations + abstract resolveTypeReferenceDirective: typeReferenceDirectiveName: string * containingFile: string option * options: CompilerOptions * host: ModuleResolutionHost * ?redirectedReference: ResolvedProjectReference * ?cache: TypeReferenceDirectiveResolutionCache * ?resolutionMode: obj -> ResolvedTypeReferenceDirectiveWithFailedLookupLocations /// Given a set of options, returns the set of type directive names /// that should be included for this program automatically. /// This list could either come from the config file, @@ -597,27 +597,27 @@ module Ts = /// The callback used to visit the Node. /// A callback to execute to verify the Node is valid. /// An optional callback to execute to lift a NodeArray into a valid Node. - abstract visitNode: node: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T + abstract visitNode: node: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T when 'T :> Node /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. /// The Node to visit. /// The callback used to visit the Node. /// A callback to execute to verify the Node is valid. /// An optional callback to execute to lift a NodeArray into a valid Node. - abstract visitNode: node: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option + abstract visitNode: node: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option when 'T :> Node /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. /// The NodeArray to visit. /// The callback used to visit a Node. /// A node test to execute for each node. /// An optional value indicating the starting offset at which to start visiting. /// An optional value indicating the maximum number of nodes to visit. - abstract visitNodes: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] + abstract visitNodes: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] when 'T :> Node /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. /// The NodeArray to visit. /// The callback used to visit a Node. /// A node test to execute for each node. /// An optional value indicating the starting offset at which to start visiting. /// An optional value indicating the maximum number of nodes to visit. - abstract visitNodes: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option + abstract visitNodes: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option when 'T :> Node /// Starts a new lexical environment and visits a statement list, ending the lexical environment /// and merging hoisted declarations upon completion. abstract visitLexicalEnvironment: statements: Statement[] * visitor: Visitor * context: TransformationContext * ?start: float * ?ensureUseStrict: bool * ?nodesVisitor: NodesVisitor -> Statement[] @@ -640,12 +640,12 @@ module Ts = /// The Node whose children will be visited. /// The callback used to visit each child. /// A lexical environment context for the visitor. - abstract visitEachChild: node: 'T * visitor: Visitor * context: TransformationContext -> 'T + abstract visitEachChild: node: 'T * visitor: Visitor * context: TransformationContext -> 'T when 'T :> Node /// Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. /// The Node whose children will be visited. /// The callback used to visit each child. /// A lexical environment context for the visitor. - abstract visitEachChild: node: 'T option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: obj * ?tokenVisitor: Visitor -> 'T option + abstract visitEachChild: node: 'T option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: obj * ?tokenVisitor: Visitor -> 'T option when 'T :> Node abstract getTsBuildInfoEmitOutputFilePath: options: CompilerOptions -> string option abstract getOutputFileNames: commandLine: ParsedCommandLine * inputFileName: string * ignoreCase: bool -> string[] abstract createPrinter: ?printerOptions: PrinterOptions * ?handlers: PrintHandlers -> Printer @@ -709,20 +709,20 @@ module Ts = abstract createAbstractBuilder: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: BuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> BuilderProgram abstract readBuilderProgram: compilerOptions: CompilerOptions * host: ReadBuildProgramHost -> EmitAndSemanticDiagnosticsBuilderProgram option abstract createIncrementalCompilerHost: options: CompilerOptions * ?system: System -> CompilerHost - abstract createIncrementalProgram: p0: IncrementalProgramOptions<'T> -> 'T + abstract createIncrementalProgram: p0: IncrementalProgramOptions<'T> -> 'T when 'T :> BuilderProgram /// Create the watch compiler host for either configFile or fileNames and its options - abstract createWatchCompilerHost: configFileName: string * optionsToExtend: CompilerOptions option * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> WatchCompilerHostOfConfigFile<'T> - abstract createWatchCompilerHost: rootFiles: string[] * options: CompilerOptions * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?projectReferences: ProjectReference[] * ?watchOptions: WatchOptions -> WatchCompilerHostOfFilesAndCompilerOptions<'T> + abstract createWatchCompilerHost: configFileName: string * optionsToExtend: CompilerOptions option * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> WatchCompilerHostOfConfigFile<'T> when 'T :> BuilderProgram + abstract createWatchCompilerHost: rootFiles: string[] * options: CompilerOptions * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?projectReferences: ProjectReference[] * ?watchOptions: WatchOptions -> WatchCompilerHostOfFilesAndCompilerOptions<'T> when 'T :> BuilderProgram /// Creates the watch from the host for root files and compiler options - abstract createWatchProgram: host: WatchCompilerHostOfFilesAndCompilerOptions<'T> -> WatchOfFilesAndCompilerOptions<'T> + abstract createWatchProgram: host: WatchCompilerHostOfFilesAndCompilerOptions<'T> -> WatchOfFilesAndCompilerOptions<'T> when 'T :> BuilderProgram /// Creates the watch from the host for config file - abstract createWatchProgram: host: WatchCompilerHostOfConfigFile<'T> -> WatchOfConfigFile<'T> + abstract createWatchProgram: host: WatchCompilerHostOfConfigFile<'T> -> WatchOfConfigFile<'T> when 'T :> BuilderProgram /// Create a function that reports watch status by writing to the system and handles the formating of the diagnostic abstract createBuilderStatusReporter: system: System * ?pretty: bool -> DiagnosticReporter - abstract createSolutionBuilderHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportErrorSummary: ReportEmitErrorSummary -> SolutionBuilderHost<'T> - abstract createSolutionBuilderWithWatchHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter -> SolutionBuilderWithWatchHost<'T> - abstract createSolutionBuilder: host: SolutionBuilderHost<'T> * rootNames: string[] * defaultOptions: BuildOptions -> SolutionBuilder<'T> - abstract createSolutionBuilderWithWatch: host: SolutionBuilderWithWatchHost<'T> * rootNames: string[] * defaultOptions: BuildOptions * ?baseWatchOptions: WatchOptions -> SolutionBuilder<'T> + abstract createSolutionBuilderHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportErrorSummary: ReportEmitErrorSummary -> SolutionBuilderHost<'T> when 'T :> BuilderProgram + abstract createSolutionBuilderWithWatchHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter -> SolutionBuilderWithWatchHost<'T> when 'T :> BuilderProgram + abstract createSolutionBuilder: host: SolutionBuilderHost<'T> * rootNames: string[] * defaultOptions: BuildOptions -> SolutionBuilder<'T> when 'T :> BuilderProgram + abstract createSolutionBuilderWithWatch: host: SolutionBuilderWithWatchHost<'T> * rootNames: string[] * defaultOptions: BuildOptions * ?baseWatchOptions: WatchOptions -> SolutionBuilder<'T> when 'T :> BuilderProgram abstract getDefaultFormatCodeSettings: ?newLineCharacter: string -> FormatCodeSettings /// The classifier is used for syntactic highlighting in editors via the TSServer abstract createClassifier: unit -> Classifier @@ -736,7 +736,7 @@ module Ts = abstract displayPartsToString: displayParts: SymbolDisplayPart[] option -> string abstract getDefaultCompilerOptions: unit -> CompilerOptions abstract getSupportedCodeFixes: unit -> string[] - abstract createLanguageServiceSourceFile: fileName: string * scriptSnapshot: IScriptSnapshot * scriptTarget: ScriptTarget * version: string * setNodeParents: bool * ?scriptKind: ScriptKind -> SourceFile + abstract createLanguageServiceSourceFile: fileName: string * scriptSnapshot: IScriptSnapshot * scriptTargetOrOptions: U2 * version: string * setNodeParents: bool * ?scriptKind: ScriptKind -> SourceFile abstract updateLanguageServiceSourceFile: sourceFile: SourceFile * scriptSnapshot: IScriptSnapshot * version: string * textChangeRange: TextChangeRange option * ?aggressiveChecks: bool -> SourceFile abstract createLanguageService: host: LanguageServiceHost * ?documentRegistry: DocumentRegistry * ?syntaxOnlyOrLanguageServiceMode: U2 -> LanguageService /// Get the path of the default library files (lib.d.ts) as distributed with the typescript @@ -747,9 +747,9 @@ module Ts = /// A single Node or an array of Node objects. /// An array of TransformerFactory callbacks used to process the transformation. /// Optional compiler options. - abstract transform: source: U2<'T, 'T[]> * transformers: TransformerFactory<'T>[] * ?compilerOptions: CompilerOptions -> TransformationResult<'T> + abstract transform: source: U2<'T, 'T[]> * transformers: TransformerFactory<'T>[] * ?compilerOptions: CompilerOptions -> TransformationResult<'T> when 'T :> Node [] - abstract createNodeArray: ('T[]) option -> (bool) option -> 'T[] + abstract createNodeArray: ('T[]) option -> (bool) option -> 'T[] when 'T :> Node [] abstract createNumericLiteral: U2 -> (TokenFlags) option -> NumericLiteral [] @@ -789,9 +789,9 @@ module Ts = [] abstract updateComputedPropertyName: ComputedPropertyName -> Expression -> ComputedPropertyName [] - abstract createTypeParameterDeclaration: U2 -> (TypeNode) option -> (TypeNode) option -> TypeParameterDeclaration + abstract createTypeParameterDeclaration: {| Invoke: Modifier[] option -> U2 -> TypeNode option -> TypeNode option -> TypeParameterDeclaration; Invoke: U2 -> TypeNode option -> TypeNode option -> TypeParameterDeclaration |} [] - abstract updateTypeParameterDeclaration: TypeParameterDeclaration -> Identifier -> TypeNode option -> TypeNode option -> TypeParameterDeclaration + abstract updateTypeParameterDeclaration: {| Invoke: TypeParameterDeclaration -> Modifier[] option -> Identifier -> TypeNode option -> TypeNode option -> TypeParameterDeclaration; Invoke: TypeParameterDeclaration -> Identifier -> TypeNode option -> TypeNode option -> TypeParameterDeclaration |} [] abstract createParameter: Decorator[] option -> Modifier[] option -> DotDotDotToken option -> U2 -> (QuestionToken) option -> (TypeNode) option -> (Expression) option -> ParameterDeclaration [] @@ -849,9 +849,9 @@ module Ts = [] abstract updateConstructorTypeNode: ConstructorTypeNode -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode -> ConstructorTypeNode [] - abstract createTypeQueryNode: EntityName -> TypeQueryNode + abstract createTypeQueryNode: EntityName -> (TypeNode[]) option -> TypeQueryNode [] - abstract updateTypeQueryNode: TypeQueryNode -> EntityName -> TypeQueryNode + abstract updateTypeQueryNode: TypeQueryNode -> EntityName -> (TypeNode[]) option -> TypeQueryNode [] abstract createTypeLiteralNode: TypeElement[] option -> TypeLiteralNode [] @@ -889,9 +889,9 @@ module Ts = [] abstract updateInferTypeNode: InferTypeNode -> TypeParameterDeclaration -> InferTypeNode [] - abstract createImportTypeNode: TypeNode -> (EntityName) option -> (TypeNode[]) option -> (bool) option -> ImportTypeNode + abstract createImportTypeNode: {| Invoke: TypeNode -> EntityName option -> TypeNode[] option -> bool option -> ImportTypeNode; Invoke: TypeNode -> ImportTypeAssertionContainer option -> EntityName option -> TypeNode[] option -> bool option -> ImportTypeNode |} [] - abstract updateImportTypeNode: ImportTypeNode -> TypeNode -> EntityName option -> TypeNode[] option -> (bool) option -> ImportTypeNode + abstract updateImportTypeNode: {| Invoke: ImportTypeNode -> TypeNode -> EntityName option -> TypeNode[] option -> bool option -> ImportTypeNode; Invoke: ImportTypeNode -> TypeNode -> ImportTypeAssertionContainer option -> EntityName option -> TypeNode[] option -> bool option -> ImportTypeNode |} [] abstract createParenthesizedType: TypeNode -> ParenthesizedTypeNode [] @@ -1441,7 +1441,7 @@ module Ts = /// captured with respect to transformations. /// [] - abstract getMutableClone: 'T -> 'T + abstract getMutableClone: 'T -> 'T when 'T :> Node [] abstract isTypeAssertion: Node -> bool [] @@ -1678,216 +1678,219 @@ module Ts = | ModuleKeyword = 141 | NamespaceKeyword = 142 | NeverKeyword = 143 - | ReadonlyKeyword = 144 - | RequireKeyword = 145 - | NumberKeyword = 146 - | ObjectKeyword = 147 - | SetKeyword = 148 - | StringKeyword = 149 - | SymbolKeyword = 150 - | TypeKeyword = 151 - | UndefinedKeyword = 152 - | UniqueKeyword = 153 - | UnknownKeyword = 154 - | FromKeyword = 155 - | GlobalKeyword = 156 - | BigIntKeyword = 157 - | OverrideKeyword = 158 - | OfKeyword = 159 - | QualifiedName = 160 - | ComputedPropertyName = 161 - | TypeParameter = 162 - | Parameter = 163 - | Decorator = 164 - | PropertySignature = 165 - | PropertyDeclaration = 166 - | MethodSignature = 167 - | MethodDeclaration = 168 - | ClassStaticBlockDeclaration = 169 - | Constructor = 170 - | GetAccessor = 171 - | SetAccessor = 172 - | CallSignature = 173 - | ConstructSignature = 174 - | IndexSignature = 175 - | TypePredicate = 176 - | TypeReference = 177 - | FunctionType = 178 - | ConstructorType = 179 - | TypeQuery = 180 - | TypeLiteral = 181 - | ArrayType = 182 - | TupleType = 183 - | OptionalType = 184 - | RestType = 185 - | UnionType = 186 - | IntersectionType = 187 - | ConditionalType = 188 - | InferType = 189 - | ParenthesizedType = 190 - | ThisType = 191 - | TypeOperator = 192 - | IndexedAccessType = 193 - | MappedType = 194 - | LiteralType = 195 - | NamedTupleMember = 196 - | TemplateLiteralType = 197 - | TemplateLiteralTypeSpan = 198 - | ImportType = 199 - | ObjectBindingPattern = 200 - | ArrayBindingPattern = 201 - | BindingElement = 202 - | ArrayLiteralExpression = 203 - | ObjectLiteralExpression = 204 - | PropertyAccessExpression = 205 - | ElementAccessExpression = 206 - | CallExpression = 207 - | NewExpression = 208 - | TaggedTemplateExpression = 209 - | TypeAssertionExpression = 210 - | ParenthesizedExpression = 211 - | FunctionExpression = 212 - | ArrowFunction = 213 - | DeleteExpression = 214 - | TypeOfExpression = 215 - | VoidExpression = 216 - | AwaitExpression = 217 - | PrefixUnaryExpression = 218 - | PostfixUnaryExpression = 219 - | BinaryExpression = 220 - | ConditionalExpression = 221 - | TemplateExpression = 222 - | YieldExpression = 223 - | SpreadElement = 224 - | ClassExpression = 225 - | OmittedExpression = 226 - | ExpressionWithTypeArguments = 227 - | AsExpression = 228 - | NonNullExpression = 229 - | MetaProperty = 230 - | SyntheticExpression = 231 - | TemplateSpan = 232 - | SemicolonClassElement = 233 - | Block = 234 - | EmptyStatement = 235 - | VariableStatement = 236 - | ExpressionStatement = 237 - | IfStatement = 238 - | DoStatement = 239 - | WhileStatement = 240 - | ForStatement = 241 - | ForInStatement = 242 - | ForOfStatement = 243 - | ContinueStatement = 244 - | BreakStatement = 245 - | ReturnStatement = 246 - | WithStatement = 247 - | SwitchStatement = 248 - | LabeledStatement = 249 - | ThrowStatement = 250 - | TryStatement = 251 - | DebuggerStatement = 252 - | VariableDeclaration = 253 - | VariableDeclarationList = 254 - | FunctionDeclaration = 255 - | ClassDeclaration = 256 - | InterfaceDeclaration = 257 - | TypeAliasDeclaration = 258 - | EnumDeclaration = 259 - | ModuleDeclaration = 260 - | ModuleBlock = 261 - | CaseBlock = 262 - | NamespaceExportDeclaration = 263 - | ImportEqualsDeclaration = 264 - | ImportDeclaration = 265 - | ImportClause = 266 - | NamespaceImport = 267 - | NamedImports = 268 - | ImportSpecifier = 269 - | ExportAssignment = 270 - | ExportDeclaration = 271 - | NamedExports = 272 - | NamespaceExport = 273 - | ExportSpecifier = 274 - | MissingDeclaration = 275 - | ExternalModuleReference = 276 - | JsxElement = 277 - | JsxSelfClosingElement = 278 - | JsxOpeningElement = 279 - | JsxClosingElement = 280 - | JsxFragment = 281 - | JsxOpeningFragment = 282 - | JsxClosingFragment = 283 - | JsxAttribute = 284 - | JsxAttributes = 285 - | JsxSpreadAttribute = 286 - | JsxExpression = 287 - | CaseClause = 288 - | DefaultClause = 289 - | HeritageClause = 290 - | CatchClause = 291 - | AssertClause = 292 - | AssertEntry = 293 - | PropertyAssignment = 294 - | ShorthandPropertyAssignment = 295 - | SpreadAssignment = 296 - | EnumMember = 297 - | UnparsedPrologue = 298 - | UnparsedPrepend = 299 - | UnparsedText = 300 - | UnparsedInternalText = 301 - | UnparsedSyntheticReference = 302 - | SourceFile = 303 - | Bundle = 304 - | UnparsedSource = 305 - | InputFiles = 306 - | JSDocTypeExpression = 307 - | JSDocNameReference = 308 - | JSDocMemberName = 309 - | JSDocAllType = 310 - | JSDocUnknownType = 311 - | JSDocNullableType = 312 - | JSDocNonNullableType = 313 - | JSDocOptionalType = 314 - | JSDocFunctionType = 315 - | JSDocVariadicType = 316 - | JSDocNamepathType = 317 - | JSDocComment = 318 - | JSDocText = 319 - | JSDocTypeLiteral = 320 - | JSDocSignature = 321 - | JSDocLink = 322 - | JSDocLinkCode = 323 - | JSDocLinkPlain = 324 - | JSDocTag = 325 - | JSDocAugmentsTag = 326 - | JSDocImplementsTag = 327 - | JSDocAuthorTag = 328 - | JSDocDeprecatedTag = 329 - | JSDocClassTag = 330 - | JSDocPublicTag = 331 - | JSDocPrivateTag = 332 - | JSDocProtectedTag = 333 - | JSDocReadonlyTag = 334 - | JSDocOverrideTag = 335 - | JSDocCallbackTag = 336 - | JSDocEnumTag = 337 - | JSDocParameterTag = 338 - | JSDocReturnTag = 339 - | JSDocThisTag = 340 - | JSDocTypeTag = 341 - | JSDocTemplateTag = 342 - | JSDocTypedefTag = 343 - | JSDocSeeTag = 344 - | JSDocPropertyTag = 345 - | SyntaxList = 346 - | NotEmittedStatement = 347 - | PartiallyEmittedExpression = 348 - | CommaListExpression = 349 - | MergeDeclarationMarker = 350 - | EndOfDeclarationMarker = 351 - | SyntheticReferenceExpression = 352 - | Count = 353 + | OutKeyword = 144 + | ReadonlyKeyword = 145 + | RequireKeyword = 146 + | NumberKeyword = 147 + | ObjectKeyword = 148 + | SetKeyword = 149 + | StringKeyword = 150 + | SymbolKeyword = 151 + | TypeKeyword = 152 + | UndefinedKeyword = 153 + | UniqueKeyword = 154 + | UnknownKeyword = 155 + | FromKeyword = 156 + | GlobalKeyword = 157 + | BigIntKeyword = 158 + | OverrideKeyword = 159 + | OfKeyword = 160 + | QualifiedName = 161 + | ComputedPropertyName = 162 + | TypeParameter = 163 + | Parameter = 164 + | Decorator = 165 + | PropertySignature = 166 + | PropertyDeclaration = 167 + | MethodSignature = 168 + | MethodDeclaration = 169 + | ClassStaticBlockDeclaration = 170 + | Constructor = 171 + | GetAccessor = 172 + | SetAccessor = 173 + | CallSignature = 174 + | ConstructSignature = 175 + | IndexSignature = 176 + | TypePredicate = 177 + | TypeReference = 178 + | FunctionType = 179 + | ConstructorType = 180 + | TypeQuery = 181 + | TypeLiteral = 182 + | ArrayType = 183 + | TupleType = 184 + | OptionalType = 185 + | RestType = 186 + | UnionType = 187 + | IntersectionType = 188 + | ConditionalType = 189 + | InferType = 190 + | ParenthesizedType = 191 + | ThisType = 192 + | TypeOperator = 193 + | IndexedAccessType = 194 + | MappedType = 195 + | LiteralType = 196 + | NamedTupleMember = 197 + | TemplateLiteralType = 198 + | TemplateLiteralTypeSpan = 199 + | ImportType = 200 + | ObjectBindingPattern = 201 + | ArrayBindingPattern = 202 + | BindingElement = 203 + | ArrayLiteralExpression = 204 + | ObjectLiteralExpression = 205 + | PropertyAccessExpression = 206 + | ElementAccessExpression = 207 + | CallExpression = 208 + | NewExpression = 209 + | TaggedTemplateExpression = 210 + | TypeAssertionExpression = 211 + | ParenthesizedExpression = 212 + | FunctionExpression = 213 + | ArrowFunction = 214 + | DeleteExpression = 215 + | TypeOfExpression = 216 + | VoidExpression = 217 + | AwaitExpression = 218 + | PrefixUnaryExpression = 219 + | PostfixUnaryExpression = 220 + | BinaryExpression = 221 + | ConditionalExpression = 222 + | TemplateExpression = 223 + | YieldExpression = 224 + | SpreadElement = 225 + | ClassExpression = 226 + | OmittedExpression = 227 + | ExpressionWithTypeArguments = 228 + | AsExpression = 229 + | NonNullExpression = 230 + | MetaProperty = 231 + | SyntheticExpression = 232 + | TemplateSpan = 233 + | SemicolonClassElement = 234 + | Block = 235 + | EmptyStatement = 236 + | VariableStatement = 237 + | ExpressionStatement = 238 + | IfStatement = 239 + | DoStatement = 240 + | WhileStatement = 241 + | ForStatement = 242 + | ForInStatement = 243 + | ForOfStatement = 244 + | ContinueStatement = 245 + | BreakStatement = 246 + | ReturnStatement = 247 + | WithStatement = 248 + | SwitchStatement = 249 + | LabeledStatement = 250 + | ThrowStatement = 251 + | TryStatement = 252 + | DebuggerStatement = 253 + | VariableDeclaration = 254 + | VariableDeclarationList = 255 + | FunctionDeclaration = 256 + | ClassDeclaration = 257 + | InterfaceDeclaration = 258 + | TypeAliasDeclaration = 259 + | EnumDeclaration = 260 + | ModuleDeclaration = 261 + | ModuleBlock = 262 + | CaseBlock = 263 + | NamespaceExportDeclaration = 264 + | ImportEqualsDeclaration = 265 + | ImportDeclaration = 266 + | ImportClause = 267 + | NamespaceImport = 268 + | NamedImports = 269 + | ImportSpecifier = 270 + | ExportAssignment = 271 + | ExportDeclaration = 272 + | NamedExports = 273 + | NamespaceExport = 274 + | ExportSpecifier = 275 + | MissingDeclaration = 276 + | ExternalModuleReference = 277 + | JsxElement = 278 + | JsxSelfClosingElement = 279 + | JsxOpeningElement = 280 + | JsxClosingElement = 281 + | JsxFragment = 282 + | JsxOpeningFragment = 283 + | JsxClosingFragment = 284 + | JsxAttribute = 285 + | JsxAttributes = 286 + | JsxSpreadAttribute = 287 + | JsxExpression = 288 + | CaseClause = 289 + | DefaultClause = 290 + | HeritageClause = 291 + | CatchClause = 292 + | AssertClause = 293 + | AssertEntry = 294 + | ImportTypeAssertionContainer = 295 + | PropertyAssignment = 296 + | ShorthandPropertyAssignment = 297 + | SpreadAssignment = 298 + | EnumMember = 299 + | UnparsedPrologue = 300 + | UnparsedPrepend = 301 + | UnparsedText = 302 + | UnparsedInternalText = 303 + | UnparsedSyntheticReference = 304 + | SourceFile = 305 + | Bundle = 306 + | UnparsedSource = 307 + | InputFiles = 308 + | JSDocTypeExpression = 309 + | JSDocNameReference = 310 + | JSDocMemberName = 311 + | JSDocAllType = 312 + | JSDocUnknownType = 313 + | JSDocNullableType = 314 + | JSDocNonNullableType = 315 + | JSDocOptionalType = 316 + | JSDocFunctionType = 317 + | JSDocVariadicType = 318 + | JSDocNamepathType = 319 + /// Use SyntaxKind.JSDoc + | JSDocComment = 320 + | JSDocText = 321 + | JSDocTypeLiteral = 322 + | JSDocSignature = 323 + | JSDocLink = 324 + | JSDocLinkCode = 325 + | JSDocLinkPlain = 326 + | JSDocTag = 327 + | JSDocAugmentsTag = 328 + | JSDocImplementsTag = 329 + | JSDocAuthorTag = 330 + | JSDocDeprecatedTag = 331 + | JSDocClassTag = 332 + | JSDocPublicTag = 333 + | JSDocPrivateTag = 334 + | JSDocProtectedTag = 335 + | JSDocReadonlyTag = 336 + | JSDocOverrideTag = 337 + | JSDocCallbackTag = 338 + | JSDocEnumTag = 339 + | JSDocParameterTag = 340 + | JSDocReturnTag = 341 + | JSDocThisTag = 342 + | JSDocTypeTag = 343 + | JSDocTemplateTag = 344 + | JSDocTypedefTag = 345 + | JSDocSeeTag = 346 + | JSDocPropertyTag = 347 + | SyntaxList = 348 + | NotEmittedStatement = 349 + | PartiallyEmittedExpression = 350 + | CommaListExpression = 351 + | MergeDeclarationMarker = 352 + | EndOfDeclarationMarker = 353 + | SyntheticReferenceExpression = 354 + | Count = 355 | FirstAssignment = 63 | LastAssignment = 78 | FirstCompoundAssignment = 64 @@ -1895,15 +1898,15 @@ module Ts = | FirstReservedWord = 81 | LastReservedWord = 116 | FirstKeyword = 81 - | LastKeyword = 159 + | LastKeyword = 160 | FirstFutureReservedWord = 117 | LastFutureReservedWord = 125 - | FirstTypeNode = 176 - | LastTypeNode = 199 + | FirstTypeNode = 177 + | LastTypeNode = 200 | FirstPunctuation = 18 | LastPunctuation = 78 | FirstToken = 0 - | LastToken = 159 + | LastToken = 160 | FirstTriviaToken = 2 | LastTriviaToken = 7 | FirstLiteralToken = 8 @@ -1912,13 +1915,14 @@ module Ts = | LastTemplateToken = 17 | FirstBinaryOperator = 29 | LastBinaryOperator = 78 - | FirstStatement = 236 - | LastStatement = 252 - | FirstNode = 160 - | FirstJSDocNode = 307 - | LastJSDocNode = 345 - | FirstJSDocTagNode = 325 - | LastJSDocTagNode = 345 + | FirstStatement = 237 + | LastStatement = 253 + | FirstNode = 161 + | FirstJSDocNode = 309 + | LastJSDocNode = 347 + | FirstJSDocTagNode = 327 + | LastJSDocTagNode = 347 + | JSDoc = 320 type TriviaSyntaxKind = SyntaxKind @@ -1968,16 +1972,17 @@ module Ts = | YieldContext = 8192 | DecoratorContext = 16384 | AwaitContext = 32768 - | ThisNodeHasError = 65536 - | JavaScriptFile = 131072 - | ThisNodeOrAnySubNodesHasError = 262144 - | HasAggregatedChildData = 524288 - | JSDoc = 4194304 - | JsonFile = 33554432 + | DisallowConditionalTypesContext = 65536 + | ThisNodeHasError = 131072 + | JavaScriptFile = 262144 + | ThisNodeOrAnySubNodesHasError = 524288 + | HasAggregatedChildData = 1048576 + | JSDoc = 8388608 + | JsonFile = 67108864 | BlockScoped = 3 | ReachabilityCheckFlags = 768 | ReachabilityAndEmitFlags = 2816 - | ContextFlags = 25358336 + | ContextFlags = 50720768 | TypeExcludesFlags = 40960 type [] ModifierFlags = @@ -1996,13 +2001,15 @@ module Ts = | HasComputedJSDocModifiers = 4096 | Deprecated = 8192 | Override = 16384 + | In = 32768 + | Out = 65536 | HasComputedFlags = 536870912 | AccessibilityModifier = 28 | ParameterPropertyModifier = 16476 | NonPublicAccessibilityModifier = 24 - | TypeScriptModifier = 18654 + | TypeScriptModifier = 116958 | ExportDefault = 513 - | All = 27647 + | All = 125951 type [] JsxFlags = | None = 0 @@ -2042,67 +2049,120 @@ module Ts = obj type [] [] HasType = - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertySignature of PropertySignature - | [] PropertyDeclaration of PropertyDeclaration - | [] MethodSignature of MethodSignature - | [] MethodDeclaration of MethodDeclaration - | [] ConstructorDeclaration of ConstructorDeclaration - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] CallSignatureDeclaration of CallSignatureDeclaration - | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration - | [] IndexSignatureDeclaration of IndexSignatureDeclaration - | [] TypePredicateNode of TypePredicateNode - | [] FunctionTypeNode of FunctionTypeNode - | [] ConstructorTypeNode of ConstructorTypeNode - | [] ParenthesizedTypeNode of ParenthesizedTypeNode - | [] TypeOperatorNode of TypeOperatorNode - | [] MappedTypeNode of MappedTypeNode - | [] TypeAssertion of TypeAssertion - | [] FunctionExpression of FunctionExpression - | [] ArrowFunction of ArrowFunction - | [] AsExpression of AsExpression - | [] VariableDeclaration of VariableDeclaration - | [] FunctionDeclaration of FunctionDeclaration - | [] TypeAliasDeclaration of TypeAliasDeclaration - | [] JSDocTypeExpression of JSDocTypeExpression - | [] JSDocNullableType of JSDocNullableType - | [] JSDocNonNullableType of JSDocNonNullableType - | [] JSDocOptionalType of JSDocOptionalType - | [] JSDocFunctionType of JSDocFunctionType - | [] JSDocVariadicType of JSDocVariadicType + | [] ArrowFunction of ArrowFunction + | [] AsExpression of AsExpression + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] FunctionTypeNode of FunctionTypeNode + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] JSDocFunctionType of JSDocFunctionType + | [] JSDocNonNullableType of JSDocNonNullableType + | [] JSDocNullableType of JSDocNullableType + | [] JSDocOptionalType of JSDocOptionalType + | [] JSDocTypeExpression of JSDocTypeExpression + | [] JSDocVariadicType of JSDocVariadicType + | [] MappedTypeNode of MappedTypeNode + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] ParameterDeclaration of ParameterDeclaration + | [] ParenthesizedTypeNode of ParenthesizedTypeNode + | [] PropertyDeclaration of PropertyDeclaration + | [] PropertySignature of PropertySignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + | [] TypeAssertion of TypeAssertion + | [] TypeOperatorNode of TypeOperatorNode + | [] TypePredicateNode of TypePredicateNode + | [] VariableDeclaration of VariableDeclaration + static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + static member inline op_ErasedCast(x: AsExpression) = AsExpression x + static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x + static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x + static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x + static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x + static member inline op_ErasedCast(x: JSDocNonNullableType) = JSDocNonNullableType x + static member inline op_ErasedCast(x: JSDocNullableType) = JSDocNullableType x + static member inline op_ErasedCast(x: JSDocOptionalType) = JSDocOptionalType x + static member inline op_ErasedCast(x: JSDocTypeExpression) = JSDocTypeExpression x + static member inline op_ErasedCast(x: JSDocVariadicType) = JSDocVariadicType x + static member inline op_ErasedCast(x: MappedTypeNode) = MappedTypeNode x + static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + static member inline op_ErasedCast(x: ParenthesizedTypeNode) = ParenthesizedTypeNode x + static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x + static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x + static member inline op_ErasedCast(x: TypeAssertion) = TypeAssertion x + static member inline op_ErasedCast(x: TypeOperatorNode) = TypeOperatorNode x + static member inline op_ErasedCast(x: TypePredicateNode) = TypePredicateNode x + static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] [] HasTypeArguments = - | [] CallExpression of CallExpression - | [] NewExpression of NewExpression - | [] TaggedTemplateExpression of TaggedTemplateExpression - | [] JsxSelfClosingElement of JsxSelfClosingElement - | [] JsxOpeningElement of JsxOpeningElement + | [] CallExpression of CallExpression + | [] JsxOpeningElement of JsxOpeningElement + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] NewExpression of NewExpression + | [] TaggedTemplateExpression of TaggedTemplateExpression + static member inline op_ErasedCast(x: CallExpression) = CallExpression x + static member inline op_ErasedCast(x: JsxOpeningElement) = JsxOpeningElement x + static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x + static member inline op_ErasedCast(x: NewExpression) = NewExpression x + static member inline op_ErasedCast(x: TaggedTemplateExpression) = TaggedTemplateExpression x type [] [] HasInitializer = - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertySignature of PropertySignature - | [] PropertyDeclaration of PropertyDeclaration - | [] BindingElement of BindingElement - | [] ForStatement of ForStatement - | [] ForInStatement of ForInStatement - | [] ForOfStatement of ForOfStatement - | [] VariableDeclaration of VariableDeclaration - | [] JsxAttribute of JsxAttribute - | [] PropertyAssignment of PropertyAssignment - | [] EnumMember of EnumMember + | [] BindingElement of BindingElement + | [] EnumMember of EnumMember + | [] ForInStatement of ForInStatement + | [] ForOfStatement of ForOfStatement + | [] ForStatement of ForStatement + | [] JsxAttribute of JsxAttribute + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] PropertyDeclaration of PropertyDeclaration + | [] PropertySignature of PropertySignature + | [] VariableDeclaration of VariableDeclaration + static member inline op_ErasedCast(x: BindingElement) = BindingElement x + static member inline op_ErasedCast(x: EnumMember) = EnumMember x + static member inline op_ErasedCast(x: ForInStatement) = ForInStatement x + static member inline op_ErasedCast(x: ForOfStatement) = ForOfStatement x + static member inline op_ErasedCast(x: ForStatement) = ForStatement x + static member inline op_ErasedCast(x: JsxAttribute) = JsxAttribute x + static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x + static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] [] HasExpressionInitializer = - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertySignature of PropertySignature - | [] PropertyDeclaration of PropertyDeclaration - | [] BindingElement of BindingElement - | [] VariableDeclaration of VariableDeclaration - | [] PropertyAssignment of PropertyAssignment - | [] EnumMember of EnumMember - - type [] NodeArray<'T> = + | [] BindingElement of BindingElement + | [] EnumMember of EnumMember + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] PropertyDeclaration of PropertyDeclaration + | [] PropertySignature of PropertySignature + | [] VariableDeclaration of VariableDeclaration + static member inline op_ErasedCast(x: BindingElement) = BindingElement x + static member inline op_ErasedCast(x: EnumMember) = EnumMember x + static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x + static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x + + type [] NodeArray<'T when 'T :> Node> = inherit ReadonlyArray<'T> inherit ReadonlyTextRange abstract hasTrailingComma: bool @@ -2118,37 +2178,37 @@ module Ts = inherit Token<'TKind> type DotToken = - PunctuationToken + inherit PunctuationToken type DotDotDotToken = - PunctuationToken + inherit PunctuationToken type QuestionToken = - PunctuationToken + inherit PunctuationToken type ExclamationToken = - PunctuationToken + inherit PunctuationToken type ColonToken = - PunctuationToken + inherit PunctuationToken type EqualsToken = - PunctuationToken + inherit PunctuationToken type AsteriskToken = - PunctuationToken + inherit PunctuationToken type EqualsGreaterThanToken = - PunctuationToken + inherit PunctuationToken type PlusToken = - PunctuationToken + inherit PunctuationToken type MinusToken = - PunctuationToken + inherit PunctuationToken type QuestionDotToken = - PunctuationToken + inherit PunctuationToken type [] KeywordToken<'TKind> = inherit Token<'TKind> @@ -2174,78 +2234,112 @@ module Ts = inherit KeywordToken<'TKind> type AbstractKeyword = - ModifierToken + inherit ModifierToken type AsyncKeyword = - ModifierToken + inherit ModifierToken type ConstKeyword = - ModifierToken + inherit ModifierToken type DeclareKeyword = - ModifierToken + inherit ModifierToken type DefaultKeyword = - ModifierToken + inherit ModifierToken type ExportKeyword = - ModifierToken + inherit ModifierToken + + type InKeyword = + inherit ModifierToken type PrivateKeyword = - ModifierToken + inherit ModifierToken type ProtectedKeyword = - ModifierToken + inherit ModifierToken type PublicKeyword = - ModifierToken + inherit ModifierToken type ReadonlyKeyword = - ModifierToken + inherit ModifierToken + + type OutKeyword = + inherit ModifierToken type OverrideKeyword = - ModifierToken + inherit ModifierToken type StaticKeyword = - ModifierToken + inherit ModifierToken [] type ReadonlyToken = ReadonlyKeyword type [] [] Modifier = - | [] ConstKeyword of ConstKeyword - | [] DefaultKeyword of DefaultKeyword - | [] ExportKeyword of ExportKeyword - | [] PrivateKeyword of PrivateKeyword - | [] ProtectedKeyword of ProtectedKeyword - | [] PublicKeyword of PublicKeyword - | [] StaticKeyword of StaticKeyword - | [] AbstractKeyword of AbstractKeyword - | [] AsyncKeyword of AsyncKeyword - | [] DeclareKeyword of DeclareKeyword - | [] ReadonlyKeyword of ReadonlyKeyword - | [] OverrideKeyword of OverrideKeyword - with - [] member this.kind : SyntaxKind = jsNative + | [] AbstractKeyword of AbstractKeyword + | [] AsyncKeyword of AsyncKeyword + | [] ConstKeyword of ConstKeyword + | [] DeclareKeyword of DeclareKeyword + | [] DefaultKeyword of DefaultKeyword + | [] ExportKeyword of ExportKeyword + | [] InKeyword of InKeyword + | [] OutKeyword of OutKeyword + | [] OverrideKeyword of OverrideKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + | [] StaticKeyword of StaticKeyword + [] + member _.kind : SyntaxKind = jsNative + static member inline op_ErasedCast(x: AbstractKeyword) = AbstractKeyword x + static member inline op_ErasedCast(x: AsyncKeyword) = AsyncKeyword x + static member inline op_ErasedCast(x: ConstKeyword) = ConstKeyword x + static member inline op_ErasedCast(x: DeclareKeyword) = DeclareKeyword x + static member inline op_ErasedCast(x: DefaultKeyword) = DefaultKeyword x + static member inline op_ErasedCast(x: ExportKeyword) = ExportKeyword x + static member inline op_ErasedCast(x: InKeyword) = InKeyword x + static member inline op_ErasedCast(x: OutKeyword) = OutKeyword x + static member inline op_ErasedCast(x: OverrideKeyword) = OverrideKeyword x + static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x + static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x + static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x + static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x + static member inline op_ErasedCast(x: StaticKeyword) = StaticKeyword x type [] [] AccessibilityModifier = - | [] PrivateKeyword of PrivateKeyword - | [] ProtectedKeyword of ProtectedKeyword - | [] PublicKeyword of PublicKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x + static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x + static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x type [] [] ParameterPropertyModifier = - | [] PrivateKeyword of PrivateKeyword - | [] ProtectedKeyword of ProtectedKeyword - | [] PublicKeyword of PublicKeyword - | [] ReadonlyKeyword of ReadonlyKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x + static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x + static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x + static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x type [] [] ClassMemberModifier = - | [] PrivateKeyword of PrivateKeyword - | [] ProtectedKeyword of ProtectedKeyword - | [] PublicKeyword of PublicKeyword - | [] StaticKeyword of StaticKeyword - | [] ReadonlyKeyword of ReadonlyKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + | [] StaticKeyword of StaticKeyword + static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x + static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x + static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x + static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x + static member inline op_ErasedCast(x: StaticKeyword) = StaticKeyword x type ModifiersArray = Modifier[] @@ -2281,31 +2375,50 @@ module Ts = abstract right: Identifier type [] [] EntityName = - | [] Identifier of Identifier - | [] QualifiedName of QualifiedName + | [] Identifier of Identifier + | [] QualifiedName of QualifiedName + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: QualifiedName) = QualifiedName x type [] [] PropertyName = - | [] NumericLiteral of NumericLiteral - | [] StringLiteral of StringLiteral - | [] Identifier of Identifier - | [] PrivateIdentifier of PrivateIdentifier - | [] ComputedPropertyName of ComputedPropertyName + | [] ComputedPropertyName of ComputedPropertyName + | [] Identifier of Identifier + | [] NumericLiteral of NumericLiteral + | [] PrivateIdentifier of PrivateIdentifier + | [] StringLiteral of StringLiteral + static member inline op_ErasedCast(x: ComputedPropertyName) = ComputedPropertyName x + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + static member inline op_ErasedCast(x: PrivateIdentifier) = PrivateIdentifier x + static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] [] MemberName = - | [] Identifier of Identifier - | [] PrivateIdentifier of PrivateIdentifier + | [] Identifier of Identifier + | [] PrivateIdentifier of PrivateIdentifier + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: PrivateIdentifier) = PrivateIdentifier x type [] [] DeclarationName = - | [] NumericLiteral of NumericLiteral - | [] StringLiteral of StringLiteral - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] Identifier of Identifier - | [] PrivateIdentifier of PrivateIdentifier - | [] ComputedPropertyName of ComputedPropertyName - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ArrayBindingPattern of ArrayBindingPattern - | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression - | [] ElementAccessExpression of ElementAccessExpression + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ComputedPropertyName of ComputedPropertyName + | [] ElementAccessExpression of ElementAccessExpression + | [] Identifier of Identifier + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] NumericLiteral of NumericLiteral + | [] ObjectBindingPattern of ObjectBindingPattern + | [] PrivateIdentifier of PrivateIdentifier + | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression + | [] StringLiteral of StringLiteral + static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + static member inline op_ErasedCast(x: ComputedPropertyName) = ComputedPropertyName x + static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + static member inline op_ErasedCast(x: PrivateIdentifier) = PrivateIdentifier x + static member inline op_ErasedCast(x: PropertyAccessEntityNameExpression) = PropertyAccessEntityNameExpression x + static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] Declaration = inherit Node @@ -2358,20 +2471,34 @@ module Ts = abstract ``type``: TypeNode option type [] [] SignatureDeclaration = - | [] MethodSignature of MethodSignature - | [] MethodDeclaration of MethodDeclaration - | [] ConstructorDeclaration of ConstructorDeclaration - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] CallSignatureDeclaration of CallSignatureDeclaration - | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration - | [] IndexSignatureDeclaration of IndexSignatureDeclaration - | [] FunctionTypeNode of FunctionTypeNode - | [] ConstructorTypeNode of ConstructorTypeNode - | [] FunctionExpression of FunctionExpression - | [] ArrowFunction of ArrowFunction - | [] FunctionDeclaration of FunctionDeclaration - | [] JSDocFunctionType of JSDocFunctionType + | [] ArrowFunction of ArrowFunction + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] FunctionTypeNode of FunctionTypeNode + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] JSDocFunctionType of JSDocFunctionType + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x + static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x + static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x + static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x + static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x type [] CallSignatureDeclaration = inherit SignatureDeclarationBase @@ -2384,9 +2511,12 @@ module Ts = abstract kind: SyntaxKind type [] [] BindingName = - | [] Identifier of Identifier - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayBindingPattern of ArrayBindingPattern + | [] Identifier of Identifier + | [] ObjectBindingPattern of ObjectBindingPattern + static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x type [] VariableDeclaration = inherit NamedDeclaration @@ -2451,12 +2581,18 @@ module Ts = /// Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. type [] [] ObjectLiteralElementLike = - | [] MethodDeclaration of MethodDeclaration - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] PropertyAssignment of PropertyAssignment - | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment - | [] SpreadAssignment of SpreadAssignment + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] MethodDeclaration of MethodDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] SpreadAssignment of SpreadAssignment + static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x + static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x type [] PropertyAssignment = inherit ObjectLiteralElement @@ -2487,17 +2623,28 @@ module Ts = abstract expression: Expression type [] [] VariableLikeDeclaration = - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertySignature of PropertySignature - | [] PropertyDeclaration of PropertyDeclaration - | [] BindingElement of BindingElement - | [] VariableDeclaration of VariableDeclaration - | [] JsxAttribute of JsxAttribute - | [] PropertyAssignment of PropertyAssignment - | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment - | [] EnumMember of EnumMember - | [] JSDocParameterTag of JSDocParameterTag - | [] JSDocPropertyTag of JSDocPropertyTag + | [] BindingElement of BindingElement + | [] EnumMember of EnumMember + | [] JSDocParameterTag of JSDocParameterTag + | [] JSDocPropertyTag of JSDocPropertyTag + | [] JsxAttribute of JsxAttribute + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] PropertyDeclaration of PropertyDeclaration + | [] PropertySignature of PropertySignature + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] VariableDeclaration of VariableDeclaration + static member inline op_ErasedCast(x: BindingElement) = BindingElement x + static member inline op_ErasedCast(x: EnumMember) = EnumMember x + static member inline op_ErasedCast(x: JSDocParameterTag) = JSDocParameterTag x + static member inline op_ErasedCast(x: JSDocPropertyTag) = JSDocPropertyTag x + static member inline op_ErasedCast(x: JsxAttribute) = JsxAttribute x + static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x + static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x + static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] PropertyLikeDeclaration = inherit NamedDeclaration @@ -2516,12 +2663,16 @@ module Ts = abstract elements: ArrayBindingElement[] type [] [] BindingPattern = - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ObjectBindingPattern of ObjectBindingPattern + static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x type [] [] ArrayBindingElement = - | [] BindingElement of BindingElement - | [] OmittedExpression of OmittedExpression + | [] BindingElement of BindingElement + | [] OmittedExpression of OmittedExpression + static member inline op_ErasedCast(x: BindingElement) = BindingElement x + static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x /// Several node kinds share function-like features such as a signature, /// a name, and a body. These nodes should extend FunctionLikeDeclarationBase. @@ -2538,13 +2689,20 @@ module Ts = abstract body: U2 option type [] [] FunctionLikeDeclaration = - | [] MethodDeclaration of MethodDeclaration - | [] ConstructorDeclaration of ConstructorDeclaration - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] FunctionExpression of FunctionExpression - | [] ArrowFunction of ArrowFunction - | [] FunctionDeclaration of FunctionDeclaration + | [] ArrowFunction of ArrowFunction + | [] ConstructorDeclaration of ConstructorDeclaration + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] MethodDeclaration of MethodDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x [] type FunctionLike = @@ -2611,8 +2769,10 @@ module Ts = abstract body: FunctionBody option type [] [] AccessorDeclaration = - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x type [] IndexSignatureDeclaration = inherit SignatureDeclarationBase @@ -2641,11 +2801,19 @@ module Ts = inherit TypeNode abstract kind: 'TKind + type [] ImportTypeAssertionContainer = + inherit Node + abstract kind: SyntaxKind + abstract parent: ImportTypeNode + abstract assertClause: AssertClause + abstract multiLine: bool option + type [] ImportTypeNode = inherit NodeWithTypeArguments abstract kind: SyntaxKind abstract isTypeOf: bool abstract argument: TypeNode + abstract assertions: ImportTypeAssertionContainer option abstract qualifier: EntityName option type [] ThisTypeNode = @@ -2653,8 +2821,10 @@ module Ts = abstract kind: SyntaxKind type [] [] FunctionOrConstructorTypeNode = - | [] FunctionTypeNode of FunctionTypeNode - | [] ConstructorTypeNode of ConstructorTypeNode + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionTypeNode of FunctionTypeNode + static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x type [] FunctionOrConstructorTypeNodeBase = inherit TypeNode @@ -2675,8 +2845,10 @@ module Ts = abstract typeArguments: TypeNode[] option type [] [] TypeReferenceType = - | [] TypeReferenceNode of TypeReferenceNode - | [] ExpressionWithTypeArguments of ExpressionWithTypeArguments + | [] ExpressionWithTypeArguments of ExpressionWithTypeArguments + | [] TypeReferenceNode of TypeReferenceNode + static member inline op_ErasedCast(x: ExpressionWithTypeArguments) = ExpressionWithTypeArguments x + static member inline op_ErasedCast(x: TypeReferenceNode) = TypeReferenceNode x type [] TypeReferenceNode = inherit NodeWithTypeArguments @@ -2692,7 +2864,7 @@ module Ts = abstract ``type``: TypeNode option type [] TypeQueryNode = - inherit TypeNode + inherit NodeWithTypeArguments abstract kind: SyntaxKind abstract exprName: EntityName @@ -2733,8 +2905,10 @@ module Ts = abstract ``type``: TypeNode type [] [] UnionOrIntersectionTypeNode = - | [] UnionTypeNode of UnionTypeNode - | [] IntersectionTypeNode of IntersectionTypeNode + | [] IntersectionTypeNode of IntersectionTypeNode + | [] UnionTypeNode of UnionTypeNode + static member inline op_ErasedCast(x: IntersectionTypeNode) = IntersectionTypeNode x + static member inline op_ErasedCast(x: UnionTypeNode) = UnionTypeNode x type [] UnionTypeNode = inherit TypeNode @@ -2799,14 +2973,20 @@ module Ts = abstract kind: SyntaxKind type [] [] StringLiteralLike = - | [] StringLiteral of StringLiteral - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] StringLiteral of StringLiteral + static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] [] PropertyNameLiteral = - | [] NumericLiteral of NumericLiteral - | [] StringLiteral of StringLiteral - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] Identifier of Identifier + | [] Identifier of Identifier + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] NumericLiteral of NumericLiteral + | [] StringLiteral of StringLiteral + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] TemplateLiteralTypeNode = inherit TypeNode @@ -2889,8 +3069,10 @@ module Ts = abstract kind: SyntaxKind type [] [] BooleanLiteral = - | [] FalseLiteral of FalseLiteral - | [] TrueLiteral of TrueLiteral + | [] FalseLiteral of FalseLiteral + | [] TrueLiteral of TrueLiteral + static member inline op_ErasedCast(x: FalseLiteral) = FalseLiteral x + static member inline op_ErasedCast(x: TrueLiteral) = TrueLiteral x type [] ThisExpression = inherit PrimaryExpression @@ -3028,70 +3210,118 @@ module Ts = U2 type [] [] BindingOrAssignmentElement = - | [] Identifier of Identifier - | [] ParameterDeclaration of ParameterDeclaration - | [] BindingElement of BindingElement - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectLiteralExpression of ObjectLiteralExpression - | [] PropertyAccessExpression of PropertyAccessExpression - | [] ElementAccessExpression of ElementAccessExpression - | [] AssignmentExpression of AssignmentExpression - | [] SpreadElement of SpreadElement - | [] OmittedExpression of OmittedExpression - | [] VariableDeclaration of VariableDeclaration - | [] PropertyAssignment of PropertyAssignment - | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment - | [] SpreadAssignment of SpreadAssignment + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] AssignmentExpression of AssignmentExpression + | [] BindingElement of BindingElement + | [] ElementAccessExpression of ElementAccessExpression + | [] Identifier of Identifier + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] OmittedExpression of OmittedExpression + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyAccessExpression of PropertyAccessExpression + | [] PropertyAssignment of PropertyAssignment + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] SpreadAssignment of SpreadAssignment + | [] SpreadElement of SpreadElement + | [] VariableDeclaration of VariableDeclaration + static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + static member inline op_ErasedCast(x: AssignmentExpression) = AssignmentExpression x + static member inline op_ErasedCast(x: BindingElement) = BindingElement x + static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x + static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x + static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x + static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x + static member inline op_ErasedCast(x: SpreadElement) = SpreadElement x + static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] [] ObjectBindingOrAssignmentElement = - | [] BindingElement of BindingElement - | [] PropertyAssignment of PropertyAssignment - | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment - | [] SpreadAssignment of SpreadAssignment + | [] BindingElement of BindingElement + | [] PropertyAssignment of PropertyAssignment + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] SpreadAssignment of SpreadAssignment + static member inline op_ErasedCast(x: BindingElement) = BindingElement x + static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x + static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x type [] [] ArrayBindingOrAssignmentElement = - | [] Identifier of Identifier - | [] BindingElement of BindingElement - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectLiteralExpression of ObjectLiteralExpression - | [] PropertyAccessExpression of PropertyAccessExpression - | [] ElementAccessExpression of ElementAccessExpression - | [] AssignmentExpression of AssignmentExpression - | [] SpreadElement of SpreadElement - | [] OmittedExpression of OmittedExpression + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] AssignmentExpression of AssignmentExpression + | [] BindingElement of BindingElement + | [] ElementAccessExpression of ElementAccessExpression + | [] Identifier of Identifier + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] OmittedExpression of OmittedExpression + | [] PropertyAccessExpression of PropertyAccessExpression + | [] SpreadElement of SpreadElement + static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + static member inline op_ErasedCast(x: AssignmentExpression) = AssignmentExpression x + static member inline op_ErasedCast(x: BindingElement) = BindingElement x + static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x + static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x + static member inline op_ErasedCast(x: SpreadElement) = SpreadElement x type [] [] BindingOrAssignmentElementRestIndicator = - | [] DotDotDotToken of DotDotDotToken - | [] SpreadElement of SpreadElement - | [] SpreadAssignment of SpreadAssignment + | [] DotDotDotToken of DotDotDotToken + | [] SpreadAssignment of SpreadAssignment + | [] SpreadElement of SpreadElement + static member inline op_ErasedCast(x: DotDotDotToken) = DotDotDotToken x + static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x + static member inline op_ErasedCast(x: SpreadElement) = SpreadElement x type [] [] BindingOrAssignmentElementTarget = - | [] Identifier of Identifier - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectLiteralExpression of ObjectLiteralExpression - | [] PropertyAccessExpression of PropertyAccessExpression - | [] ElementAccessExpression of ElementAccessExpression - | [] OmittedExpression of OmittedExpression + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ElementAccessExpression of ElementAccessExpression + | [] Identifier of Identifier + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] OmittedExpression of OmittedExpression + | [] PropertyAccessExpression of PropertyAccessExpression + static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x + static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x type [] [] ObjectBindingOrAssignmentPattern = - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ObjectLiteralExpression of ObjectLiteralExpression + static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x type [] [] ArrayBindingOrAssignmentPattern = - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x type [] [] AssignmentPattern = - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectLiteralExpression of ObjectLiteralExpression + static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x type [] [] BindingOrAssignmentPattern = - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ObjectLiteralExpression of ObjectLiteralExpression + static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x type [] ConditionalExpression = inherit Expression @@ -3168,12 +3398,18 @@ module Ts = abstract kind: SyntaxKind type [] [] LiteralToken = - | [] NumericLiteral of NumericLiteral - | [] BigIntLiteral of BigIntLiteral - | [] StringLiteral of StringLiteral - | [] JsxText of JsxText - | [] RegularExpressionLiteral of RegularExpressionLiteral - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] BigIntLiteral of BigIntLiteral + | [] JsxText of JsxText + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] NumericLiteral of NumericLiteral + | [] RegularExpressionLiteral of RegularExpressionLiteral + | [] StringLiteral of StringLiteral + static member inline op_ErasedCast(x: BigIntLiteral) = BigIntLiteral x + static member inline op_ErasedCast(x: JsxText) = JsxText x + static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + static member inline op_ErasedCast(x: RegularExpressionLiteral) = RegularExpressionLiteral x + static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] TemplateHead = inherit TemplateLiteralLikeNode @@ -3191,15 +3427,22 @@ module Ts = abstract parent: U2 type [] [] PseudoLiteralToken = - | [] TemplateHead of TemplateHead - | [] TemplateMiddle of TemplateMiddle - | [] TemplateTail of TemplateTail + | [] TemplateHead of TemplateHead + | [] TemplateMiddle of TemplateMiddle + | [] TemplateTail of TemplateTail + static member inline op_ErasedCast(x: TemplateHead) = TemplateHead x + static member inline op_ErasedCast(x: TemplateMiddle) = TemplateMiddle x + static member inline op_ErasedCast(x: TemplateTail) = TemplateTail x type [] [] TemplateLiteralToken = - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] TemplateHead of TemplateHead - | [] TemplateMiddle of TemplateMiddle - | [] TemplateTail of TemplateTail + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] TemplateHead of TemplateHead + | [] TemplateMiddle of TemplateMiddle + | [] TemplateTail of TemplateTail + static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + static member inline op_ErasedCast(x: TemplateHead) = TemplateHead x + static member inline op_ErasedCast(x: TemplateMiddle) = TemplateMiddle x + static member inline op_ErasedCast(x: TemplateTail) = TemplateTail x type [] TemplateExpression = inherit PrimaryExpression @@ -3208,8 +3451,10 @@ module Ts = abstract templateSpans: TemplateSpan[] type [] [] TemplateLiteral = - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] TemplateExpression of TemplateExpression + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] TemplateExpression of TemplateExpression + static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + static member inline op_ErasedCast(x: TemplateExpression) = TemplateExpression x type [] TemplateSpan = inherit Node @@ -3249,17 +3494,24 @@ module Ts = abstract kind: SyntaxKind type [] [] EntityNameExpression = - | [] Identifier of Identifier - | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression + | [] Identifier of Identifier + | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: PropertyAccessEntityNameExpression) = PropertyAccessEntityNameExpression x type [] [] EntityNameOrEntityNameExpression = - | [] Identifier of Identifier - | [] QualifiedName of QualifiedName - | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression + | [] Identifier of Identifier + | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression + | [] QualifiedName of QualifiedName + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: PropertyAccessEntityNameExpression) = PropertyAccessEntityNameExpression x + static member inline op_ErasedCast(x: QualifiedName) = QualifiedName x type [] [] AccessExpression = - | [] PropertyAccessExpression of PropertyAccessExpression - | [] ElementAccessExpression of ElementAccessExpression + | [] ElementAccessExpression of ElementAccessExpression + | [] PropertyAccessExpression of PropertyAccessExpression + static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x type [] PropertyAccessExpression = inherit MemberExpression @@ -3301,8 +3553,10 @@ module Ts = abstract expression: SuperExpression type [] [] SuperProperty = - | [] SuperPropertyAccessExpression of SuperPropertyAccessExpression - | [] SuperElementAccessExpression of SuperElementAccessExpression + | [] SuperElementAccessExpression of SuperElementAccessExpression + | [] SuperPropertyAccessExpression of SuperPropertyAccessExpression + static member inline op_ErasedCast(x: SuperElementAccessExpression) = SuperElementAccessExpression x + static member inline op_ErasedCast(x: SuperPropertyAccessExpression) = SuperPropertyAccessExpression x type [] CallExpression = inherit LeftHandSideExpression @@ -3318,10 +3572,14 @@ module Ts = abstract _optionalChainBrand: obj option with get, set type [] [] OptionalChain = - | [] PropertyAccessChain of PropertyAccessChain - | [] ElementAccessChain of ElementAccessChain - | [] CallChain of CallChain - | [] NonNullChain of NonNullChain + | [] CallChain of CallChain + | [] ElementAccessChain of ElementAccessChain + | [] NonNullChain of NonNullChain + | [] PropertyAccessChain of PropertyAccessChain + static member inline op_ErasedCast(x: CallChain) = CallChain x + static member inline op_ErasedCast(x: ElementAccessChain) = ElementAccessChain x + static member inline op_ErasedCast(x: NonNullChain) = NonNullChain x + static member inline op_ErasedCast(x: PropertyAccessChain) = PropertyAccessChain x type [] SuperCall = inherit CallExpression @@ -3332,9 +3590,9 @@ module Ts = abstract expression: ImportExpression type [] ExpressionWithTypeArguments = + inherit MemberExpression inherit NodeWithTypeArguments abstract kind: SyntaxKind - abstract parent: U3 abstract expression: LeftHandSideExpression type [] NewExpression = @@ -3353,12 +3611,18 @@ module Ts = abstract template: TemplateLiteral type [] [] CallLikeExpression = - | [] Decorator of Decorator - | [] CallExpression of CallExpression - | [] NewExpression of NewExpression - | [] TaggedTemplateExpression of TaggedTemplateExpression - | [] JsxSelfClosingElement of JsxSelfClosingElement - | [] JsxOpeningElement of JsxOpeningElement + | [] CallExpression of CallExpression + | [] Decorator of Decorator + | [] JsxOpeningElement of JsxOpeningElement + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] NewExpression of NewExpression + | [] TaggedTemplateExpression of TaggedTemplateExpression + static member inline op_ErasedCast(x: CallExpression) = CallExpression x + static member inline op_ErasedCast(x: Decorator) = Decorator x + static member inline op_ErasedCast(x: JsxOpeningElement) = JsxOpeningElement x + static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x + static member inline op_ErasedCast(x: NewExpression) = NewExpression x + static member inline op_ErasedCast(x: TaggedTemplateExpression) = TaggedTemplateExpression x type [] AsExpression = inherit Expression @@ -3373,8 +3637,10 @@ module Ts = abstract expression: UnaryExpression type [] [] AssertionExpression = - | [] TypeAssertion of TypeAssertion - | [] AsExpression of AsExpression + | [] AsExpression of AsExpression + | [] TypeAssertion of TypeAssertion + static member inline op_ErasedCast(x: AsExpression) = AsExpression x + static member inline op_ErasedCast(x: TypeAssertion) = TypeAssertion x type [] NonNullExpression = inherit LeftHandSideExpression @@ -3399,17 +3665,24 @@ module Ts = abstract closingElement: JsxClosingElement type [] [] JsxOpeningLikeElement = - | [] JsxSelfClosingElement of JsxSelfClosingElement - | [] JsxOpeningElement of JsxOpeningElement + | [] JsxOpeningElement of JsxOpeningElement + | [] JsxSelfClosingElement of JsxSelfClosingElement + static member inline op_ErasedCast(x: JsxOpeningElement) = JsxOpeningElement x + static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x type [] [] JsxAttributeLike = - | [] JsxAttribute of JsxAttribute - | [] JsxSpreadAttribute of JsxSpreadAttribute + | [] JsxAttribute of JsxAttribute + | [] JsxSpreadAttribute of JsxSpreadAttribute + static member inline op_ErasedCast(x: JsxAttribute) = JsxAttribute x + static member inline op_ErasedCast(x: JsxSpreadAttribute) = JsxSpreadAttribute x type [] [] JsxTagNameExpression = - | [] Identifier of Identifier - | [] ThisExpression of ThisExpression - | [] JsxTagNamePropertyAccess of JsxTagNamePropertyAccess + | [] Identifier of Identifier + | [] JsxTagNamePropertyAccess of JsxTagNamePropertyAccess + | [] ThisExpression of ThisExpression + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: JsxTagNamePropertyAccess) = JsxTagNamePropertyAccess x + static member inline op_ErasedCast(x: ThisExpression) = ThisExpression x type [] JsxTagNamePropertyAccess = inherit PropertyAccessExpression @@ -3485,11 +3758,16 @@ module Ts = abstract containsOnlyTriviaWhiteSpaces: bool type [] [] JsxChild = - | [] JsxText of JsxText - | [] JsxElement of JsxElement - | [] JsxSelfClosingElement of JsxSelfClosingElement - | [] JsxFragment of JsxFragment - | [] JsxExpression of JsxExpression + | [] JsxElement of JsxElement + | [] JsxExpression of JsxExpression + | [] JsxFragment of JsxFragment + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] JsxText of JsxText + static member inline op_ErasedCast(x: JsxElement) = JsxElement x + static member inline op_ErasedCast(x: JsxExpression) = JsxExpression x + static member inline op_ErasedCast(x: JsxFragment) = JsxFragment x + static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x + static member inline op_ErasedCast(x: JsxText) = JsxText x type [] Statement = inherit Node @@ -3520,11 +3798,16 @@ module Ts = abstract name: Identifier option type [] [] BlockLike = - | [] Block of Block - | [] ModuleBlock of ModuleBlock - | [] CaseClause of CaseClause - | [] DefaultClause of DefaultClause - | [] SourceFile of SourceFile + | [] Block of Block + | [] CaseClause of CaseClause + | [] DefaultClause of DefaultClause + | [] ModuleBlock of ModuleBlock + | [] SourceFile of SourceFile + static member inline op_ErasedCast(x: Block) = Block x + static member inline op_ErasedCast(x: CaseClause) = CaseClause x + static member inline op_ErasedCast(x: DefaultClause) = DefaultClause x + static member inline op_ErasedCast(x: ModuleBlock) = ModuleBlock x + static member inline op_ErasedCast(x: SourceFile) = SourceFile x type [] Block = inherit Statement @@ -3573,8 +3856,10 @@ module Ts = abstract incrementor: Expression option type [] [] ForInOrOfStatement = - | [] ForInStatement of ForInStatement - | [] ForOfStatement of ForOfStatement + | [] ForInStatement of ForInStatement + | [] ForOfStatement of ForOfStatement + static member inline op_ErasedCast(x: ForInStatement) = ForInStatement x + static member inline op_ErasedCast(x: ForOfStatement) = ForOfStatement x type [] ForInStatement = inherit IterationStatement @@ -3600,8 +3885,10 @@ module Ts = abstract label: Identifier option type [] [] BreakOrContinueStatement = - | [] ContinueStatement of ContinueStatement - | [] BreakStatement of BreakStatement + | [] BreakStatement of BreakStatement + | [] ContinueStatement of ContinueStatement + static member inline op_ErasedCast(x: BreakStatement) = BreakStatement x + static member inline op_ErasedCast(x: ContinueStatement) = ContinueStatement x type [] ReturnStatement = inherit Statement @@ -3629,6 +3916,7 @@ module Ts = type [] CaseClause = inherit Node + inherit JSDocContainer abstract kind: SyntaxKind abstract parent: CaseBlock abstract expression: Expression @@ -3641,8 +3929,10 @@ module Ts = abstract statements: Statement[] type [] [] CaseOrDefaultClause = - | [] CaseClause of CaseClause - | [] DefaultClause of DefaultClause + | [] CaseClause of CaseClause + | [] DefaultClause of DefaultClause + static member inline op_ErasedCast(x: CaseClause) = CaseClause x + static member inline op_ErasedCast(x: DefaultClause) = DefaultClause x type [] LabeledStatement = inherit Statement @@ -3670,55 +3960,100 @@ module Ts = abstract block: Block type [] [] ObjectTypeDeclaration = - | [] TypeLiteralNode of TypeLiteralNode - | [] ClassExpression of ClassExpression - | [] ClassDeclaration of ClassDeclaration - | [] InterfaceDeclaration of InterfaceDeclaration + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] InterfaceDeclaration of InterfaceDeclaration + | [] TypeLiteralNode of TypeLiteralNode + static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x + static member inline op_ErasedCast(x: TypeLiteralNode) = TypeLiteralNode x type [] [] DeclarationWithTypeParameters = - | [] MethodSignature of MethodSignature - | [] MethodDeclaration of MethodDeclaration - | [] ConstructorDeclaration of ConstructorDeclaration - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] CallSignatureDeclaration of CallSignatureDeclaration - | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration - | [] IndexSignatureDeclaration of IndexSignatureDeclaration - | [] FunctionTypeNode of FunctionTypeNode - | [] ConstructorTypeNode of ConstructorTypeNode - | [] FunctionExpression of FunctionExpression - | [] ArrowFunction of ArrowFunction - | [] ClassExpression of ClassExpression - | [] FunctionDeclaration of FunctionDeclaration - | [] ClassDeclaration of ClassDeclaration - | [] InterfaceDeclaration of InterfaceDeclaration - | [] TypeAliasDeclaration of TypeAliasDeclaration - | [] JSDocFunctionType of JSDocFunctionType - | [] JSDocSignature of JSDocSignature - | [] JSDocCallbackTag of JSDocCallbackTag - | [] JSDocTemplateTag of JSDocTemplateTag - | [] JSDocTypedefTag of JSDocTypedefTag + | [] ArrowFunction of ArrowFunction + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] FunctionTypeNode of FunctionTypeNode + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] InterfaceDeclaration of InterfaceDeclaration + | [] JSDocCallbackTag of JSDocCallbackTag + | [] JSDocFunctionType of JSDocFunctionType + | [] JSDocSignature of JSDocSignature + | [] JSDocTemplateTag of JSDocTemplateTag + | [] JSDocTypedefTag of JSDocTypedefTag + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x + static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x + static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x + static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x + static member inline op_ErasedCast(x: JSDocCallbackTag) = JSDocCallbackTag x + static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x + static member inline op_ErasedCast(x: JSDocSignature) = JSDocSignature x + static member inline op_ErasedCast(x: JSDocTemplateTag) = JSDocTemplateTag x + static member inline op_ErasedCast(x: JSDocTypedefTag) = JSDocTypedefTag x + static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x type [] [] DeclarationWithTypeParameterChildren = - | [] MethodSignature of MethodSignature - | [] MethodDeclaration of MethodDeclaration - | [] ConstructorDeclaration of ConstructorDeclaration - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] CallSignatureDeclaration of CallSignatureDeclaration - | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration - | [] IndexSignatureDeclaration of IndexSignatureDeclaration - | [] FunctionTypeNode of FunctionTypeNode - | [] ConstructorTypeNode of ConstructorTypeNode - | [] FunctionExpression of FunctionExpression - | [] ArrowFunction of ArrowFunction - | [] ClassExpression of ClassExpression - | [] FunctionDeclaration of FunctionDeclaration - | [] ClassDeclaration of ClassDeclaration - | [] InterfaceDeclaration of InterfaceDeclaration - | [] TypeAliasDeclaration of TypeAliasDeclaration - | [] JSDocFunctionType of JSDocFunctionType - | [] JSDocTemplateTag of JSDocTemplateTag + | [] ArrowFunction of ArrowFunction + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] FunctionTypeNode of FunctionTypeNode + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] InterfaceDeclaration of InterfaceDeclaration + | [] JSDocFunctionType of JSDocFunctionType + | [] JSDocTemplateTag of JSDocTemplateTag + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x + static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x + static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x + static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x + static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x + static member inline op_ErasedCast(x: JSDocTemplateTag) = JSDocTemplateTag x + static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x type [] ClassLikeDeclarationBase = inherit NamedDeclaration @@ -3742,8 +4077,10 @@ module Ts = abstract kind: SyntaxKind type [] [] ClassLikeDeclaration = - | [] ClassExpression of ClassExpression - | [] ClassDeclaration of ClassDeclaration + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x type [] ClassElement = inherit NamedDeclaration @@ -3796,13 +4133,18 @@ module Ts = abstract members: EnumMember[] type [] [] ModuleName = - | [] StringLiteral of StringLiteral - | [] Identifier of Identifier + | [] Identifier of Identifier + | [] StringLiteral of StringLiteral + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] [] ModuleBody = - | [] Identifier of Identifier - | [] Empty of U2 - | [] ModuleBlock of ModuleBlock + | [] Identifier of Identifier + | [] ModuleBlock of ModuleBlock + | [] ModuleDeclaration of U2 + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: ModuleBlock) = ModuleBlock x + static member inline op_ErasedCast(x: U2) = ModuleDeclaration x type [] ModuleDeclaration = inherit DeclarationStatement @@ -3813,8 +4155,10 @@ module Ts = abstract body: U2 option type [] [] NamespaceBody = - | [] NamespaceDeclaration of NamespaceDeclaration - | [] ModuleBlock of ModuleBlock + | [] ModuleBlock of ModuleBlock + | [] NamespaceDeclaration of NamespaceDeclaration + static member inline op_ErasedCast(x: ModuleBlock) = ModuleBlock x + static member inline op_ErasedCast(x: NamespaceDeclaration) = NamespaceDeclaration x type [] NamespaceDeclaration = inherit ModuleDeclaration @@ -3822,8 +4166,10 @@ module Ts = abstract body: NamespaceBody type [] [] JSDocNamespaceBody = - | [] Identifier of Identifier - | [] JSDocNamespaceDeclaration of JSDocNamespaceDeclaration + | [] Identifier of Identifier + | [] JSDocNamespaceDeclaration of JSDocNamespaceDeclaration + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: JSDocNamespaceDeclaration) = JSDocNamespaceDeclaration x type [] JSDocNamespaceDeclaration = inherit ModuleDeclaration @@ -3838,9 +4184,12 @@ module Ts = abstract statements: Statement[] type [] [] ModuleReference = - | [] Identifier of Identifier - | [] QualifiedName of QualifiedName - | [] ExternalModuleReference of ExternalModuleReference + | [] ExternalModuleReference of ExternalModuleReference + | [] Identifier of Identifier + | [] QualifiedName of QualifiedName + static member inline op_ErasedCast(x: ExternalModuleReference) = ExternalModuleReference x + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: QualifiedName) = QualifiedName x /// One of: /// - import x = require("mod"); @@ -3870,12 +4219,16 @@ module Ts = abstract assertClause: AssertClause option type [] [] NamedImportBindings = - | [] NamespaceImport of NamespaceImport - | [] NamedImports of NamedImports + | [] NamedImports of NamedImports + | [] NamespaceImport of NamespaceImport + static member inline op_ErasedCast(x: NamedImports) = NamedImports x + static member inline op_ErasedCast(x: NamespaceImport) = NamespaceImport x type [] [] NamedExportBindings = - | [] NamedExports of NamedExports - | [] NamespaceExport of NamespaceExport + | [] NamedExports of NamedExports + | [] NamespaceExport of NamespaceExport + static member inline op_ErasedCast(x: NamedExports) = NamedExports x + static member inline op_ErasedCast(x: NamespaceExport) = NamespaceExport x type [] ImportClause = inherit NamedDeclaration @@ -3886,8 +4239,10 @@ module Ts = abstract namedBindings: NamedImportBindings option type [] [] AssertionKey = - | [] StringLiteral of StringLiteral - | [] Identifier of Identifier + | [] Identifier of Identifier + | [] StringLiteral of StringLiteral + static member inline op_ErasedCast(x: Identifier) = Identifier x + static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] AssertEntry = inherit Node @@ -3946,8 +4301,10 @@ module Ts = abstract elements: ExportSpecifier[] type [] [] NamedImportsOrExports = - | [] NamedImports of NamedImports - | [] NamedExports of NamedExports + | [] NamedExports of NamedExports + | [] NamedImports of NamedImports + static member inline op_ErasedCast(x: NamedExports) = NamedExports x + static member inline op_ErasedCast(x: NamedImports) = NamedImports x type [] ImportSpecifier = inherit NamedDeclaration @@ -3967,15 +4324,22 @@ module Ts = abstract name: Identifier type [] [] ImportOrExportSpecifier = - | [] ImportSpecifier of ImportSpecifier - | [] ExportSpecifier of ExportSpecifier + | [] ExportSpecifier of ExportSpecifier + | [] ImportSpecifier of ImportSpecifier + static member inline op_ErasedCast(x: ExportSpecifier) = ExportSpecifier x + static member inline op_ErasedCast(x: ImportSpecifier) = ImportSpecifier x type [] [] TypeOnlyCompatibleAliasDeclaration = - | [] ImportEqualsDeclaration of ImportEqualsDeclaration - | [] ImportClause of ImportClause - | [] NamespaceImport of NamespaceImport - | [] ImportSpecifier of ImportSpecifier - | [] ExportSpecifier of ExportSpecifier + | [] ExportSpecifier of ExportSpecifier + | [] ImportClause of ImportClause + | [] ImportEqualsDeclaration of ImportEqualsDeclaration + | [] ImportSpecifier of ImportSpecifier + | [] NamespaceImport of NamespaceImport + static member inline op_ErasedCast(x: ExportSpecifier) = ExportSpecifier x + static member inline op_ErasedCast(x: ImportClause) = ImportClause x + static member inline op_ErasedCast(x: ImportEqualsDeclaration) = ImportEqualsDeclaration x + static member inline op_ErasedCast(x: ImportSpecifier) = ImportSpecifier x + static member inline op_ErasedCast(x: NamespaceImport) = NamespaceImport x type TypeOnlyAliasDeclaration = obj @@ -3995,6 +4359,7 @@ module Ts = type [] FileReference = inherit TextRange abstract fileName: string with get, set + abstract resolutionMode: obj option with get, set type [] CheckJsDirective = inherit TextRange @@ -4048,11 +4413,13 @@ module Ts = inherit JSDocType abstract kind: SyntaxKind abstract ``type``: TypeNode + abstract postfix: bool type [] JSDocNullableType = inherit JSDocType abstract kind: SyntaxKind abstract ``type``: TypeNode + abstract postfix: bool type [] JSDocOptionalType = inherit JSDocType @@ -4075,10 +4442,14 @@ module Ts = abstract ``type``: TypeNode type [] [] JSDocTypeReferencingNode = - | [] JSDocNullableType of JSDocNullableType - | [] JSDocNonNullableType of JSDocNonNullableType - | [] JSDocOptionalType of JSDocOptionalType - | [] JSDocVariadicType of JSDocVariadicType + | [] JSDocNonNullableType of JSDocNonNullableType + | [] JSDocNullableType of JSDocNullableType + | [] JSDocOptionalType of JSDocOptionalType + | [] JSDocVariadicType of JSDocVariadicType + static member inline op_ErasedCast(x: JSDocNonNullableType) = JSDocNonNullableType x + static member inline op_ErasedCast(x: JSDocNullableType) = JSDocNullableType x + static member inline op_ErasedCast(x: JSDocOptionalType) = JSDocOptionalType x + static member inline op_ErasedCast(x: JSDocVariadicType) = JSDocVariadicType x type [] JSDoc = inherit Node @@ -4112,10 +4483,14 @@ module Ts = abstract text: string with get, set type [] [] JSDocComment = - | [] JSDocText of JSDocText - | [] JSDocLink of JSDocLink - | [] JSDocLinkCode of JSDocLinkCode - | [] JSDocLinkPlain of JSDocLinkPlain + | [] JSDocLink of JSDocLink + | [] JSDocLinkCode of JSDocLinkCode + | [] JSDocLinkPlain of JSDocLinkPlain + | [] JSDocText of JSDocText + static member inline op_ErasedCast(x: JSDocLink) = JSDocLink x + static member inline op_ErasedCast(x: JSDocLinkCode) = JSDocLinkCode x + static member inline op_ErasedCast(x: JSDocLinkPlain) = JSDocLinkPlain x + static member inline op_ErasedCast(x: JSDocText) = JSDocText x type [] JSDocText = inherit Node @@ -4274,7 +4649,7 @@ module Ts = | Condition = 96 type FlowNode = - U8 + U8 type [] FlowNodeBase = abstract flags: FlowFlags with get, set @@ -4332,6 +4707,11 @@ module Ts = abstract path: string with get, set abstract name: string option with get, set + /// Subset of properties from SourceFile that are used in multiple utility functions + type [] SourceFileLike = + abstract text: string + abstract getLineAndCharacterOfPosition: pos: float -> LineAndCharacter + type [] SourceFile = inherit Declaration abstract kind: SyntaxKind @@ -4355,7 +4735,7 @@ module Ts = abstract hasNoDefaultLib: bool with get, set abstract languageVersion: ScriptTarget with get, set /// - /// When module is Node12 or NodeNext, this field controls whether the + /// When module is Node16 or NodeNext, this field controls whether the /// source file in question is an ESNext-output-format file, or a CommonJS-output-format /// module. This is derived by the module resolver as it looks up the file, since /// it is derived from either the file extension of the module, or the containing @@ -4398,7 +4778,7 @@ module Ts = abstract prologues: UnparsedPrologue[] abstract helpers: UnscopedEmitHelper[] option with get, set abstract referencedFiles: FileReference[] with get, set - abstract typeReferenceDirectives: string[] option with get, set + abstract typeReferenceDirectives: FileReference[] option with get, set abstract libReferenceDirectives: FileReference[] with get, set abstract hasNoDefaultLib: bool option with get, set abstract sourceMapPath: string option with get, set @@ -4407,16 +4787,22 @@ module Ts = abstract texts: UnparsedSourceText[] type [] [] UnparsedSourceText = - | [] UnparsedPrepend of UnparsedPrepend - | [] UnparsedTextLike of UnparsedTextLike - | [] UnparsedTextLike' of UnparsedTextLike + | [] UnparsedTextLike of UnparsedTextLike + | [] UnparsedPrepend of UnparsedPrepend + | [] UnparsedTextLike' of UnparsedTextLike + static member inline op_ErasedCast(x: UnparsedTextLike) = UnparsedTextLike x + static member inline op_ErasedCast(x: UnparsedPrepend) = UnparsedPrepend x type [] [] UnparsedNode = - | [] UnparsedPrologue of UnparsedPrologue - | [] UnparsedPrepend of UnparsedPrepend - | [] UnparsedTextLike of UnparsedTextLike - | [] UnparsedTextLike' of UnparsedTextLike - | [] UnparsedSyntheticReference of UnparsedSyntheticReference + | [] UnparsedTextLike of UnparsedTextLike + | [] UnparsedPrepend of UnparsedPrepend + | [] UnparsedPrologue of UnparsedPrologue + | [] UnparsedSyntheticReference of UnparsedSyntheticReference + | [] UnparsedTextLike' of UnparsedTextLike + static member inline op_ErasedCast(x: UnparsedTextLike) = UnparsedTextLike x + static member inline op_ErasedCast(x: UnparsedPrepend) = UnparsedPrepend x + static member inline op_ErasedCast(x: UnparsedPrologue) = UnparsedPrologue x + static member inline op_ErasedCast(x: UnparsedSyntheticReference) = UnparsedSyntheticReference x type [] UnparsedSection = inherit Node @@ -4462,14 +4848,22 @@ module Ts = abstract operand: NumericLiteral type [] [] JsonObjectExpression = - | [] NumericLiteral of NumericLiteral - | [] StringLiteral of StringLiteral - | [] FalseLiteral of FalseLiteral - | [] NullLiteral of NullLiteral - | [] TrueLiteral of TrueLiteral - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectLiteralExpression of ObjectLiteralExpression - | [] JsonMinusNumericLiteral of JsonMinusNumericLiteral + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] FalseLiteral of FalseLiteral + | [] NullLiteral of NullLiteral + | [] NumericLiteral of NumericLiteral + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] JsonMinusNumericLiteral of JsonMinusNumericLiteral + | [] StringLiteral of StringLiteral + | [] TrueLiteral of TrueLiteral + static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + static member inline op_ErasedCast(x: FalseLiteral) = FalseLiteral x + static member inline op_ErasedCast(x: NullLiteral) = NullLiteral x + static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + static member inline op_ErasedCast(x: JsonMinusNumericLiteral) = JsonMinusNumericLiteral x + static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + static member inline op_ErasedCast(x: TrueLiteral) = TrueLiteral x type [] JsonObjectExpressionStatement = inherit ExpressionStatement @@ -4496,8 +4890,11 @@ module Ts = type [] ResolvedConfigFileName = interface end + type [] WriteFileCallbackData = + interface end + type [] WriteFileCallback = - [] abstract Invoke: fileName: string * data: string * writeByteOrderMark: bool * ?onError: (string -> unit) * ?sourceFiles: SourceFile[] -> unit + [] abstract Invoke: fileName: string * text: string * writeByteOrderMark: bool * ?onError: (string -> unit) * ?sourceFiles: SourceFile[] * ?data: WriteFileCallbackData -> unit type [] OperationCanceledException = interface end @@ -4552,7 +4949,7 @@ module Ts = abstract references: ResolvedProjectReference option[] option with get, set type [] CustomTransformerFactory = - [] abstract Invoke: context: TransformationContext -> CustomTransformer + [] abstract Invoke: context: TransformationContext -> CustomTransformer type [] CustomTransformer = abstract transformSourceFile: node: SourceFile -> SourceFile @@ -4708,7 +5105,6 @@ module Ts = | UseAliasDefinedOutsideCurrentScope = 16384 | UseSingleQuotesForStringLiteralType = 268435456 | NoTypeReduction = 536870912 - | NoUndefinedOptionalParameterType = 1073741824 | AllowThisInObjectLiteral = 32768 | AllowQualifiedNameInPlaceOfIdentifier = 65536 /// AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. @@ -4796,10 +5192,14 @@ module Ts = abstract ``type``: Type option with get, set type [] [] TypePredicate = - | [] ThisTypePredicate of ThisTypePredicate - | [] IdentifierTypePredicate of IdentifierTypePredicate - | [] AssertsThisTypePredicate of AssertsThisTypePredicate - | [] AssertsIdentifierTypePredicate of AssertsIdentifierTypePredicate + | [] AssertsIdentifierTypePredicate of AssertsIdentifierTypePredicate + | [] AssertsThisTypePredicate of AssertsThisTypePredicate + | [] IdentifierTypePredicate of IdentifierTypePredicate + | [] ThisTypePredicate of ThisTypePredicate + static member inline op_ErasedCast(x: AssertsIdentifierTypePredicate) = AssertsIdentifierTypePredicate x + static member inline op_ErasedCast(x: AssertsThisTypePredicate) = AssertsThisTypePredicate x + static member inline op_ErasedCast(x: IdentifierTypePredicate) = IdentifierTypePredicate x + static member inline op_ErasedCast(x: ThisTypePredicate) = ThisTypePredicate x type [] SymbolFlags = | None = 0 @@ -4879,21 +5279,21 @@ module Ts = abstract getJsDocTags: ?checker: TypeChecker -> JSDocTagInfo[] type [] [] InternalSymbolName = - | [] Call - | [] Constructor - | [] New - | [] Index - | [] ExportStar - | [] Global - | [] Missing - | [] Type - | [] Object - | [] JSXAttributes - | [] Class - | [] Function - | [] Computed - | [] Resolving - | [] Call + | [] Constructor + | [] New + | [] Index + | [] ExportStar + | [] Global + | [] Missing + | [] Type + | [] Object + | [] JSXAttributes + | [] Class + | [] Function + | [] Computed + | [] Resolving + | [] ExportEquals | Default | This @@ -4970,10 +5370,14 @@ module Ts = | Narrowable = 536624127 type [] [] DestructuringPattern = - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ObjectLiteralExpression of ObjectLiteralExpression + static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x type [] Type = abstract flags: TypeFlags with get, set @@ -5044,13 +5448,13 @@ module Ts = | ObjectLiteralPatternWithComputedProperties = 512 | ReverseMapped = 1024 | JsxAttributes = 2048 - | MarkerType = 4096 - | JSLiteral = 8192 - | FreshLiteral = 16384 - | ArrayLiteral = 32768 + | JSLiteral = 4096 + | FreshLiteral = 8192 + | ArrayLiteral = 16384 | ClassOrInterface = 3 - | ContainsSpread = 4194304 - | ObjectRestType = 8388608 + | ContainsSpread = 2097152 + | ObjectRestType = 4194304 + | InstantiationExpressionType = 8388608 type [] ObjectType = inherit Type @@ -5293,9 +5697,17 @@ module Ts = type [] ModuleResolutionKind = | Classic = 1 | NodeJs = 2 - | Node12 = 3 + | Node16 = 3 | NodeNext = 99 + type [] ModuleDetectionKind = + /// Files with imports, exports and/or import.meta are considered modules + | Legacy = 1 + /// Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+ + | Auto = 2 + /// Consider all non-declaration files modules, regardless of present syntax + | Force = 3 + type [] PluginImport = abstract name: string with get, set @@ -5369,6 +5781,8 @@ module Ts = abstract maxNodeModuleJsDepth: float option with get, set abstract ``module``: ModuleKind option with get, set abstract moduleResolution: ModuleResolutionKind option with get, set + abstract moduleSuffixes: string[] option with get, set + abstract moduleDetection: ModuleDetectionKind option with get, set abstract newLine: NewLineKind option with get, set abstract noEmit: bool option with get, set abstract noEmitHelpers: bool option with get, set @@ -5458,7 +5872,7 @@ Use typeAcquisition.enable instead.")>] | ES2020 = 6 | ES2022 = 7 | ESNext = 99 - | Node12 = 100 + | Node16 = 100 | NodeNext = 199 type [] JsxEmit = @@ -5550,6 +5964,12 @@ Use typeAcquisition.enable instead.")>] abstract getDirectories: path: string -> string[] abstract useCaseSensitiveFileNames: U2 bool)> option with get, set + /// Used by services to specify the minimum host area required to set up source files under any compilation settings + type [] MinimalResolutionCacheHost = + inherit ModuleResolutionHost + abstract getCompilationSettings: unit -> CompilerOptions + abstract getCompilerHost: unit -> CompilerHost option + /// /// Represents the result of module resolution. /// Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off. @@ -5593,19 +6013,19 @@ Use typeAcquisition.enable instead.")>] abstract version: string with get, set type [] [] Extension = - | [] Ts - | [] Tsx - | [] Dts - | [] Js - | [] Jsx - | [] Json - | [] TsBuildInfo - | [] Mjs - | [] Mts - | [] Dmts - | [] Cjs - | [] Cts - | [] Dcts + | [] Ts + | [] Tsx + | [] Dts + | [] Js + | [] Jsx + | [] Json + | [] TsBuildInfo + | [] Mjs + | [] Mts + | [] Dmts + | [] Cjs + | [] Cts + | [] Dcts type [] ResolvedModuleWithFailedLookupLocations = abstract resolvedModule: ResolvedModuleFull option @@ -5623,8 +6043,8 @@ Use typeAcquisition.enable instead.")>] type [] CompilerHost = inherit ModuleResolutionHost - abstract getSourceFile: fileName: string * languageVersion: ScriptTarget * ?onError: (string -> unit) * ?shouldCreateNewSourceFile: bool -> SourceFile option - abstract getSourceFileByPath: fileName: string * path: Path * languageVersion: ScriptTarget * ?onError: (string -> unit) * ?shouldCreateNewSourceFile: bool -> SourceFile option + abstract getSourceFile: fileName: string * languageVersionOrOptions: U2 * ?onError: (string -> unit) * ?shouldCreateNewSourceFile: bool -> SourceFile option + abstract getSourceFileByPath: fileName: string * path: Path * languageVersionOrOptions: U2 * ?onError: (string -> unit) * ?shouldCreateNewSourceFile: bool -> SourceFile option abstract getCancellationToken: unit -> CancellationToken abstract getDefaultLibFileName: options: CompilerOptions -> string abstract getDefaultLibLocation: unit -> string @@ -5638,7 +6058,7 @@ Use typeAcquisition.enable instead.")>] /// Returns the module resolution cache used by a provided resolveModuleNames implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it abstract getModuleResolutionCache: unit -> ModuleResolutionCache option /// This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files - abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: string[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions -> ResolvedTypeReferenceDirective option[] + abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: U2 * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingFileMode: obj -> ResolvedTypeReferenceDirective option[] abstract getEnvironmentVariable: name: string -> string option abstract createHash: data: string -> string abstract getParsedCommandLine: fileName: string -> ParsedCommandLine option @@ -5701,11 +6121,13 @@ Use typeAcquisition.enable instead.")>] abstract text: string type [] [] EmitHelper = - | [] UnscopedEmitHelper of UnscopedEmitHelper - | [] ScopedEmitHelper of ScopedEmitHelper + | [] UnscopedEmitHelper of UnscopedEmitHelper + | [] ScopedEmitHelper of ScopedEmitHelper + static member inline op_ErasedCast(x: UnscopedEmitHelper) = UnscopedEmitHelper x + static member inline op_ErasedCast(x: ScopedEmitHelper) = ScopedEmitHelper x type [] EmitHelperUniqueNameCallback = - [] abstract Invoke: name: string -> string + [] abstract Invoke: name: string -> string type [] EmitHint = | SourceFile = 0 @@ -5736,7 +6158,7 @@ Use typeAcquisition.enable instead.")>] | Function type [] NodeFactory = - abstract createNodeArray: ?elements: 'T[] * ?hasTrailingComma: bool -> 'T[] + abstract createNodeArray: ?elements: 'T[] * ?hasTrailingComma: bool -> 'T[] when 'T :> Node abstract createNumericLiteral: value: U2 * ?numericLiteralFlags: TokenFlags -> NumericLiteral abstract createBigIntLiteral: value: U2 -> BigIntLiteral abstract createStringLiteral: text: string * ?isSingleQuote: bool -> StringLiteral @@ -5767,7 +6189,6 @@ Use typeAcquisition.enable instead.")>] /// Create a unique name generated for a node. abstract getGeneratedNameForNode: node: Node option * ?flags: GeneratedIdentifierFlags -> Identifier abstract createPrivateIdentifier: text: string -> PrivateIdentifier - abstract createToken: token: SyntaxKind -> SuperExpression abstract createToken: token: 'TKind -> Token<'TKind> abstract createSuper: unit -> SuperExpression abstract createThis: unit -> ThisExpression @@ -5780,7 +6201,11 @@ Use typeAcquisition.enable instead.")>] abstract updateQualifiedName: node: QualifiedName * left: EntityName * right: Identifier -> QualifiedName abstract createComputedPropertyName: expression: Expression -> ComputedPropertyName abstract updateComputedPropertyName: node: ComputedPropertyName * expression: Expression -> ComputedPropertyName + abstract createTypeParameterDeclaration: modifiers: Modifier[] option * name: U2 * ?``constraint``: TypeNode * ?defaultType: TypeNode -> TypeParameterDeclaration + [] abstract createTypeParameterDeclaration: name: U2 * ?``constraint``: TypeNode * ?defaultType: TypeNode -> TypeParameterDeclaration + abstract updateTypeParameterDeclaration: node: TypeParameterDeclaration * modifiers: Modifier[] option * name: Identifier * ``constraint``: TypeNode option * defaultType: TypeNode option -> TypeParameterDeclaration + [] abstract updateTypeParameterDeclaration: node: TypeParameterDeclaration * name: Identifier * ``constraint``: TypeNode option * defaultType: TypeNode option -> TypeParameterDeclaration abstract createParameterDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * ?questionToken: QuestionToken * ?``type``: TypeNode * ?initializer: Expression -> ParameterDeclaration abstract updateParameterDeclaration: node: ParameterDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option * initializer: Expression option -> ParameterDeclaration @@ -5823,8 +6248,8 @@ Use typeAcquisition.enable instead.")>] abstract updateConstructorTypeNode: node: ConstructorTypeNode * modifiers: Modifier[] option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode [] abstract updateConstructorTypeNode: node: ConstructorTypeNode * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode - abstract createTypeQueryNode: exprName: EntityName -> TypeQueryNode - abstract updateTypeQueryNode: node: TypeQueryNode * exprName: EntityName -> TypeQueryNode + abstract createTypeQueryNode: exprName: EntityName * ?typeArguments: TypeNode[] -> TypeQueryNode + abstract updateTypeQueryNode: node: TypeQueryNode * exprName: EntityName * ?typeArguments: TypeNode[] -> TypeQueryNode abstract createTypeLiteralNode: members: TypeElement[] option -> TypeLiteralNode abstract updateTypeLiteralNode: node: TypeLiteralNode * members: TypeElement[] -> TypeLiteralNode abstract createArrayTypeNode: elementType: TypeNode -> ArrayTypeNode @@ -5846,7 +6271,9 @@ Use typeAcquisition.enable instead.")>] abstract createInferTypeNode: typeParameter: TypeParameterDeclaration -> InferTypeNode abstract updateInferTypeNode: node: InferTypeNode * typeParameter: TypeParameterDeclaration -> InferTypeNode abstract createImportTypeNode: argument: TypeNode * ?qualifier: EntityName * ?typeArguments: TypeNode[] * ?isTypeOf: bool -> ImportTypeNode + abstract createImportTypeNode: argument: TypeNode * ?assertions: ImportTypeAssertionContainer * ?qualifier: EntityName * ?typeArguments: TypeNode[] * ?isTypeOf: bool -> ImportTypeNode abstract updateImportTypeNode: node: ImportTypeNode * argument: TypeNode * qualifier: EntityName option * typeArguments: TypeNode[] option * ?isTypeOf: bool -> ImportTypeNode + abstract updateImportTypeNode: node: ImportTypeNode * argument: TypeNode * assertions: ImportTypeAssertionContainer option * qualifier: EntityName option * typeArguments: TypeNode[] option * ?isTypeOf: bool -> ImportTypeNode abstract createParenthesizedType: ``type``: TypeNode -> ParenthesizedTypeNode abstract updateParenthesizedType: node: ParenthesizedTypeNode * ``type``: TypeNode -> ParenthesizedTypeNode abstract createThisTypeNode: unit -> ThisTypeNode @@ -6009,6 +6436,8 @@ Use typeAcquisition.enable instead.")>] abstract updateAssertClause: node: AssertClause * elements: AssertEntry[] * ?multiLine: bool -> AssertClause abstract createAssertEntry: name: AssertionKey * value: Expression -> AssertEntry abstract updateAssertEntry: node: AssertEntry * name: AssertionKey * value: Expression -> AssertEntry + abstract createImportTypeAssertionContainer: clause: AssertClause * ?multiLine: bool -> ImportTypeAssertionContainer + abstract updateImportTypeAssertionContainer: node: ImportTypeAssertionContainer * clause: AssertClause * ?multiLine: bool -> ImportTypeAssertionContainer abstract createNamespaceImport: name: Identifier -> NamespaceImport abstract updateNamespaceImport: node: NamespaceImport * name: Identifier -> NamespaceImport abstract createNamespaceExport: name: Identifier -> NamespaceExport @@ -6029,9 +6458,9 @@ Use typeAcquisition.enable instead.")>] abstract updateExternalModuleReference: node: ExternalModuleReference * expression: Expression -> ExternalModuleReference abstract createJSDocAllType: unit -> JSDocAllType abstract createJSDocUnknownType: unit -> JSDocUnknownType - abstract createJSDocNonNullableType: ``type``: TypeNode -> JSDocNonNullableType + abstract createJSDocNonNullableType: ``type``: TypeNode * ?postfix: bool -> JSDocNonNullableType abstract updateJSDocNonNullableType: node: JSDocNonNullableType * ``type``: TypeNode -> JSDocNonNullableType - abstract createJSDocNullableType: ``type``: TypeNode -> JSDocNullableType + abstract createJSDocNullableType: ``type``: TypeNode * ?postfix: bool -> JSDocNullableType abstract updateJSDocNullableType: node: JSDocNullableType * ``type``: TypeNode -> JSDocNullableType abstract createJSDocOptionalType: ``type``: TypeNode -> JSDocOptionalType abstract updateJSDocOptionalType: node: JSDocOptionalType * ``type``: TypeNode -> JSDocOptionalType @@ -6242,7 +6671,7 @@ Use typeAcquisition.enable instead.")>] /// abstract onEmitNode: (EmitHint -> Node -> (EmitHint -> Node -> unit) -> unit) with get, set - type [] TransformationResult<'T> = + type [] TransformationResult<'T when 'T :> Node> = /// Gets the transformed source files. abstract transformed: 'T[] with get, set /// Gets diagnostics for the transformation. @@ -6271,25 +6700,25 @@ Use typeAcquisition.enable instead.")>] /// A function that is used to initialize and return a Transformer callback, which in turn /// will be used to transform one or more nodes. /// - [] abstract Invoke: context: TransformationContext -> Transformer<'T> + [] abstract Invoke: context: TransformationContext -> Transformer<'T> /// A function that transforms a node. type [] Transformer<'T> = /// A function that transforms a node. - [] abstract Invoke: node: 'T -> 'T + [] abstract Invoke: node: 'T -> 'T /// A function that accepts and possibly transforms a node. type [] Visitor = /// A function that accepts and possibly transforms a node. - [] abstract Invoke: node: Node -> VisitResult + [] abstract Invoke: node: Node -> VisitResult type [] NodeVisitor = - [] abstract Invoke: nodes: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T - [] abstract Invoke: nodes: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option + [] abstract Invoke: nodes: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T + [] abstract Invoke: nodes: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option type [] NodesVisitor = - [] abstract Invoke: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] - [] abstract Invoke: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option + [] abstract Invoke: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] + [] abstract Invoke: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option type VisitResult<'T> = U2<'T, 'T[]> option @@ -6314,7 +6743,7 @@ Use typeAcquisition.enable instead.")>] /// abstract printNode: hint: EmitHint * node: Node * sourceFile: SourceFile -> string /// Prints a list of nodes using the given format flags - abstract printList: format: ListFormat * list: 'T[] * sourceFile: SourceFile -> string + abstract printList: format: ListFormat * list: 'T[] * sourceFile: SourceFile -> string when 'T :> Node /// Prints a source file as-is, without any emit transformations. abstract printFile: sourceFile: SourceFile -> string /// Prints a bundle of source files as-is, without any emit transformations. @@ -6468,6 +6897,8 @@ Use typeAcquisition.enable instead.")>] abstract includeAutomaticOptionalChainCompletions: bool option abstract includeCompletionsWithInsertText: bool option abstract includeCompletionsWithClassMemberSnippets: bool option + abstract includeCompletionsWithObjectLiteralMethodSnippets: bool option + abstract useLabelDetailsInCompletionEntries: bool option abstract allowIncompleteCompletions: bool option abstract importModuleSpecifierPreference: UserPreferencesImportModuleSpecifierPreference option /// Determines whether we import foo/index.ts as "foo", "foo/index", or "foo/index.js" @@ -6477,6 +6908,13 @@ Use typeAcquisition.enable instead.")>] abstract includePackageJsonAutoImports: UserPreferencesIncludePackageJsonAutoImports option abstract provideRefactorNotApplicableReason: bool option abstract jsxAttributeCompletionStyle: UserPreferencesJsxAttributeCompletionStyle option + abstract includeInlayParameterNameHints: UserPreferencesIncludeInlayParameterNameHints option + abstract includeInlayParameterNameHintsWhenArgumentMatchesName: bool option + abstract includeInlayFunctionParameterTypeHints: bool option + abstract includeInlayVariableTypeHints: bool option + abstract includeInlayPropertyDeclarationTypeHints: bool option + abstract includeInlayFunctionLikeReturnTypeHints: bool option + abstract includeInlayEnumMemberValueHints: bool option /// Represents a bigint literal value without requiring bigint support type [] PseudoBigInt = @@ -6489,10 +6927,10 @@ Use typeAcquisition.enable instead.")>] | Deleted = 2 type [] FileWatcherCallback = - [] abstract Invoke: fileName: string * eventKind: FileWatcherEventKind -> unit + [] abstract Invoke: fileName: string * eventKind: FileWatcherEventKind -> unit type [] DirectoryWatcherCallback = - [] abstract Invoke: fileName: string -> unit + [] abstract Invoke: fileName: string -> unit type [] System = abstract args: string[] with get, set @@ -6534,7 +6972,7 @@ Use typeAcquisition.enable instead.")>] abstract close: unit -> unit type [] ErrorCallback = - [] abstract Invoke: message: DiagnosticMessage * length: float -> unit + [] abstract Invoke: message: DiagnosticMessage * length: float -> unit type [] Scanner = abstract getStartPos: unit -> float @@ -6578,8 +7016,23 @@ Use typeAcquisition.enable instead.")>] type [] ParameterPropertyDeclaration = interface end + type [] CreateSourceFileOptions = + abstract languageVersion: ScriptTarget with get, set + /// + /// Controls the format the file is detected as - this can be derived from only the path + /// and files on disk, but needs to be done with a module resolution cache in scope to be performant. + /// This is usually undefined for compilations that do not have moduleResolution values of node16 or nodenext. + /// + abstract impliedNodeFormat: ModuleKind option with get, set + /// + /// Controls how module-y-ness is set for the given file. Usually the result of calling + /// getSetExternalModuleIndicator on a valid CompilerOptions object. If not present, the default + /// check specified by isFileProbablyExternalModule will be used to set the field. + /// + abstract setExternalModuleIndicator: (SourceFile -> unit) option with get, set + type [] DiagnosticReporter = - [] abstract Invoke: diagnostic: Diagnostic -> unit + [] abstract Invoke: diagnostic: Diagnostic -> unit /// Reports config file diagnostics type [] ConfigFileDiagnosticsReporter = @@ -6737,7 +7190,7 @@ Use typeAcquisition.enable instead.")>] abstract getCurrentDirectory: unit -> string abstract readFile: fileName: string -> string option - type [] IncrementalProgramOptions<'T> = + type [] IncrementalProgramOptions<'T when 'T :> BuilderProgram> = abstract rootNames: string[] with get, set abstract options: CompilerOptions with get, set abstract configFileParsingDiagnostics: Diagnostic[] option with get, set @@ -6746,12 +7199,12 @@ Use typeAcquisition.enable instead.")>] abstract createProgram: CreateProgram<'T> option with get, set type [] WatchStatusReporter = - [] abstract Invoke: diagnostic: Diagnostic * newLine: string * options: CompilerOptions * ?errorCount: float -> unit + [] abstract Invoke: diagnostic: Diagnostic * newLine: string * options: CompilerOptions * ?errorCount: float -> unit /// Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program - type [] CreateProgram<'T> = + type [] CreateProgram<'T when 'T :> BuilderProgram> = /// Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program - [] abstract Invoke: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: 'T * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> 'T + [] abstract Invoke: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: 'T * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> 'T /// Host that has watch functionality used in --watch mode type [] WatchHost = @@ -6766,7 +7219,7 @@ Use typeAcquisition.enable instead.")>] /// If provided, will be used to reset existing delayed compilation abstract clearTimeout: timeoutId: obj option -> unit - type [] ProgramHost<'T> = + type [] ProgramHost<'T when 'T :> BuilderProgram> = /// Used to create the program when need for program creation or recreation detected abstract createProgram: CreateProgram<'T> with get, set abstract useCaseSensitiveFileNames: unit -> bool @@ -6796,9 +7249,9 @@ Use typeAcquisition.enable instead.")>] /// If provided, used to resolve the module names, otherwise typescript's default module resolution abstract resolveModuleNames: moduleNames: string[] * containingFile: string * reusedNames: string[] option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResolvedModule option[] /// If provided, used to resolve type reference directives, otherwise typescript's default resolution - abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: string[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions -> ResolvedTypeReferenceDirective option[] + abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: U2 * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingFileMode: obj -> ResolvedTypeReferenceDirective option[] - type [] WatchCompilerHost<'T> = + type [] WatchCompilerHost<'T when 'T :> BuilderProgram> = inherit ProgramHost<'T> inherit WatchHost /// Instead of using output d.ts file from project reference, use its source file @@ -6809,7 +7262,7 @@ Use typeAcquisition.enable instead.")>] abstract afterProgramCreate: program: 'T -> unit /// Host to create watch with root files and options - type [] WatchCompilerHostOfFilesAndCompilerOptions<'T> = + type [] WatchCompilerHostOfFilesAndCompilerOptions<'T when 'T :> BuilderProgram> = inherit WatchCompilerHost<'T> /// root files to use to generate program abstract rootFiles: string[] with get, set @@ -6820,7 +7273,7 @@ Use typeAcquisition.enable instead.")>] abstract projectReferences: ProjectReference[] option with get, set /// Host to create watch with config file - type [] WatchCompilerHostOfConfigFile<'T> = + type [] WatchCompilerHostOfConfigFile<'T when 'T :> BuilderProgram> = inherit WatchCompilerHost<'T> inherit ConfigFileDiagnosticsReporter /// Name of the config file to compile @@ -6859,13 +7312,13 @@ Use typeAcquisition.enable instead.")>] [] abstract Item: option: string -> CompilerOptionsValue option with get, set type [] ReportEmitErrorSummary = - [] abstract Invoke: errorCount: float * filesInError: ReportFileInError option[] -> unit + [] abstract Invoke: errorCount: float * filesInError: ReportFileInError option[] -> unit type [] ReportFileInError = abstract fileName: string with get, set abstract line: float with get, set - type [] SolutionBuilderHostBase<'T> = + type [] SolutionBuilderHostBase<'T when 'T :> BuilderProgram> = inherit ProgramHost<'T> abstract createDirectory: path: string -> unit /// Should provide create directory and writeFile if done of invalidatedProjects is not invoked with @@ -6880,15 +7333,15 @@ Use typeAcquisition.enable instead.")>] abstract reportSolutionBuilderStatus: DiagnosticReporter with get, set abstract afterProgramEmitAndDiagnostics: program: 'T -> unit - type [] SolutionBuilderHost<'T> = + type [] SolutionBuilderHost<'T when 'T :> BuilderProgram> = inherit SolutionBuilderHostBase<'T> abstract reportErrorSummary: ReportEmitErrorSummary option with get, set - type [] SolutionBuilderWithWatchHost<'T> = + type [] SolutionBuilderWithWatchHost<'T when 'T :> BuilderProgram> = inherit SolutionBuilderHostBase<'T> inherit WatchHost - type [] SolutionBuilder<'T> = + type [] SolutionBuilder<'T when 'T :> BuilderProgram> = abstract build: ?project: string * ?cancellationToken: CancellationToken * ?writeFile: WriteFileCallback * ?getCustomTransformers: (string -> CustomTransformers) -> ExitStatus abstract clean: ?project: string -> ExitStatus abstract buildReferences: project: string * ?cancellationToken: CancellationToken * ?writeFile: WriteFileCallback * ?getCustomTransformers: (string -> CustomTransformers) -> ExitStatus @@ -6913,7 +7366,7 @@ Use typeAcquisition.enable instead.")>] abstract kind: InvalidatedProjectKind abstract updateOutputFileStatmps: unit -> unit - type [] BuildInvalidedProject<'T> = + type [] BuildInvalidedProject<'T when 'T :> BuilderProgram> = inherit InvalidatedProjectBase abstract kind: InvalidatedProjectKind abstract getBuilderProgram: unit -> 'T option @@ -6929,15 +7382,18 @@ Use typeAcquisition.enable instead.")>] abstract getSemanticDiagnosticsOfNextAffectedFile: ?cancellationToken: CancellationToken * ?ignoreSourceFile: (SourceFile -> bool) -> AffectedFileResult abstract emit: ?targetSourceFile: SourceFile * ?writeFile: WriteFileCallback * ?cancellationToken: CancellationToken * ?emitOnlyDtsFiles: bool * ?customTransformers: CustomTransformers -> EmitResult option - type [] UpdateBundleProject<'T> = + type [] UpdateBundleProject<'T when 'T :> BuilderProgram> = inherit InvalidatedProjectBase abstract kind: InvalidatedProjectKind abstract emit: ?writeFile: WriteFileCallback * ?customTransformers: CustomTransformers -> U2> option - type [] [] InvalidatedProject<'T> = - | [] BuildInvalidedProject of BuildInvalidedProject<'T> - | [] UpdateBundleProject of UpdateBundleProject<'T> - | [] UpdateOutputFileStampsProject of UpdateOutputFileStampsProject + type [] [] InvalidatedProject<'T when 'T :> BuilderProgram> = + | [] BuildInvalidedProject of BuildInvalidedProject<'T> + | [] UpdateBundleProject of UpdateBundleProject<'T> + | [] UpdateOutputFileStampsProject of UpdateOutputFileStampsProject + static member inline op_ErasedCast(x: BuildInvalidedProject<'T>) = BuildInvalidedProject x + static member inline op_ErasedCast(x: UpdateBundleProject<'T>) = UpdateBundleProject x + static member inline op_ErasedCast(x: UpdateOutputFileStampsProject) = UpdateOutputFileStampsProject x module Server = @@ -7037,9 +7493,6 @@ Use typeAcquisition.enable instead.")>] abstract unresolvedImports: SortedReadonlyArray abstract kind: ActionSet - type [] SourceFileLike = - abstract getLineAndCharacterOfPosition: pos: float -> LineAndCharacter - /// Represents an immutable snapshot of a script at a specified time.Once acquired, the /// snapshot is observably immutable. i.e. the same calls with the same parameters will return /// the same values. @@ -7093,6 +7546,7 @@ Use typeAcquisition.enable instead.")>] type [] LanguageServiceHost = inherit GetEffectiveTypeRootsHost + inherit MinimalResolutionCacheHost abstract getCompilationSettings: unit -> CompilerOptions abstract getNewLine: unit -> string abstract getProjectVersion: unit -> string @@ -7110,13 +7564,14 @@ Use typeAcquisition.enable instead.")>] abstract error: s: string -> unit abstract useCaseSensitiveFileNames: unit -> bool abstract readDirectory: path: string * ?extensions: string[] * ?exclude: string[] * ?``include``: string[] * ?depth: float -> string[] - abstract readFile: path: string * ?encoding: string -> string option + /// Resolve a symbolic link. abstract realpath: path: string -> string + abstract readFile: path: string * ?encoding: string -> string option abstract fileExists: path: string -> bool abstract getTypeRootsVersion: unit -> float abstract resolveModuleNames: moduleNames: string[] * containingFile: string * reusedNames: string[] option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResolvedModule option[] abstract getResolvedModuleWithFailedLookupLocationsFromCache: modulename: string * containingFile: string * ?resolutionMode: ModuleKind -> ResolvedModuleWithFailedLookupLocations option - abstract resolveTypeReferenceDirectives: typeDirectiveNames: string[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions -> ResolvedTypeReferenceDirective option[] + abstract resolveTypeReferenceDirectives: typeDirectiveNames: U2 * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingFileMode: obj -> ResolvedTypeReferenceDirective option[] abstract getDirectories: directoryName: string -> string[] /// Gets a set of custom transformers to use during emit. abstract getCustomTransformers: unit -> CustomTransformers option @@ -7130,7 +7585,7 @@ Use typeAcquisition.enable instead.")>] type [] [] SemanticClassificationFormat = | Original - | [] TwentyTwenty + | [] TwentyTwenty type [] LanguageService = /// This is used as a part of restarting the language service. @@ -7296,15 +7751,15 @@ Use typeAcquisition.enable instead.")>] abstract skipDestructiveCodeActions: bool option with get, set type [] [] CompletionsTriggerCharacter = - | [] Dot - | [] DoubleQuote - | [] SingleQuote - | [] BackQuote - | [] Slash - | [] At - | [] LessThan - | [] Sharp - | [] Empty + | [] Dot + | [] DoubleQuote + | [] SingleQuote + | [] BackQuote + | [] Slash + | [] At + | [] LessThan + | [] Sharp + | [] Empty type [] CompletionTriggerKind = /// Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. @@ -7325,20 +7780,10 @@ Use typeAcquisition.enable instead.")>] [] abstract includeInsertTextCompletions: bool option with get, set - type [] InlayHintsOptions = - inherit UserPreferences - abstract includeInlayParameterNameHints: InlayHintsOptionsIncludeInlayParameterNameHints option - abstract includeInlayParameterNameHintsWhenArgumentMatchesName: bool option - abstract includeInlayFunctionParameterTypeHints: bool option - abstract includeInlayVariableTypeHints: bool option - abstract includeInlayPropertyDeclarationTypeHints: bool option - abstract includeInlayFunctionLikeReturnTypeHints: bool option - abstract includeInlayEnumMemberValueHints: bool option - type [] [] SignatureHelpTriggerCharacter = - | [] Comma - | [] LeftParen - | [] LessThan + | [] Comma + | [] LeftParen + | [] LessThan type SignatureHelpRetriggerCharacter = U2 @@ -7347,9 +7792,12 @@ Use typeAcquisition.enable instead.")>] abstract triggerReason: SignatureHelpTriggerReason option with get, set type [] [] SignatureHelpTriggerReason = - | [] SignatureHelpCharacterTypedReason of SignatureHelpCharacterTypedReason - | [] SignatureHelpInvokedReason of SignatureHelpInvokedReason - | [] SignatureHelpRetriggeredReason of SignatureHelpRetriggeredReason + | [] SignatureHelpCharacterTypedReason of SignatureHelpCharacterTypedReason + | [] SignatureHelpInvokedReason of SignatureHelpInvokedReason + | [] SignatureHelpRetriggeredReason of SignatureHelpRetriggeredReason + static member inline op_ErasedCast(x: SignatureHelpCharacterTypedReason) = SignatureHelpCharacterTypedReason x + static member inline op_ErasedCast(x: SignatureHelpInvokedReason) = SignatureHelpInvokedReason x + static member inline op_ErasedCast(x: SignatureHelpRetriggeredReason) = SignatureHelpRetriggeredReason x /// Signals that the user manually requested signature help. /// The language service will unconditionally attempt to provide a result. @@ -7439,9 +7887,9 @@ Use typeAcquisition.enable instead.")>] abstract fromSpans: TextSpan[] with get, set type [] [] InlayHintKind = - | [] Type - | [] Parameter - | [] Enum + | [] Type + | [] Parameter + | [] Enum type [] InlayHint = abstract text: string with get, set @@ -7565,7 +8013,6 @@ Use typeAcquisition.enable instead.")>] type [] ReferenceEntry = inherit DocumentSpan abstract isWriteAccess: bool with get, set - abstract isDefinition: bool with get, set abstract isInString: bool option with get, set type [] ImplementationLocation = @@ -7683,7 +8130,11 @@ Use typeAcquisition.enable instead.")>] type [] ReferencedSymbol = abstract definition: ReferencedSymbolDefinitionInfo with get, set - abstract references: ReferenceEntry[] with get, set + abstract references: ReferencedSymbolEntry[] with get, set + + type [] ReferencedSymbolEntry = + inherit ReferenceEntry + abstract isDefinition: bool option with get, set type [] SymbolDisplayPartKind = | AliasName = 0 @@ -7733,8 +8184,10 @@ Use typeAcquisition.enable instead.")>] abstract tags: JSDocTagInfo[] option with get, set type [] [] RenameInfo = - | [] RenameInfoFailure of RenameInfoFailure - | [] RenameInfoSuccess of RenameInfoSuccess + | [] RenameInfoFailure of RenameInfoFailure + | [] RenameInfoSuccess of RenameInfoSuccess + static member inline op_ErasedCast(x: RenameInfoFailure) = RenameInfoFailure x + static member inline op_ErasedCast(x: RenameInfoSuccess) = RenameInfoSuccess x type [] RenameInfoSuccess = abstract canRename: bool with get, set @@ -7792,7 +8245,18 @@ Use typeAcquisition.enable instead.")>] abstract argumentIndex: float with get, set abstract argumentCount: float with get, set + type [] CompletionInfoFlags = + | None = 0 + | MayIncludeAutoImports = 1 + | IsImportStatementCompletion = 2 + | IsContinuation = 4 + | ResolvedModuleSpecifiers = 8 + | ResolvedModuleSpecifiersBeyondLimit = 16 + | MayIncludeMethodSnippets = 32 + type [] CompletionInfo = + /// For performance telemetry. + abstract flags: CompletionInfoFlags option with get, set /// Not true for all global completions. This will be true if the enclosing scope matches a few syntax kinds. See isSnippetScope. abstract isGlobalCompletion: bool with get, set abstract isMemberCompletion: bool with get, set @@ -7846,6 +8310,7 @@ Use typeAcquisition.enable instead.")>] abstract hasAction: bool option with get, set abstract source: string option with get, set abstract sourceDisplay: SymbolDisplayPart[] option with get, set + abstract labelDetails: CompletionEntryLabelDetails option with get, set abstract isRecommended: bool option with get, set abstract isFromUncheckedFile: bool option with get, set abstract isPackageJsonImport: bool option with get, set @@ -7860,6 +8325,10 @@ Use typeAcquisition.enable instead.")>] /// abstract data: CompletionEntryData option with get, set + type [] CompletionEntryLabelDetails = + abstract detail: string option with get, set + abstract description: string option with get, set + type [] CompletionEntryDetails = abstract name: string with get, set abstract kind: ScriptElementKind with get, set @@ -7955,123 +8424,123 @@ Use typeAcquisition.enable instead.")>] abstract getEncodedLexicalClassifications: text: string * endOfLineState: EndOfLineState * syntacticClassifierAbsent: bool -> Classifications type [] [] ScriptElementKind = - | [] Unknown + | [] Unknown | Warning /// predefined type (void) or keyword (class) | Keyword /// top level script node - | [] ScriptElement + | [] ScriptElement /// module foo {} - | [] ModuleElement + | [] ModuleElement /// class X {} - | [] ClassElement + | [] ClassElement /// var x = class X {} - | [] LocalClassElement + | [] LocalClassElement /// interface Y {} - | [] InterfaceElement + | [] InterfaceElement /// type T = ... - | [] TypeElement + | [] TypeElement /// enum E - | [] EnumElement - | [] EnumMemberElement + | [] EnumElement + | [] EnumMemberElement /// Inside module and script only /// const v = .. - | [] VariableElement + | [] VariableElement /// Inside function - | [] LocalVariableElement + | [] LocalVariableElement /// Inside module and script only /// function f() { } - | [] FunctionElement + | [] FunctionElement /// Inside function - | [] LocalFunctionElement + | [] LocalFunctionElement /// class X { [public|private]* foo() {} } - | [] MemberFunctionElement + | [] MemberFunctionElement /// class X { [public|private]* [get|set] foo:number; } - | [] MemberGetAccessorElement - | [] MemberSetAccessorElement + | [] MemberGetAccessorElement + | [] MemberSetAccessorElement /// class X { [public|private]* foo:number; } /// interface Y { foo:number; } - | [] MemberVariableElement + | [] MemberVariableElement /// class X { constructor() { } } /// class X { static { } } - | [] ConstructorImplementationElement + | [] ConstructorImplementationElement /// interface Y { ():number; } - | [] CallSignatureElement + | [] CallSignatureElement /// interface Y { []:number; } - | [] IndexSignatureElement + | [] IndexSignatureElement /// interface Y { new():Y; } - | [] ConstructSignatureElement + | [] ConstructSignatureElement /// function foo(*Y*: string) - | [] ParameterElement - | [] TypeParameterElement - | [] PrimitiveType + | [] ParameterElement + | [] TypeParameterElement + | [] PrimitiveType | Label | Alias - | [] ConstElement - | [] LetElement + | [] ConstElement + | [] LetElement | Directory - | [] ExternalModuleName + | [] ExternalModuleName /// <JsxTagName attribute1 attribute2={0} /> /// - | [] JsxAttribute + | [] JsxAttribute /// String literal | String /// Jsdoc @link: in {@link C link text}, the before and after text "and "" | Link /// Jsdoc @link: in {@link C link text}, the entity name "C" - | [] LinkName + | [] LinkName /// Jsdoc @link: in {@link C link text}, the link text "link text" - | [] LinkText + | [] LinkText type [] [] ScriptElementKindModifier = - | [] None - | [] PublicMemberModifier - | [] PrivateMemberModifier - | [] ProtectedMemberModifier - | [] ExportedModifier - | [] AmbientModifier - | [] StaticModifier - | [] AbstractModifier - | [] OptionalModifier - | [] DeprecatedModifier - | [] DtsModifier - | [] TsModifier - | [] TsxModifier - | [] JsModifier - | [] JsxModifier - | [] JsonModifier - | [] DmtsModifier - | [] MtsModifier - | [] MjsModifier - | [] DctsModifier - | [] CtsModifier - | [] CjsModifier + | [] None + | [] PublicMemberModifier + | [] PrivateMemberModifier + | [] ProtectedMemberModifier + | [] ExportedModifier + | [] AmbientModifier + | [] StaticModifier + | [] AbstractModifier + | [] OptionalModifier + | [] DeprecatedModifier + | [] DtsModifier + | [] TsModifier + | [] TsxModifier + | [] JsModifier + | [] JsxModifier + | [] JsonModifier + | [] DmtsModifier + | [] MtsModifier + | [] MjsModifier + | [] DctsModifier + | [] CtsModifier + | [] CjsModifier type [] [] ClassificationTypeNames = | Comment | Identifier | Keyword - | [] NumericLiteral - | [] BigintLiteral + | [] NumericLiteral + | [] BigintLiteral | Operator - | [] StringLiteral - | [] WhiteSpace + | [] StringLiteral + | [] WhiteSpace | Text | Punctuation - | [] ClassName - | [] EnumName - | [] InterfaceName - | [] ModuleName - | [] TypeParameterName - | [] TypeAliasName - | [] ParameterName - | [] DocCommentTagName - | [] JsxOpenTagName - | [] JsxCloseTagName - | [] JsxSelfClosingTagName - | [] JsxAttribute - | [] JsxText - | [] JsxAttributeStringLiteralValue + | [] ClassName + | [] EnumName + | [] InterfaceName + | [] ModuleName + | [] TypeParameterName + | [] TypeAliasName + | [] ParameterName + | [] DocCommentTagName + | [] JsxOpenTagName + | [] JsxCloseTagName + | [] JsxSelfClosingTagName + | [] JsxAttribute + | [] JsxText + | [] JsxAttributeStringLiteralValue type [] ClassificationType = | Comment = 1 @@ -8106,7 +8575,7 @@ Use typeAcquisition.enable instead.")>] abstract cancellationToken: CancellationToken with get, set abstract host: LanguageServiceHost with get, set abstract span: TextSpan with get, set - abstract preferences: InlayHintsOptions with get, set + abstract preferences: UserPreferences with get, set type [] DocumentHighlights = abstract fileName: string with get, set @@ -8132,10 +8601,13 @@ Use typeAcquisition.enable instead.")>] /// the SourceFile if was not found in the registry. /// /// The name of the file requested - /// + /// /// Some compilation settings like target affects the /// shape of a the resulting SourceFile. This allows the DocumentRegistry to store - /// multiple copies of the same file for different compilation settings. + /// multiple copies of the same file for different compilation settings. A minimal + /// resolution cache is needed to fully define a source file's shape when + /// the compilation settings include module: node16+, so providing a cache host + /// object should be preferred. A common host is a language service ConfiguredProject. /// /// /// Text of the file. Only used if the file was not found @@ -8145,23 +8617,26 @@ Use typeAcquisition.enable instead.")>] /// Current version of the file. Only used if the file was not found /// in the registry and a new one was created. /// - abstract acquireDocument: fileName: string * compilationSettings: CompilerOptions * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile - abstract acquireDocumentWithKey: fileName: string * path: Path * compilationSettings: CompilerOptions * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile + abstract acquireDocument: fileName: string * compilationSettingsOrHost: U2 * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile + abstract acquireDocumentWithKey: fileName: string * path: Path * compilationSettingsOrHost: U2 * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile /// /// Request an updated version of an already existing SourceFile with a given fileName /// and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile /// to get an updated SourceFile. /// /// The name of the file requested - /// + /// /// Some compilation settings like target affects the /// shape of a the resulting SourceFile. This allows the DocumentRegistry to store - /// multiple copies of the same file for different compilation settings. + /// multiple copies of the same file for different compilation settings. A minimal + /// resolution cache is needed to fully define a source file's shape when + /// the compilation settings include module: node16+, so providing a cache host + /// object should be preferred. A common host is a language service ConfiguredProject. /// /// Text of the file. /// Current version of the file. - abstract updateDocument: fileName: string * compilationSettings: CompilerOptions * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile - abstract updateDocumentWithKey: fileName: string * path: Path * compilationSettings: CompilerOptions * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile + abstract updateDocument: fileName: string * compilationSettingsOrHost: U2 * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile + abstract updateDocumentWithKey: fileName: string * path: Path * compilationSettingsOrHost: U2 * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile abstract getKeyForCompilationSettings: settings: CompilerOptions -> DocumentRegistryBucketKey [] abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions -> unit @@ -8210,9 +8685,9 @@ Use typeAcquisition.enable instead.")>] type [] [] UserPreferencesImportModuleSpecifierPreference = | Shortest - | [] ProjectRelative + | [] ProjectRelative | Relative - | [] NonRelative + | [] NonRelative type [] [] UserPreferencesImportModuleSpecifierEnding = | Auto @@ -8230,15 +8705,15 @@ Use typeAcquisition.enable instead.")>] | Braces | None - type [] [] PerformanceEventKind = - | [] UpdateGraph - | [] CreatePackageJsonAutoImportProvider - - type [] [] InlayHintsOptionsIncludeInlayParameterNameHints = + type [] [] UserPreferencesIncludeInlayParameterNameHints = | None | Literals | All + type [] [] PerformanceEventKind = + | [] UpdateGraph + | [] CreatePackageJsonAutoImportProvider + type [] [] NavigateToItemMatchKind = | Exact | Prefix diff --git a/lib/Parser.fs b/lib/Parser.fs index 78417f82..ffc9a928 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -1015,7 +1015,7 @@ let private getAllLocalReferences (ctx: #IContext<#IOptions>) (sourceFiles: Ts.S sourceFilesMap.Add(Path.absolute sourceFile.fileName, sourceFile) let createSourceFile path = - ts.createSourceFile(path, Node.fs.readFileSync(path, "utf-8"), Ts.ScriptTarget.Latest, setParentNodes=true, scriptKind=Ts.ScriptKind.TS) + ts.createSourceFile(path, Node.fs.readFileSync(path, "utf-8"), !^Ts.ScriptTarget.Latest, setParentNodes=true, scriptKind=Ts.ScriptKind.TS) let tryAdd (from: Ts.SourceFile) path = let path = Path.absolute path @@ -1136,7 +1136,7 @@ let createContextFromFiles (ctx: #IContext<#IOptions>) compilerOptions (fileName |> Array.map assertFileExistsAndHasCorrectExtension |> Array.map (fun a -> a, Node.fs.readFileSync(a, "utf-8")) |> Array.map (fun (a, i) -> - ts.createSourceFile (a, i, Ts.ScriptTarget.Latest, setParentNodes=true, scriptKind=Ts.ScriptKind.TS)) + ts.createSourceFile (a, i, !^Ts.ScriptTarget.Latest, setParentNodes=true, scriptKind=Ts.ScriptKind.TS)) |> fun srcs -> ctx.logger.tracef "* following relative references..." getAllLocalReferences ctx srcs |> fst @@ -1154,7 +1154,7 @@ let createContextFromFiles (ctx: #IContext<#IOptions>) compilerOptions (fileName let createContextFromString (ctx: #IContext<#IOptions>) compilerOptions (files: {| fileName: string; text: string |} seq) : ParserContext = let sourceFiles = files - |> Seq.map (fun x -> ts.createSourceFile (x.fileName, x.text, Ts.ScriptTarget.Latest, setParentNodes=true, scriptKind=Ts.ScriptKind.TS)) + |> Seq.map (fun x -> ts.createSourceFile (x.fileName, x.text, !^Ts.ScriptTarget.Latest, setParentNodes=true, scriptKind=Ts.ScriptKind.TS)) |> Seq.toArray let program = TypeScriptHelper.createProgramForBrowser sourceFiles compilerOptions !!{| diff --git a/lib/TypeScriptHelper.fs b/lib/TypeScriptHelper.fs index bd03d0e8..566d3a40 100644 --- a/lib/TypeScriptHelper.fs +++ b/lib/TypeScriptHelper.fs @@ -7,7 +7,7 @@ let defaultCompilerOptions = jsOptions(fun o -> o.target <- Some Ts.ScriptTarget.Latest o.noEmit <- Some true - o.moduleResolution <- Some Ts.ModuleResolutionKind.Node12 + o.moduleResolution <- Some Ts.ModuleResolutionKind.NodeNext ) type IDummyCompilerHost = diff --git a/package.json b/package.json index 50ffbcfc..67f1652e 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "dependencies": { "browser-or-node": "^2.0.0", - "typescript": "4.6.4", + "typescript": "4.7", "yargs": "17.5.1" }, "devDependencies": { diff --git a/src/Main.fs b/src/Main.fs index f69cf6d9..2bcacbfb 100644 --- a/src/Main.fs +++ b/src/Main.fs @@ -5,13 +5,7 @@ open Fable.Core.JsInterop open TypeScript open Syntax -let options = - jsOptions(fun o -> - o.target <- Some Ts.ScriptTarget.Latest - o.noEmit <- Some true - o.moduleResolution <- Some Ts.ModuleResolutionKind.Node12 - //o.traceResolution <- Some true - ) +let options = TypeScriptHelper.defaultCompilerOptions open Yargs diff --git a/yarn.lock b/yarn.lock index 1987bf96..690d0ec3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2320,10 +2320,10 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -typescript@4.6.4: - version "4.6.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" - integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== +typescript@4.7: + version "4.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.2.tgz#1f9aa2ceb9af87cca227813b4310fff0b51593c4" + integrity sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A== unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" From b7a7ef3f3f6e94f98f96a08edaecfd1478953981 Mon Sep 17 00:00:00 2001 From: cannorin Date: Tue, 2 Aug 2022 22:02:38 +0900 Subject: [PATCH 07/17] Better error messages --- lib/Bindings/Chalk.fs | 153 ++++++++++++++++++++++++++++++++ lib/Bindings/Codeframe.fs | 68 ++++++++++++++ lib/Extensions.fs | 5 ++ lib/Parser.fs | 31 ++++--- lib/Syntax.fs | 4 +- lib/Typer.fs | 2 +- lib/ts2ml.fsproj | 2 + package.json | 3 + src/Common.fs | 11 ++- src/Targets/JsOfOCaml/Target.fs | 4 +- webpack.config.js | 9 +- yarn.lock | 31 +++++++ 12 files changed, 299 insertions(+), 24 deletions(-) create mode 100644 lib/Bindings/Chalk.fs create mode 100644 lib/Bindings/Codeframe.fs diff --git a/lib/Bindings/Chalk.fs b/lib/Bindings/Chalk.fs new file mode 100644 index 00000000..e195f588 --- /dev/null +++ b/lib/Bindings/Chalk.fs @@ -0,0 +1,153 @@ +module Chalk + +#nowarn "3390" // disable warnings for invalid XML comments + +open System +open Fable.Core +open Fable.Core.JS + +type ColorSupportLevel = + | L0 = 0 + | L1 = 1 + | L2 = 2 + | L3 = 3 + +type ColorInfo = U2 + +type [] ChalkInstance = + [] abstract draw: [] text: obj[] -> string + [] abstract Item: [] text: obj[] -> string + /// + /// The color support for Chalk. + /// + /// By default, color support is automatically detected based on the environment. + /// + /// Levels: + /// - 0 - All colors disabled. + /// - 1 - Basic 16 colors support. + /// - 2 - ANSI 256 colors support. + /// - 3 - Truecolor 16 million colors support. + /// + abstract level: ColorSupportLevel with get, set + /// Use RGB values to set text color. + /// + /// + /// import chalk from 'chalk'; + /// chalk.rgb(222, 173, 237); + /// + /// + abstract rgb: float * float * float -> ChalkInstance + /// Use HEX value to set text color. + /// Hexadecimal value representing the desired color. + /// + /// + /// import chalk from 'chalk'; + /// chalk.hex('#DEADED'); + /// + /// + abstract hex: string -> ChalkInstance + /// Use an 8-bit unsigned number to set text color. + /// + /// + /// import chalk from 'chalk'; + /// chalk.ansi256(201); + /// + /// + abstract ansi256: float -> ChalkInstance + /// Use RGB values to set background color. + /// + /// + /// import chalk from 'chalk'; + /// chalk.bgRgb(222, 173, 237); + /// + /// + abstract bgRgb: float * float * float -> ChalkInstance + /// Use HEX value to set background color. + /// Hexadecimal value representing the desired color. + /// + /// + /// import chalk from 'chalk'; + /// chalk.bgHex('#DEADED'); + /// + /// + abstract bgHex: string -> ChalkInstance + /// Use a 8-bit unsigned number to set background color. + /// + /// + /// import chalk from 'chalk'; + /// chalk.bgAnsi256(201); + /// + /// + abstract bgAnsi256: float -> ChalkInstance + /// Modifier: Reset the current style. + abstract reset: ChalkInstance + /// Modifier: Make the text bold. + abstract bold: ChalkInstance + /// Modifier: Make the text have lower opacity. + abstract dim: ChalkInstance + /// Modifier: Make the text italic. *(Not widely supported)* + abstract italic: ChalkInstance + /// Modifier: Put a horizontal line below the text. *(Not widely supported)* + abstract underline: ChalkInstance + /// Modifier: Put a horizontal line above the text. *(Not widely supported)* + abstract overline: ChalkInstance + /// Modifier: Invert background and foreground colors. + abstract inverse: ChalkInstance + /// Modifier: Print the text but make it invisible. + abstract hidden: ChalkInstance + /// Modifier: Puts a horizontal line through the center of the text. *(Not widely supported)* + abstract strikethrough: ChalkInstance + /// Modifier: Print the text only when Chalk has a color level above zero. + /// + /// Can be useful for things that are purely cosmetic. + abstract visible: ChalkInstance + abstract black: ChalkInstance + abstract red: ChalkInstance + abstract green: ChalkInstance + abstract yellow: ChalkInstance + abstract blue: ChalkInstance + abstract magenta: ChalkInstance + abstract cyan: ChalkInstance + abstract white: ChalkInstance + abstract gray: ChalkInstance + abstract grey: ChalkInstance + abstract blackBright: ChalkInstance + abstract redBright: ChalkInstance + abstract greenBright: ChalkInstance + abstract yellowBright: ChalkInstance + abstract blueBright: ChalkInstance + abstract magentaBright: ChalkInstance + abstract cyanBright: ChalkInstance + abstract whiteBright: ChalkInstance + abstract bgBlack: ChalkInstance + abstract bgRed: ChalkInstance + abstract bgGreen: ChalkInstance + abstract bgYellow: ChalkInstance + abstract bgBlue: ChalkInstance + abstract bgMagenta: ChalkInstance + abstract bgCyan: ChalkInstance + abstract bgWhite: ChalkInstance + abstract bgGray: ChalkInstance + abstract bgGrey: ChalkInstance + abstract bgBlackBright: ChalkInstance + abstract bgRedBright: ChalkInstance + abstract bgGreenBright: ChalkInstance + abstract bgYellowBright: ChalkInstance + abstract bgBlueBright: ChalkInstance + abstract bgMagentaBright: ChalkInstance + abstract bgCyanBright: ChalkInstance + abstract bgWhiteBright: ChalkInstance + +/// +/// Main Chalk object that allows to chain styles together. +/// +/// Call the last one as a method with a string argument. +/// +/// Order doesn't matter, and later styles take precedent in case of a conflict. +/// +/// This simply means that chalk.red.yellow.green is equivalent to chalk.green. +/// +let [] chalk: ChalkInstance = jsNative +let [] chalkStderr: ChalkInstance = jsNative +let [] supportsColor: ColorInfo = jsNative +let [] supportsColorStderr: ColorInfo = jsNative \ No newline at end of file diff --git a/lib/Bindings/Codeframe.fs b/lib/Bindings/Codeframe.fs new file mode 100644 index 00000000..0903bda5 --- /dev/null +++ b/lib/Bindings/Codeframe.fs @@ -0,0 +1,68 @@ +module Codeframe + +#nowarn "3390" // disable warnings for invalid XML comments + +open System +open Fable.Core +open Fable.Core.JS + +type Position = {| line: int; column: int option |} + +type [] SourceLocation = + abstract start: Position with get, set + abstract ``end``: Position option with get, set + +type [] BabelCodeFrameOptions = + /// Syntax highlight the code as JavaScript for terminals. default: false + abstract highlightCode: bool option with get, set + /// The number of lines to show above the error. default: 2 + abstract linesAbove: int option with get, set + /// The number of lines to show below the error. default: 3 + abstract linesBelow: int option with get, set + /// Forcibly syntax highlight the code as JavaScript (for non-terminals); + /// overrides highlightCode. + /// default: false + abstract forceColor: bool option with get, set + /// Pass in a string to be displayed inline (if possible) next to the + /// highlighted location in the code. If it can't be positioned inline, + /// it will be placed above the code frame. + /// default: nothing + abstract message: string option with get, set + +type [] ICodeframe = + [] + abstract Invoke: rawLines: string * lineNumber: int * colNumber: int * ?options: BabelCodeFrameOptions -> string + +type [] ICodeframeColumns = + [] + abstract Invoke: rawLines: string * location: SourceLocation * ?options: BabelCodeFrameOptions -> string + +let [] codeFrame: ICodeframe = jsNative + +let [] codeFrameColumns: ICodeframeColumns = jsNative + +type Codeframe = + static member CreateColumns(rawLines, startLine, ?startCol, ?endLine, ?endCol, ?highlightCode, ?linesAbove, ?linesBelow, ?forceColor, ?message) = + let options : BabelCodeFrameOptions = JsInterop.createEmpty + options.highlightCode <- highlightCode + options.linesAbove <- linesAbove + options.linesBelow <- linesBelow + options.forceColor <- forceColor + options.message <- message + let startPos = {| line = startLine; column = startCol |} + let endPos = + match endLine with + | Some x -> Some {| line = x; column = endCol |} + | None -> None + let loc : SourceLocation = JsInterop.createEmpty + loc.start <- startPos + loc.``end`` <- endPos + codeFrameColumns.Invoke(rawLines, loc, options) + static member Create(rawLines, line, col, ?highlightCode, ?linesAbove, ?linesBelow, ?forceColor, ?message) = + let options : BabelCodeFrameOptions = JsInterop.createEmpty + options.highlightCode <- highlightCode + options.linesAbove <- linesAbove + options.linesBelow <- linesBelow + options.forceColor <- forceColor + options.message <- message + codeFrame.Invoke(rawLines, line, col, options) \ No newline at end of file diff --git a/lib/Extensions.fs b/lib/Extensions.fs index fa65fbbc..ff1e3da4 100644 --- a/lib/Extensions.fs +++ b/lib/Extensions.fs @@ -220,6 +220,11 @@ module Path = if Node.path.isAbsolute(path) then path |> normalizeSlashes else Node.path.resolve(path) |> normalizeSlashes + let relativeToCwd (path: string) = + if Node.path.isAbsolute(path) then + Node.path.relative(Node.``process``.cwd(), path) |> normalizeSlashes + else path |> normalizeSlashes + let diff (fromPath: Absolute) (toPath: Absolute) : string = let fromPath = if Node.fs.lstatSync(!^fromPath).isDirectory() then fromPath diff --git a/lib/Parser.fs b/lib/Parser.fs index ffc9a928..9878e750 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -32,16 +32,21 @@ module private ParserImpl = let ppLocation (n: Node) = let src = n.getSourceFile() let pos = src.getLineAndCharacterOfPosition (n.getStart()) - sprintf "line %i, col %i of %s" (int pos.line + 1) (int pos.character + 1) src.fileName + sprintf "line %i, col %i of %s" (int pos.line + 1) (int pos.character + 1) (Path.relativeToCwd src.fileName) let ppLine (n: Node) = let src = n.getSourceFile() - let pos = src.getLineAndCharacterOfPosition (n.getStart()) - let startPos = int <| src.getPositionOfLineAndCharacter(pos.line, 0.) - let endPos = int <| src.getLineEndOfPosition(n.getEnd()) - let lines = - src.text.Substring(startPos, endPos - startPos) |> String.toLines - lines |> Array.map (sprintf "> %s") |> String.concat System.Environment.NewLine + let startPos = src.getLineAndCharacterOfPosition(n.getStart()) + let endPos = src.getLineAndCharacterOfPosition(n.getEnd()) + let text = src.text + Codeframe.Codeframe.CreateColumns( + text, + int startPos.line + 1, + int startPos.character + 1, + int endPos.line + 1, + int endPos.character + 1, + linesAbove=0, linesBelow=0 + ) let nodeWarn (ctx: ParserContext) (node: Node) format = Printf.kprintf (fun s -> @@ -1114,12 +1119,12 @@ let createDependencyGraph (sourceFiles: Ts.SourceFile[]) = for source in sourceFiles do goSourceFile source graph -let assertFileExistsAndHasCorrectExtension (fileName: string) = +let assertFileExistsAndHasCorrectExtension (ctx: #IContext<#IOptions>) (fileName: string) = assertNode () if not <| Node.fs.existsSync(!^fileName) then - failwithf "file '%s' does not exist" fileName - if fileName.EndsWith(".d.ts") |> not then - failwithf "file '%s' is not a TypeScript declaration file" fileName + ctx.logger.errorf "file '%s' does not exist" fileName + if fileName.EndsWith(".ts") |> not then + ctx.logger.errorf "file '%s' is not a TypeScript file" fileName fileName let createContextFromFiles (ctx: #IContext<#IOptions>) compilerOptions (fileNames: string[]) : ParserContext = @@ -1129,11 +1134,11 @@ let createContextFromFiles (ctx: #IContext<#IOptions>) compilerOptions (fileName if not ctx.options.followRelativeReferences then fileNames |> Array.map Path.absolute - |> Array.map assertFileExistsAndHasCorrectExtension + |> Array.map (assertFileExistsAndHasCorrectExtension ctx) else fileNames |> Array.map Path.absolute - |> Array.map assertFileExistsAndHasCorrectExtension + |> Array.map (assertFileExistsAndHasCorrectExtension ctx) |> Array.map (fun a -> a, Node.fs.readFileSync(a, "utf-8")) |> Array.map (fun (a, i) -> ts.createSourceFile (a, i, !^Ts.ScriptTarget.Latest, setParentNodes=true, scriptKind=Ts.ScriptKind.TS)) diff --git a/lib/Syntax.fs b/lib/Syntax.fs index 26333d49..d68e38c4 100644 --- a/lib/Syntax.fs +++ b/lib/Syntax.fs @@ -45,12 +45,12 @@ with sprintf "line %i, col %i of %s" (int pos.line + 1) (int pos.character + 1) - src.fileName + (Path.relativeToCwd src.fileName) | Location l -> sprintf "line %i, col %i of %s" (int l.line + 1) (int l.character + 1) - l.src.fileName + (Path.relativeToCwd l.src.fileName) | MultipleLocation l -> l |> List.map (fun x -> x.AsString) |> String.concat " and " | UnknownLocation -> "" diff --git a/lib/Typer.fs b/lib/Typer.fs index 4ed6a1a3..e0012172 100644 --- a/lib/Typer.fs +++ b/lib/Typer.fs @@ -136,7 +136,7 @@ type TyperContext<'Options, 'State when 'Options :> IOptions> = private { member this.logger = this.logger let inline private warn (ctx: IContext<_>) (loc: Location) fmt = - Printf.kprintf (fun s -> ctx.logger.warnf "%s at %s" s loc.AsString) fmt + Printf.kprintf (fun s -> ctx.logger.warnf "%s at %s" s (Path.relativeToCwd loc.AsString)) fmt module TyperContext = type private Anonoymous<'Options, 'State when 'Options :> IOptions> = {| diff --git a/lib/ts2ml.fsproj b/lib/ts2ml.fsproj index 018e8cf7..0a5e2655 100644 --- a/lib/ts2ml.fsproj +++ b/lib/ts2ml.fsproj @@ -5,6 +5,8 @@ + + diff --git a/package.json b/package.json index 67f1652e..523bb435 100644 --- a/package.json +++ b/package.json @@ -27,13 +27,16 @@ "ts2ocaml": "./dist/ts2ocaml.js" }, "dependencies": { + "@babel/code-frame": "^7.18.6", "browser-or-node": "^2.0.0", + "chalk": "^5.0.1", "typescript": "4.7", "yargs": "17.5.1" }, "devDependencies": { "@angular/common": "^13.0.3", "@babel/core": "7.18.2", + "@types/babel__code-frame": "^7.0.3", "@types/react-modal": "3.13.1", "@types/semver": "7.3.9", "@types/vscode": "^1.63.1", diff --git a/src/Common.fs b/src/Common.fs index a3a1bfd8..886a2c06 100644 --- a/src/Common.fs +++ b/src/Common.fs @@ -45,7 +45,14 @@ module Log = let warnf (opt: 'Options) fmt : _ when 'Options :> GlobalOptions = Printf.ksprintf (fun str -> if not opt.nowarn then - eprintfn "warn: %s" str + eprintfn "%s %s" (Chalk.chalk.yellow["warn:"]) str + ) fmt + + let errorf fmt = + Printf.ksprintf (fun str -> + eprintfn "%s %s" (Chalk.chalk.red["error:"]) str + Node.Api.``process``.exit -1 + failwith str ) fmt let createBaseContext (opts: #GlobalOptions) : IContext<_> = @@ -53,7 +60,7 @@ let createBaseContext (opts: #GlobalOptions) : IContext<_> = { new ILogger with member _.tracef fmt = Log.tracef opts fmt member _.warnf fmt = Log.warnf opts fmt - member _.errorf fmt = failwithf fmt + member _.errorf fmt = Log.errorf fmt } { new IContext<_> with member _.options = opts diff --git a/src/Targets/JsOfOCaml/Target.fs b/src/Targets/JsOfOCaml/Target.fs index 329b578d..1411f973 100644 --- a/src/Targets/JsOfOCaml/Target.fs +++ b/src/Targets/JsOfOCaml/Target.fs @@ -22,7 +22,7 @@ let private run (input: Input) (ctx: IContext) = if Node.Api.path.isAbsolute dir then dir else Node.Api.path.join [|curdir; dir|] let fail () = - failwithf "The output directory '%s' does not exist." path + ctx.logger.errorf "The output directory '%s' does not exist." path try if Node.Api.fs.lstatSync(!^path).isDirectory() then path else fail () @@ -60,7 +60,7 @@ let private run (input: Input) (ctx: IContext) = .Split([|Node.Api.os.EOL|], System.StringSplitOptions.RemoveEmptyEntries) |> Set.ofArray else - failwithf "The path '%s' is not a file." stubFile + ctx.logger.errorf "The path '%s' is not a file." stubFile let stubLines = Set.union existingStubLines newStubLines if stubLines <> existingStubLines then ctx.logger.tracef "* writing the stub file to '%s'..." stubFile diff --git a/webpack.config.js b/webpack.config.js index ffea9526..34d78ca3 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -30,14 +30,15 @@ fs.readdirSync(nodeModulesDir) module.exports = { target: "node", entry: CONFIG.fsharpEntry, - externals: nodeExternals, + externals: { + typescript: "commonjs typescript", + yargs: "commonjs yargs", + 'yargs-parser': "commonjs yargs-parser" + }, output: { path: path.join(__dirname, CONFIG.outputDir), filename: 'ts2ocaml.js' }, - resolve: { - modules: [nodeModulesDir] - }, plugins: [ new webpack.BannerPlugin({ banner: "#!/usr/bin/env node", diff --git a/yarn.lock b/yarn.lock index 690d0ec3..906eefab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23,6 +23,13 @@ dependencies: "@babel/highlight" "^7.16.7" +"@babel/code-frame@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" + integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== + dependencies: + "@babel/highlight" "^7.18.6" + "@babel/compat-data@^7.17.10": version "7.17.10" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.17.10.tgz#711dc726a492dfc8be8220028b1b92482362baab" @@ -135,6 +142,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== +"@babel/helper-validator-identifier@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076" + integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g== + "@babel/helper-validator-option@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" @@ -158,6 +170,15 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@babel/parser@^7.16.7", "@babel/parser@^7.18.0": version "7.18.0" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.0.tgz#10a8d4e656bc01128d299a787aa006ce1a91e112" @@ -246,6 +267,11 @@ resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.3.tgz#0300943770e04231041a51bd39f0439b5c7ab4f0" integrity sha512-nkalE/f1RvRGChwBnEIoBfSEYOXnCRdleKuv6+lePbMDrMZXeDQnqak5XDOeBgrPPyPfAdcCu/B5z+v3VhplGg== +"@types/babel__code-frame@^7.0.3": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@types/babel__code-frame/-/babel__code-frame-7.0.3.tgz#eda94e1b7c9326700a4b69c485ebbc9498a0b63f" + integrity sha512-2TN6oiwtNjOezilFVl77zwdNPwQWaDBBCCWWxyo1ctiO3vAtd7H/aB/CBJdw9+kqq3+latD0SXoedIuHySSZWw== + "@types/body-parser@*": version "1.19.2" resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.2.tgz#aea2059e28b7658639081347ac4fab3de166e6f0" @@ -807,6 +833,11 @@ chalk@^2.0.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.0.1.tgz#ca57d71e82bb534a296df63bbacc4a1c22b2a4b6" + integrity sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w== + chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" From 7c99bf00d6c591e9210203ec5892fd073e946d26 Mon Sep 17 00:00:00 2001 From: cannorin Date: Mon, 29 Aug 2022 17:11:23 +0900 Subject: [PATCH 08/17] Upgrade typescript to 4.8 --- lib/Bindings/TypeScript.fs | 802 +++---------------------------------- yarn.lock | 6 +- 2 files changed, 53 insertions(+), 755 deletions(-) diff --git a/lib/Bindings/TypeScript.fs b/lib/Bindings/TypeScript.fs index 93db86c3..62e152d0 100644 --- a/lib/Bindings/TypeScript.fs +++ b/lib/Bindings/TypeScript.fs @@ -442,6 +442,7 @@ module Ts = abstract isImportEqualsDeclaration: node: Node -> bool abstract isImportDeclaration: node: Node -> bool abstract isImportClause: node: Node -> bool + abstract isImportTypeAssertionContainer: node: Node -> bool abstract isAssertClause: node: Node -> bool abstract isAssertEntry: node: Node -> bool abstract isNamespaceImport: node: Node -> bool @@ -657,6 +658,27 @@ module Ts = abstract formatDiagnostic: diagnostic: Diagnostic * host: FormatDiagnosticsHost -> string abstract formatDiagnosticsWithColorAndContext: diagnostics: Diagnostic[] * host: FormatDiagnosticsHost -> string abstract flattenDiagnosticMessageText: diag: U2 option * newLine: string * ?indent: float -> string + /// Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly + /// provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. + abstract getModeForFileReference: ref: U2 * containingFileMode: obj -> ModuleKind option + /// + /// Calculates the final resolution mode for an import at some index within a file's imports list. This is generally the explicitly + /// defined mode of the import if provided, or, if not, the mode of the containing file (with some exceptions: import=require is always commonjs, dynamic import is always esm). + /// If you have an actual import node, prefer using getModeForUsageLocation on the reference string node. + /// + /// File to fetch the resolution mode within + /// Index into the file's complete resolution list to get the resolution of - this is a concatenation of the file's imports and module augmentations + abstract getModeForResolutionAtIndex: file: SourceFile * index: float -> ModuleKind option + /// + /// Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if + /// one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm). + /// Notably, this function always returns undefined if the containing file has an undefined impliedNodeFormat - this field is only set when + /// moduleResolution is node16+. + /// + /// The file the import or import-like reference is contained within + /// The module reference string + /// The final resolution mode of the import + abstract getModeForUsageLocation: file: {| impliedNodeFormat: obj option |} * usage: StringLiteralLike -> ModuleKind option abstract getConfigFileParsingDiagnostics: configFileParseResult: ParsedCommandLine -> Diagnostic[] /// /// A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the @@ -748,704 +770,6 @@ module Ts = /// An array of TransformerFactory callbacks used to process the transformation. /// Optional compiler options. abstract transform: source: U2<'T, 'T[]> * transformers: TransformerFactory<'T>[] * ?compilerOptions: CompilerOptions -> TransformationResult<'T> when 'T :> Node - [] - abstract createNodeArray: ('T[]) option -> (bool) option -> 'T[] when 'T :> Node - [] - abstract createNumericLiteral: U2 -> (TokenFlags) option -> NumericLiteral - [] - abstract createBigIntLiteral: U2 -> BigIntLiteral - [] - abstract createStringLiteral: {| Invoke: string -> bool option -> StringLiteral; Invoke: string -> bool option -> bool option -> StringLiteral |} - [] - abstract createStringLiteralFromNode: PropertyNameLiteral -> (bool) option -> StringLiteral - [] - abstract createRegularExpressionLiteral: string -> RegularExpressionLiteral - [] - abstract createLoopVariable: (bool) option -> Identifier - [] - abstract createUniqueName: string -> (GeneratedIdentifierFlags) option -> Identifier - [] - abstract createPrivateIdentifier: string -> PrivateIdentifier - [] - abstract createSuper: unit -> SuperExpression - [] - abstract createThis: unit -> ThisExpression - [] - abstract createNull: unit -> NullLiteral - [] - abstract createTrue: unit -> TrueLiteral - [] - abstract createFalse: unit -> FalseLiteral - [] - abstract createModifier: 'T -> ModifierToken<'T> - [] - abstract createModifiersFromModifierFlags: ModifierFlags -> Modifier[] option - [] - abstract createQualifiedName: EntityName -> U2 -> QualifiedName - [] - abstract updateQualifiedName: QualifiedName -> EntityName -> Identifier -> QualifiedName - [] - abstract createComputedPropertyName: Expression -> ComputedPropertyName - [] - abstract updateComputedPropertyName: ComputedPropertyName -> Expression -> ComputedPropertyName - [] - abstract createTypeParameterDeclaration: {| Invoke: Modifier[] option -> U2 -> TypeNode option -> TypeNode option -> TypeParameterDeclaration; Invoke: U2 -> TypeNode option -> TypeNode option -> TypeParameterDeclaration |} - [] - abstract updateTypeParameterDeclaration: {| Invoke: TypeParameterDeclaration -> Modifier[] option -> Identifier -> TypeNode option -> TypeNode option -> TypeParameterDeclaration; Invoke: TypeParameterDeclaration -> Identifier -> TypeNode option -> TypeNode option -> TypeParameterDeclaration |} - [] - abstract createParameter: Decorator[] option -> Modifier[] option -> DotDotDotToken option -> U2 -> (QuestionToken) option -> (TypeNode) option -> (Expression) option -> ParameterDeclaration - [] - abstract updateParameter: ParameterDeclaration -> Decorator[] option -> Modifier[] option -> DotDotDotToken option -> U2 -> QuestionToken option -> TypeNode option -> Expression option -> ParameterDeclaration - [] - abstract createDecorator: Expression -> Decorator - [] - abstract updateDecorator: Decorator -> Expression -> Decorator - [] - abstract createProperty: Decorator[] option -> Modifier[] option -> U2 -> U2 option -> TypeNode option -> Expression option -> PropertyDeclaration - [] - abstract updateProperty: PropertyDeclaration -> Decorator[] option -> Modifier[] option -> U2 -> U2 option -> TypeNode option -> Expression option -> PropertyDeclaration - [] - abstract createMethod: Decorator[] option -> Modifier[] option -> AsteriskToken option -> U2 -> QuestionToken option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block option -> MethodDeclaration - [] - abstract updateMethod: MethodDeclaration -> Decorator[] option -> Modifier[] option -> AsteriskToken option -> PropertyName -> QuestionToken option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block option -> MethodDeclaration - [] - abstract createConstructor: Decorator[] option -> Modifier[] option -> ParameterDeclaration[] -> Block option -> ConstructorDeclaration - [] - abstract updateConstructor: ConstructorDeclaration -> Decorator[] option -> Modifier[] option -> ParameterDeclaration[] -> Block option -> ConstructorDeclaration - [] - abstract createGetAccessor: Decorator[] option -> Modifier[] option -> U2 -> ParameterDeclaration[] -> TypeNode option -> Block option -> GetAccessorDeclaration - [] - abstract updateGetAccessor: GetAccessorDeclaration -> Decorator[] option -> Modifier[] option -> PropertyName -> ParameterDeclaration[] -> TypeNode option -> Block option -> GetAccessorDeclaration - [] - abstract createSetAccessor: Decorator[] option -> Modifier[] option -> U2 -> ParameterDeclaration[] -> Block option -> SetAccessorDeclaration - [] - abstract updateSetAccessor: SetAccessorDeclaration -> Decorator[] option -> Modifier[] option -> PropertyName -> ParameterDeclaration[] -> Block option -> SetAccessorDeclaration - [] - abstract createCallSignature: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> CallSignatureDeclaration - [] - abstract updateCallSignature: CallSignatureDeclaration -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> CallSignatureDeclaration - [] - abstract createConstructSignature: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> ConstructSignatureDeclaration - [] - abstract updateConstructSignature: ConstructSignatureDeclaration -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> ConstructSignatureDeclaration - [] - abstract updateIndexSignature: IndexSignatureDeclaration -> Decorator[] option -> Modifier[] option -> ParameterDeclaration[] -> TypeNode -> IndexSignatureDeclaration - [] - abstract createKeywordTypeNode: 'TKind -> KeywordTypeNode<'TKind> - [] - abstract createTypePredicateNodeWithModifier: AssertsKeyword option -> U3 -> TypeNode option -> TypePredicateNode - [] - abstract updateTypePredicateNodeWithModifier: TypePredicateNode -> AssertsKeyword option -> U2 -> TypeNode option -> TypePredicateNode - [] - abstract createTypeReferenceNode: U2 -> (TypeNode[]) option -> TypeReferenceNode - [] - abstract updateTypeReferenceNode: TypeReferenceNode -> EntityName -> TypeNode[] option -> TypeReferenceNode - [] - abstract createFunctionTypeNode: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode -> FunctionTypeNode - [] - abstract updateFunctionTypeNode: FunctionTypeNode -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode -> FunctionTypeNode - [] - abstract createConstructorTypeNode: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode -> ConstructorTypeNode - [] - abstract updateConstructorTypeNode: ConstructorTypeNode -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode -> ConstructorTypeNode - [] - abstract createTypeQueryNode: EntityName -> (TypeNode[]) option -> TypeQueryNode - [] - abstract updateTypeQueryNode: TypeQueryNode -> EntityName -> (TypeNode[]) option -> TypeQueryNode - [] - abstract createTypeLiteralNode: TypeElement[] option -> TypeLiteralNode - [] - abstract updateTypeLiteralNode: TypeLiteralNode -> TypeElement[] -> TypeLiteralNode - [] - abstract createArrayTypeNode: TypeNode -> ArrayTypeNode - [] - abstract updateArrayTypeNode: ArrayTypeNode -> TypeNode -> ArrayTypeNode - [] - abstract createTupleTypeNode: U2[] -> TupleTypeNode - [] - abstract updateTupleTypeNode: TupleTypeNode -> U2[] -> TupleTypeNode - [] - abstract createOptionalTypeNode: TypeNode -> OptionalTypeNode - [] - abstract updateOptionalTypeNode: OptionalTypeNode -> TypeNode -> OptionalTypeNode - [] - abstract createRestTypeNode: TypeNode -> RestTypeNode - [] - abstract updateRestTypeNode: RestTypeNode -> TypeNode -> RestTypeNode - [] - abstract createUnionTypeNode: TypeNode[] -> UnionTypeNode - [] - abstract updateUnionTypeNode: UnionTypeNode -> TypeNode[] -> UnionTypeNode - [] - abstract createIntersectionTypeNode: TypeNode[] -> IntersectionTypeNode - [] - abstract updateIntersectionTypeNode: IntersectionTypeNode -> TypeNode[] -> IntersectionTypeNode - [] - abstract createConditionalTypeNode: TypeNode -> TypeNode -> TypeNode -> TypeNode -> ConditionalTypeNode - [] - abstract updateConditionalTypeNode: ConditionalTypeNode -> TypeNode -> TypeNode -> TypeNode -> TypeNode -> ConditionalTypeNode - [] - abstract createInferTypeNode: TypeParameterDeclaration -> InferTypeNode - [] - abstract updateInferTypeNode: InferTypeNode -> TypeParameterDeclaration -> InferTypeNode - [] - abstract createImportTypeNode: {| Invoke: TypeNode -> EntityName option -> TypeNode[] option -> bool option -> ImportTypeNode; Invoke: TypeNode -> ImportTypeAssertionContainer option -> EntityName option -> TypeNode[] option -> bool option -> ImportTypeNode |} - [] - abstract updateImportTypeNode: {| Invoke: ImportTypeNode -> TypeNode -> EntityName option -> TypeNode[] option -> bool option -> ImportTypeNode; Invoke: ImportTypeNode -> TypeNode -> ImportTypeAssertionContainer option -> EntityName option -> TypeNode[] option -> bool option -> ImportTypeNode |} - [] - abstract createParenthesizedType: TypeNode -> ParenthesizedTypeNode - [] - abstract updateParenthesizedType: ParenthesizedTypeNode -> TypeNode -> ParenthesizedTypeNode - [] - abstract createThisTypeNode: unit -> ThisTypeNode - [] - abstract updateTypeOperatorNode: TypeOperatorNode -> TypeNode -> TypeOperatorNode - [] - abstract createIndexedAccessTypeNode: TypeNode -> TypeNode -> IndexedAccessTypeNode - [] - abstract updateIndexedAccessTypeNode: IndexedAccessTypeNode -> TypeNode -> TypeNode -> IndexedAccessTypeNode - [] - abstract createMappedTypeNode: U3 option -> TypeParameterDeclaration -> TypeNode option -> U3 option -> TypeNode option -> TypeElement[] option -> MappedTypeNode - [] - abstract updateMappedTypeNode: MappedTypeNode -> U3 option -> TypeParameterDeclaration -> TypeNode option -> U3 option -> TypeNode option -> TypeElement[] option -> MappedTypeNode - [] - abstract createLiteralTypeNode: U4 -> LiteralTypeNode - [] - abstract updateLiteralTypeNode: LiteralTypeNode -> U4 -> LiteralTypeNode - [] - abstract createObjectBindingPattern: BindingElement[] -> ObjectBindingPattern - [] - abstract updateObjectBindingPattern: ObjectBindingPattern -> BindingElement[] -> ObjectBindingPattern - [] - abstract createArrayBindingPattern: ArrayBindingElement[] -> ArrayBindingPattern - [] - abstract updateArrayBindingPattern: ArrayBindingPattern -> ArrayBindingElement[] -> ArrayBindingPattern - [] - abstract createBindingElement: DotDotDotToken option -> U2 option -> U2 -> (Expression) option -> BindingElement - [] - abstract updateBindingElement: BindingElement -> DotDotDotToken option -> PropertyName option -> BindingName -> Expression option -> BindingElement - [] - abstract createArrayLiteral: (Expression[]) option -> (bool) option -> ArrayLiteralExpression - [] - abstract updateArrayLiteral: ArrayLiteralExpression -> Expression[] -> ArrayLiteralExpression - [] - abstract createObjectLiteral: (ObjectLiteralElementLike[]) option -> (bool) option -> ObjectLiteralExpression - [] - abstract updateObjectLiteral: ObjectLiteralExpression -> ObjectLiteralElementLike[] -> ObjectLiteralExpression - [] - abstract createPropertyAccess: Expression -> U2 -> PropertyAccessExpression - [] - abstract updatePropertyAccess: PropertyAccessExpression -> Expression -> MemberName -> PropertyAccessExpression - [] - abstract createPropertyAccessChain: Expression -> QuestionDotToken option -> U2 -> PropertyAccessChain - [] - abstract updatePropertyAccessChain: PropertyAccessChain -> Expression -> QuestionDotToken option -> MemberName -> PropertyAccessChain - [] - abstract createElementAccess: Expression -> U2 -> ElementAccessExpression - [] - abstract updateElementAccess: ElementAccessExpression -> Expression -> Expression -> ElementAccessExpression - [] - abstract createElementAccessChain: Expression -> QuestionDotToken option -> U2 -> ElementAccessChain - [] - abstract updateElementAccessChain: ElementAccessChain -> Expression -> QuestionDotToken option -> Expression -> ElementAccessChain - [] - abstract createCall: Expression -> TypeNode[] option -> Expression[] option -> CallExpression - [] - abstract updateCall: CallExpression -> Expression -> TypeNode[] option -> Expression[] -> CallExpression - [] - abstract createCallChain: Expression -> QuestionDotToken option -> TypeNode[] option -> Expression[] option -> CallChain - [] - abstract updateCallChain: CallChain -> Expression -> QuestionDotToken option -> TypeNode[] option -> Expression[] -> CallChain - [] - abstract createNew: Expression -> TypeNode[] option -> Expression[] option -> NewExpression - [] - abstract updateNew: NewExpression -> Expression -> TypeNode[] option -> Expression[] option -> NewExpression - [] - abstract createTypeAssertion: TypeNode -> Expression -> TypeAssertion - [] - abstract updateTypeAssertion: TypeAssertion -> TypeNode -> Expression -> TypeAssertion - [] - abstract createParen: Expression -> ParenthesizedExpression - [] - abstract updateParen: ParenthesizedExpression -> Expression -> ParenthesizedExpression - [] - abstract createFunctionExpression: Modifier[] option -> AsteriskToken option -> U2 option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] option -> TypeNode option -> Block -> FunctionExpression - [] - abstract updateFunctionExpression: FunctionExpression -> Modifier[] option -> AsteriskToken option -> Identifier option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block -> FunctionExpression - [] - abstract createDelete: Expression -> DeleteExpression - [] - abstract updateDelete: DeleteExpression -> Expression -> DeleteExpression - [] - abstract createTypeOf: Expression -> TypeOfExpression - [] - abstract updateTypeOf: TypeOfExpression -> Expression -> TypeOfExpression - [] - abstract createVoid: Expression -> VoidExpression - [] - abstract updateVoid: VoidExpression -> Expression -> VoidExpression - [] - abstract createAwait: Expression -> AwaitExpression - [] - abstract updateAwait: AwaitExpression -> Expression -> AwaitExpression - [] - abstract createPrefix: PrefixUnaryOperator -> Expression -> PrefixUnaryExpression - [] - abstract updatePrefix: PrefixUnaryExpression -> Expression -> PrefixUnaryExpression - [] - abstract createPostfix: Expression -> PostfixUnaryOperator -> PostfixUnaryExpression - [] - abstract updatePostfix: PostfixUnaryExpression -> Expression -> PostfixUnaryExpression - [] - abstract createBinary: Expression -> U2 -> Expression -> BinaryExpression - [] - abstract updateConditional: ConditionalExpression -> Expression -> QuestionToken -> Expression -> ColonToken -> Expression -> ConditionalExpression - [] - abstract createTemplateExpression: TemplateHead -> TemplateSpan[] -> TemplateExpression - [] - abstract updateTemplateExpression: TemplateExpression -> TemplateHead -> TemplateSpan[] -> TemplateExpression - [] - abstract createTemplateHead: {| Invoke: string -> string option -> TokenFlags option -> TemplateHead; Invoke: string option -> string -> TokenFlags option -> TemplateHead |} - [] - abstract createTemplateMiddle: {| Invoke: string -> string option -> TokenFlags option -> TemplateMiddle; Invoke: string option -> string -> TokenFlags option -> TemplateMiddle |} - [] - abstract createTemplateTail: {| Invoke: string -> string option -> TokenFlags option -> TemplateTail; Invoke: string option -> string -> TokenFlags option -> TemplateTail |} - [] - abstract createNoSubstitutionTemplateLiteral: {| Invoke: string -> string option -> NoSubstitutionTemplateLiteral; Invoke: string option -> string -> NoSubstitutionTemplateLiteral |} - [] - abstract updateYield: YieldExpression -> AsteriskToken option -> Expression option -> YieldExpression - [] - abstract createSpread: Expression -> SpreadElement - [] - abstract updateSpread: SpreadElement -> Expression -> SpreadElement - [] - abstract createOmittedExpression: unit -> OmittedExpression - [] - abstract createAsExpression: Expression -> TypeNode -> AsExpression - [] - abstract updateAsExpression: AsExpression -> Expression -> TypeNode -> AsExpression - [] - abstract createNonNullExpression: Expression -> NonNullExpression - [] - abstract updateNonNullExpression: NonNullExpression -> Expression -> NonNullExpression - [] - abstract createNonNullChain: Expression -> NonNullChain - [] - abstract updateNonNullChain: NonNullChain -> Expression -> NonNullChain - [] - abstract createMetaProperty: SyntaxKind -> Identifier -> MetaProperty - [] - abstract updateMetaProperty: MetaProperty -> Identifier -> MetaProperty - [] - abstract createTemplateSpan: Expression -> U2 -> TemplateSpan - [] - abstract updateTemplateSpan: TemplateSpan -> Expression -> U2 -> TemplateSpan - [] - abstract createSemicolonClassElement: unit -> SemicolonClassElement - [] - abstract createBlock: Statement[] -> (bool) option -> Block - [] - abstract updateBlock: Block -> Statement[] -> Block - [] - abstract createVariableStatement: Modifier[] option -> U2 -> VariableStatement - [] - abstract updateVariableStatement: VariableStatement -> Modifier[] option -> VariableDeclarationList -> VariableStatement - [] - abstract createEmptyStatement: unit -> EmptyStatement - [] - abstract createExpressionStatement: Expression -> ExpressionStatement - [] - abstract updateExpressionStatement: ExpressionStatement -> Expression -> ExpressionStatement - [] - abstract createStatement: Expression -> ExpressionStatement - [] - abstract updateStatement: ExpressionStatement -> Expression -> ExpressionStatement - [] - abstract createIf: Expression -> Statement -> (Statement) option -> IfStatement - [] - abstract updateIf: IfStatement -> Expression -> Statement -> Statement option -> IfStatement - [] - abstract createDo: Statement -> Expression -> DoStatement - [] - abstract updateDo: DoStatement -> Statement -> Expression -> DoStatement - [] - abstract createWhile: Expression -> Statement -> WhileStatement - [] - abstract updateWhile: WhileStatement -> Expression -> Statement -> WhileStatement - [] - abstract createFor: ForInitializer option -> Expression option -> Expression option -> Statement -> ForStatement - [] - abstract updateFor: ForStatement -> ForInitializer option -> Expression option -> Expression option -> Statement -> ForStatement - [] - abstract createForIn: ForInitializer -> Expression -> Statement -> ForInStatement - [] - abstract updateForIn: ForInStatement -> ForInitializer -> Expression -> Statement -> ForInStatement - [] - abstract createForOf: AwaitKeyword option -> ForInitializer -> Expression -> Statement -> ForOfStatement - [] - abstract updateForOf: ForOfStatement -> AwaitKeyword option -> ForInitializer -> Expression -> Statement -> ForOfStatement - [] - abstract createContinue: (U2) option -> ContinueStatement - [] - abstract updateContinue: ContinueStatement -> Identifier option -> ContinueStatement - [] - abstract createBreak: (U2) option -> BreakStatement - [] - abstract updateBreak: BreakStatement -> Identifier option -> BreakStatement - [] - abstract createReturn: (Expression) option -> ReturnStatement - [] - abstract updateReturn: ReturnStatement -> Expression option -> ReturnStatement - [] - abstract createWith: Expression -> Statement -> WithStatement - [] - abstract updateWith: WithStatement -> Expression -> Statement -> WithStatement - [] - abstract createSwitch: Expression -> CaseBlock -> SwitchStatement - [] - abstract updateSwitch: SwitchStatement -> Expression -> CaseBlock -> SwitchStatement - [] - abstract createLabel: U2 -> Statement -> LabeledStatement - [] - abstract updateLabel: LabeledStatement -> Identifier -> Statement -> LabeledStatement - [] - abstract createThrow: Expression -> ThrowStatement - [] - abstract updateThrow: ThrowStatement -> Expression -> ThrowStatement - [] - abstract createTry: Block -> CatchClause option -> Block option -> TryStatement - [] - abstract updateTry: TryStatement -> Block -> CatchClause option -> Block option -> TryStatement - [] - abstract createDebuggerStatement: unit -> DebuggerStatement - [] - abstract createVariableDeclarationList: VariableDeclaration[] -> (NodeFlags) option -> VariableDeclarationList - [] - abstract updateVariableDeclarationList: VariableDeclarationList -> VariableDeclaration[] -> VariableDeclarationList - [] - abstract createFunctionDeclaration: Decorator[] option -> Modifier[] option -> AsteriskToken option -> U2 option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block option -> FunctionDeclaration - [] - abstract updateFunctionDeclaration: FunctionDeclaration -> Decorator[] option -> Modifier[] option -> AsteriskToken option -> Identifier option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> Block option -> FunctionDeclaration - [] - abstract createClassDeclaration: Decorator[] option -> Modifier[] option -> U2 option -> TypeParameterDeclaration[] option -> HeritageClause[] option -> ClassElement[] -> ClassDeclaration - [] - abstract updateClassDeclaration: ClassDeclaration -> Decorator[] option -> Modifier[] option -> Identifier option -> TypeParameterDeclaration[] option -> HeritageClause[] option -> ClassElement[] -> ClassDeclaration - [] - abstract createInterfaceDeclaration: Decorator[] option -> Modifier[] option -> U2 -> TypeParameterDeclaration[] option -> HeritageClause[] option -> TypeElement[] -> InterfaceDeclaration - [] - abstract updateInterfaceDeclaration: InterfaceDeclaration -> Decorator[] option -> Modifier[] option -> Identifier -> TypeParameterDeclaration[] option -> HeritageClause[] option -> TypeElement[] -> InterfaceDeclaration - [] - abstract createTypeAliasDeclaration: Decorator[] option -> Modifier[] option -> U2 -> TypeParameterDeclaration[] option -> TypeNode -> TypeAliasDeclaration - [] - abstract updateTypeAliasDeclaration: TypeAliasDeclaration -> Decorator[] option -> Modifier[] option -> Identifier -> TypeParameterDeclaration[] option -> TypeNode -> TypeAliasDeclaration - [] - abstract createEnumDeclaration: Decorator[] option -> Modifier[] option -> U2 -> EnumMember[] -> EnumDeclaration - [] - abstract updateEnumDeclaration: EnumDeclaration -> Decorator[] option -> Modifier[] option -> Identifier -> EnumMember[] -> EnumDeclaration - [] - abstract createModuleDeclaration: Decorator[] option -> Modifier[] option -> ModuleName -> ModuleBody option -> (NodeFlags) option -> ModuleDeclaration - [] - abstract updateModuleDeclaration: ModuleDeclaration -> Decorator[] option -> Modifier[] option -> ModuleName -> ModuleBody option -> ModuleDeclaration - [] - abstract createModuleBlock: Statement[] -> ModuleBlock - [] - abstract updateModuleBlock: ModuleBlock -> Statement[] -> ModuleBlock - [] - abstract createCaseBlock: CaseOrDefaultClause[] -> CaseBlock - [] - abstract updateCaseBlock: CaseBlock -> CaseOrDefaultClause[] -> CaseBlock - [] - abstract createNamespaceExportDeclaration: U2 -> NamespaceExportDeclaration - [] - abstract updateNamespaceExportDeclaration: NamespaceExportDeclaration -> Identifier -> NamespaceExportDeclaration - [] - abstract createImportEqualsDeclaration: Decorator[] option -> Modifier[] option -> bool -> U2 -> ModuleReference -> ImportEqualsDeclaration - [] - abstract updateImportEqualsDeclaration: ImportEqualsDeclaration -> Decorator[] option -> Modifier[] option -> bool -> Identifier -> ModuleReference -> ImportEqualsDeclaration - [] - abstract createImportDeclaration: Decorator[] option -> Modifier[] option -> ImportClause option -> Expression -> (AssertClause) option -> ImportDeclaration - [] - abstract updateImportDeclaration: ImportDeclaration -> Decorator[] option -> Modifier[] option -> ImportClause option -> Expression -> AssertClause option -> ImportDeclaration - [] - abstract createNamespaceImport: Identifier -> NamespaceImport - [] - abstract updateNamespaceImport: NamespaceImport -> Identifier -> NamespaceImport - [] - abstract createNamedImports: ImportSpecifier[] -> NamedImports - [] - abstract updateNamedImports: NamedImports -> ImportSpecifier[] -> NamedImports - [] - abstract createImportSpecifier: bool -> Identifier option -> Identifier -> ImportSpecifier - [] - abstract updateImportSpecifier: ImportSpecifier -> bool -> Identifier option -> Identifier -> ImportSpecifier - [] - abstract createExportAssignment: Decorator[] option -> Modifier[] option -> bool option -> Expression -> ExportAssignment - [] - abstract updateExportAssignment: ExportAssignment -> Decorator[] option -> Modifier[] option -> Expression -> ExportAssignment - [] - abstract createNamedExports: ExportSpecifier[] -> NamedExports - [] - abstract updateNamedExports: NamedExports -> ExportSpecifier[] -> NamedExports - [] - abstract createExportSpecifier: bool -> U2 option -> U2 -> ExportSpecifier - [] - abstract updateExportSpecifier: ExportSpecifier -> bool -> Identifier option -> Identifier -> ExportSpecifier - [] - abstract createExternalModuleReference: Expression -> ExternalModuleReference - [] - abstract updateExternalModuleReference: ExternalModuleReference -> Expression -> ExternalModuleReference - [] - abstract createJSDocTypeExpression: TypeNode -> JSDocTypeExpression - [] - abstract createJSDocTypeTag: Identifier option -> JSDocTypeExpression -> (U2) option -> JSDocTypeTag - [] - abstract createJSDocReturnTag: Identifier option -> (JSDocTypeExpression) option -> (U2) option -> JSDocReturnTag - [] - abstract createJSDocThisTag: Identifier option -> JSDocTypeExpression -> (U2) option -> JSDocThisTag - [] - abstract createJSDocComment: (U2) option -> (JSDocTag[]) option -> JSDoc - [] - abstract createJSDocParameterTag: Identifier option -> EntityName -> bool -> (JSDocTypeExpression) option -> (bool) option -> (U2) option -> JSDocParameterTag - [] - abstract createJSDocClassTag: Identifier option -> (U2) option -> JSDocClassTag - [] - abstract createJSDocAugmentsTag: Identifier option -> obj -> (U2) option -> JSDocAugmentsTag - [] - abstract createJSDocEnumTag: Identifier option -> JSDocTypeExpression -> (U2) option -> JSDocEnumTag - [] - abstract createJSDocTemplateTag: Identifier option -> JSDocTypeExpression option -> TypeParameterDeclaration[] -> (U2) option -> JSDocTemplateTag - [] - abstract createJSDocTypedefTag: Identifier option -> (U2) option -> (U2) option -> (U2) option -> JSDocTypedefTag - [] - abstract createJSDocCallbackTag: Identifier option -> JSDocSignature -> (U2) option -> (U2) option -> JSDocCallbackTag - [] - abstract createJSDocSignature: JSDocTemplateTag[] option -> JSDocParameterTag[] -> (JSDocReturnTag) option -> JSDocSignature - [] - abstract createJSDocPropertyTag: Identifier option -> EntityName -> bool -> (JSDocTypeExpression) option -> (bool) option -> (U2) option -> JSDocPropertyTag - [] - abstract createJSDocTypeLiteral: (JSDocPropertyLikeTag[]) option -> (bool) option -> JSDocTypeLiteral - [] - abstract createJSDocImplementsTag: Identifier option -> obj -> (U2) option -> JSDocImplementsTag - [] - abstract createJSDocAuthorTag: Identifier option -> (U2) option -> JSDocAuthorTag - [] - abstract createJSDocPublicTag: Identifier option -> (U2) option -> JSDocPublicTag - [] - abstract createJSDocPrivateTag: Identifier option -> (U2) option -> JSDocPrivateTag - [] - abstract createJSDocProtectedTag: Identifier option -> (U2) option -> JSDocProtectedTag - [] - abstract createJSDocReadonlyTag: Identifier option -> (U2) option -> JSDocReadonlyTag - [] - abstract createJSDocTag: Identifier -> (U2) option -> JSDocUnknownTag - [] - abstract createJsxElement: JsxOpeningElement -> JsxChild[] -> JsxClosingElement -> JsxElement - [] - abstract updateJsxElement: JsxElement -> JsxOpeningElement -> JsxChild[] -> JsxClosingElement -> JsxElement - [] - abstract createJsxSelfClosingElement: JsxTagNameExpression -> TypeNode[] option -> JsxAttributes -> JsxSelfClosingElement - [] - abstract updateJsxSelfClosingElement: JsxSelfClosingElement -> JsxTagNameExpression -> TypeNode[] option -> JsxAttributes -> JsxSelfClosingElement - [] - abstract createJsxOpeningElement: JsxTagNameExpression -> TypeNode[] option -> JsxAttributes -> JsxOpeningElement - [] - abstract updateJsxOpeningElement: JsxOpeningElement -> JsxTagNameExpression -> TypeNode[] option -> JsxAttributes -> JsxOpeningElement - [] - abstract createJsxClosingElement: JsxTagNameExpression -> JsxClosingElement - [] - abstract updateJsxClosingElement: JsxClosingElement -> JsxTagNameExpression -> JsxClosingElement - [] - abstract createJsxFragment: JsxOpeningFragment -> JsxChild[] -> JsxClosingFragment -> JsxFragment - [] - abstract createJsxText: string -> (bool) option -> JsxText - [] - abstract updateJsxText: JsxText -> string -> (bool) option -> JsxText - [] - abstract createJsxOpeningFragment: unit -> JsxOpeningFragment - [] - abstract createJsxJsxClosingFragment: unit -> JsxClosingFragment - [] - abstract updateJsxFragment: JsxFragment -> JsxOpeningFragment -> JsxChild[] -> JsxClosingFragment -> JsxFragment - [] - abstract createJsxAttribute: Identifier -> U2 option -> JsxAttribute - [] - abstract updateJsxAttribute: JsxAttribute -> Identifier -> U2 option -> JsxAttribute - [] - abstract createJsxAttributes: JsxAttributeLike[] -> JsxAttributes - [] - abstract updateJsxAttributes: JsxAttributes -> JsxAttributeLike[] -> JsxAttributes - [] - abstract createJsxSpreadAttribute: Expression -> JsxSpreadAttribute - [] - abstract updateJsxSpreadAttribute: JsxSpreadAttribute -> Expression -> JsxSpreadAttribute - [] - abstract createJsxExpression: DotDotDotToken option -> Expression option -> JsxExpression - [] - abstract updateJsxExpression: JsxExpression -> Expression option -> JsxExpression - [] - abstract createCaseClause: Expression -> Statement[] -> CaseClause - [] - abstract updateCaseClause: CaseClause -> Expression -> Statement[] -> CaseClause - [] - abstract createDefaultClause: Statement[] -> DefaultClause - [] - abstract updateDefaultClause: DefaultClause -> Statement[] -> DefaultClause - [] - abstract createHeritageClause: SyntaxKind -> ExpressionWithTypeArguments[] -> HeritageClause - [] - abstract updateHeritageClause: HeritageClause -> ExpressionWithTypeArguments[] -> HeritageClause - [] - abstract createCatchClause: U3 option -> Block -> CatchClause - [] - abstract updateCatchClause: CatchClause -> VariableDeclaration option -> Block -> CatchClause - [] - abstract createPropertyAssignment: U2 -> Expression -> PropertyAssignment - [] - abstract updatePropertyAssignment: PropertyAssignment -> PropertyName -> Expression -> PropertyAssignment - [] - abstract createShorthandPropertyAssignment: U2 -> (Expression) option -> ShorthandPropertyAssignment - [] - abstract updateShorthandPropertyAssignment: ShorthandPropertyAssignment -> Identifier -> Expression option -> ShorthandPropertyAssignment - [] - abstract createSpreadAssignment: Expression -> SpreadAssignment - [] - abstract updateSpreadAssignment: SpreadAssignment -> Expression -> SpreadAssignment - [] - abstract createEnumMember: U2 -> (Expression) option -> EnumMember - [] - abstract updateEnumMember: EnumMember -> PropertyName -> Expression option -> EnumMember - [] - abstract updateSourceFileNode: SourceFile -> Statement[] -> (bool) option -> (FileReference[]) option -> (FileReference[]) option -> (bool) option -> (FileReference[]) option -> SourceFile - [] - abstract createNotEmittedStatement: Node -> NotEmittedStatement - [] - abstract createPartiallyEmittedExpression: Expression -> (Node) option -> PartiallyEmittedExpression - [] - abstract updatePartiallyEmittedExpression: PartiallyEmittedExpression -> Expression -> PartiallyEmittedExpression - [] - abstract createCommaList: Expression[] -> CommaListExpression - [] - abstract updateCommaList: CommaListExpression -> Expression[] -> CommaListExpression - [] - abstract createBundle: SourceFile[] -> (U2[]) option -> Bundle - [] - abstract updateBundle: Bundle -> SourceFile[] -> (U2[]) option -> Bundle - [] - abstract createImmediatelyInvokedFunctionExpression: {| Invoke: Statement[] -> CallExpression; Invoke: Statement[] -> ParameterDeclaration -> Expression -> CallExpression |} - [] - abstract createImmediatelyInvokedArrowFunction: {| Invoke: Statement[] -> CallExpression; Invoke: Statement[] -> ParameterDeclaration -> Expression -> CallExpression |} - [] - abstract createVoidZero: unit -> VoidExpression - [] - abstract createExportDefault: Expression -> ExportAssignment - [] - abstract createExternalModuleExport: Identifier -> ExportDeclaration - [] - abstract createNamespaceExport: Identifier -> NamespaceExport - [] - abstract updateNamespaceExport: NamespaceExport -> Identifier -> NamespaceExport - [] - abstract createToken: 'TKind -> Token<'TKind> - [] - abstract createIdentifier: string -> Identifier - [] - abstract createTempVariable: (Identifier -> unit) option -> Identifier - [] - abstract getGeneratedNameForNode: Node option -> Identifier - [] - abstract createOptimisticUniqueName: string -> Identifier - [] - abstract createFileLevelUniqueName: string -> Identifier - [] - abstract createIndexSignature: Decorator[] option -> Modifier[] option -> ParameterDeclaration[] -> TypeNode -> IndexSignatureDeclaration - [] - abstract createTypePredicateNode: U3 -> TypeNode -> TypePredicateNode - [] - abstract updateTypePredicateNode: TypePredicateNode -> U2 -> TypeNode -> TypePredicateNode - [] - abstract createLiteral: {| Invoke: U5 -> StringLiteral; Invoke: U2 -> NumericLiteral; Invoke: bool -> BooleanLiteral; Invoke: U4 -> PrimaryExpression |} - [] - abstract createMethodSignature: TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> U2 -> QuestionToken option -> MethodSignature - [] - abstract updateMethodSignature: MethodSignature -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> PropertyName -> QuestionToken option -> MethodSignature - [] - abstract createTypeOperatorNode: {| Invoke: TypeNode -> TypeOperatorNode; Invoke: SyntaxKind -> TypeNode -> TypeOperatorNode |} - [] - abstract createTaggedTemplate: {| Invoke: Expression -> TemplateLiteral -> TaggedTemplateExpression; Invoke: Expression -> TypeNode[] option -> TemplateLiteral -> TaggedTemplateExpression |} - [] - abstract updateTaggedTemplate: {| Invoke: TaggedTemplateExpression -> Expression -> TemplateLiteral -> TaggedTemplateExpression; Invoke: TaggedTemplateExpression -> Expression -> TypeNode[] option -> TemplateLiteral -> TaggedTemplateExpression |} - [] - abstract updateBinary: BinaryExpression -> Expression -> Expression -> (U2) option -> BinaryExpression - [] - abstract createConditional: {| Invoke: Expression -> Expression -> Expression -> ConditionalExpression; Invoke: Expression -> QuestionToken -> Expression -> ColonToken -> Expression -> ConditionalExpression |} - [] - abstract createYield: {| Invoke: Expression option -> YieldExpression; Invoke: AsteriskToken option -> Expression -> YieldExpression |} - [] - abstract createClassExpression: Modifier[] option -> U2 option -> TypeParameterDeclaration[] option -> HeritageClause[] option -> ClassElement[] -> ClassExpression - [] - abstract updateClassExpression: ClassExpression -> Modifier[] option -> Identifier option -> TypeParameterDeclaration[] option -> HeritageClause[] option -> ClassElement[] -> ClassExpression - [] - abstract createPropertySignature: Modifier[] option -> U2 -> QuestionToken option -> TypeNode option -> (Expression) option -> PropertySignature - [] - abstract updatePropertySignature: PropertySignature -> Modifier[] option -> PropertyName -> QuestionToken option -> TypeNode option -> Expression option -> PropertySignature - [] - abstract createExpressionWithTypeArguments: TypeNode[] option -> Expression -> ExpressionWithTypeArguments - [] - abstract updateExpressionWithTypeArguments: ExpressionWithTypeArguments -> TypeNode[] option -> Expression -> ExpressionWithTypeArguments - [] - abstract createArrowFunction: {| Invoke: Modifier[] option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> EqualsGreaterThanToken option -> ConciseBody -> ArrowFunction; Invoke: Modifier[] option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> ConciseBody -> ArrowFunction |} - [] - abstract updateArrowFunction: {| Invoke: ArrowFunction -> Modifier[] option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> EqualsGreaterThanToken -> ConciseBody -> ArrowFunction; Invoke: ArrowFunction -> Modifier[] option -> TypeParameterDeclaration[] option -> ParameterDeclaration[] -> TypeNode option -> ConciseBody -> ArrowFunction |} - [] - abstract createVariableDeclaration: {| Invoke: U2 -> TypeNode option -> Expression option -> VariableDeclaration; Invoke: U2 -> ExclamationToken option -> TypeNode option -> Expression option -> VariableDeclaration |} - [] - abstract updateVariableDeclaration: {| Invoke: VariableDeclaration -> BindingName -> TypeNode option -> Expression option -> VariableDeclaration; Invoke: VariableDeclaration -> BindingName -> ExclamationToken option -> TypeNode option -> Expression option -> VariableDeclaration |} - [] - abstract createImportClause: Identifier option -> NamedImportBindings option -> (obj) option -> ImportClause - [] - abstract updateImportClause: ImportClause -> Identifier option -> NamedImportBindings option -> bool -> ImportClause - [] - abstract createExportDeclaration: Decorator[] option -> Modifier[] option -> NamedExportBindings option -> (Expression) option -> (obj) option -> ExportDeclaration - [] - abstract updateExportDeclaration: ExportDeclaration -> Decorator[] option -> Modifier[] option -> NamedExportBindings option -> Expression option -> bool -> ExportDeclaration - [] - abstract createJSDocParamTag: EntityName -> bool -> (JSDocTypeExpression) option -> (string) option -> JSDocParameterTag - [] - abstract createComma: Expression -> Expression -> Expression - [] - abstract createLessThan: Expression -> Expression -> Expression - [] - abstract createAssignment: Expression -> Expression -> BinaryExpression - [] - abstract createStrictEquality: Expression -> Expression -> BinaryExpression - [] - abstract createStrictInequality: Expression -> Expression -> BinaryExpression - [] - abstract createAdd: Expression -> Expression -> BinaryExpression - [] - abstract createSubtract: Expression -> Expression -> BinaryExpression - [] - abstract createLogicalAnd: Expression -> Expression -> BinaryExpression - [] - abstract createLogicalOr: Expression -> Expression -> BinaryExpression - [] - abstract createPostfixIncrement: Expression -> PostfixUnaryExpression - [] - abstract createLogicalNot: Expression -> PrefixUnaryExpression - [] - abstract createNode: SyntaxKind -> (obj) option -> (obj) option -> Node - /// - /// Creates a shallow, memberwise clone of a node ~for mutation~ with its pos, end, and parent set. - /// - /// NOTE: It is unsafe to change any properties of a Node that relate to its AST children, as those changes won't be - /// captured with respect to transformations. - /// - [] - abstract getMutableClone: 'T -> 'T when 'T :> Node - [] - abstract isTypeAssertion: Node -> bool - [] - abstract isIdentifierOrPrivateIdentifier: Node -> bool /// /// Type of objects whose values are all of the same type. @@ -2178,37 +1502,37 @@ module Ts = inherit Token<'TKind> type DotToken = - inherit PunctuationToken + PunctuationToken type DotDotDotToken = - inherit PunctuationToken + PunctuationToken type QuestionToken = - inherit PunctuationToken + PunctuationToken type ExclamationToken = - inherit PunctuationToken + PunctuationToken type ColonToken = - inherit PunctuationToken + PunctuationToken type EqualsToken = - inherit PunctuationToken + PunctuationToken type AsteriskToken = - inherit PunctuationToken + PunctuationToken type EqualsGreaterThanToken = - inherit PunctuationToken + PunctuationToken type PlusToken = - inherit PunctuationToken + PunctuationToken type MinusToken = - inherit PunctuationToken + PunctuationToken type QuestionDotToken = - inherit PunctuationToken + PunctuationToken type [] KeywordToken<'TKind> = inherit Token<'TKind> @@ -2234,46 +1558,46 @@ module Ts = inherit KeywordToken<'TKind> type AbstractKeyword = - inherit ModifierToken + ModifierToken type AsyncKeyword = - inherit ModifierToken + ModifierToken type ConstKeyword = - inherit ModifierToken + ModifierToken type DeclareKeyword = - inherit ModifierToken + ModifierToken type DefaultKeyword = - inherit ModifierToken + ModifierToken type ExportKeyword = - inherit ModifierToken + ModifierToken type InKeyword = - inherit ModifierToken + ModifierToken type PrivateKeyword = - inherit ModifierToken + ModifierToken type ProtectedKeyword = - inherit ModifierToken + ModifierToken type PublicKeyword = - inherit ModifierToken + ModifierToken type ReadonlyKeyword = - inherit ModifierToken + ModifierToken type OutKeyword = - inherit ModifierToken + ModifierToken type OverrideKeyword = - inherit ModifierToken + ModifierToken type StaticKeyword = - inherit ModifierToken + ModifierToken [] type ReadonlyToken = @@ -2296,38 +1620,17 @@ module Ts = | [] StaticKeyword of StaticKeyword [] member _.kind : SyntaxKind = jsNative - static member inline op_ErasedCast(x: AbstractKeyword) = AbstractKeyword x - static member inline op_ErasedCast(x: AsyncKeyword) = AsyncKeyword x - static member inline op_ErasedCast(x: ConstKeyword) = ConstKeyword x - static member inline op_ErasedCast(x: DeclareKeyword) = DeclareKeyword x - static member inline op_ErasedCast(x: DefaultKeyword) = DefaultKeyword x - static member inline op_ErasedCast(x: ExportKeyword) = ExportKeyword x - static member inline op_ErasedCast(x: InKeyword) = InKeyword x - static member inline op_ErasedCast(x: OutKeyword) = OutKeyword x - static member inline op_ErasedCast(x: OverrideKeyword) = OverrideKeyword x - static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x - static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x - static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x - static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x - static member inline op_ErasedCast(x: StaticKeyword) = StaticKeyword x type [] [] AccessibilityModifier = | [] PrivateKeyword of PrivateKeyword | [] ProtectedKeyword of ProtectedKeyword | [] PublicKeyword of PublicKeyword - static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x - static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x - static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x type [] [] ParameterPropertyModifier = | [] PrivateKeyword of PrivateKeyword | [] ProtectedKeyword of ProtectedKeyword | [] PublicKeyword of PublicKeyword | [] ReadonlyKeyword of ReadonlyKeyword - static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x - static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x - static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x - static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x type [] [] ClassMemberModifier = | [] PrivateKeyword of PrivateKeyword @@ -2335,11 +1638,6 @@ module Ts = | [] PublicKeyword of PublicKeyword | [] ReadonlyKeyword of ReadonlyKeyword | [] StaticKeyword of StaticKeyword - static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x - static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x - static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x - static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x - static member inline op_ErasedCast(x: StaticKeyword) = StaticKeyword x type ModifiersArray = Modifier[] @@ -6720,7 +6018,7 @@ Use typeAcquisition.enable instead.")>] [] abstract Invoke: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] [] abstract Invoke: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option - type VisitResult<'T> = + type VisitResult<'T when 'T :> Node> = U2<'T, 'T[]> option type [] Printer = @@ -7751,8 +7049,8 @@ Use typeAcquisition.enable instead.")>] abstract skipDestructiveCodeActions: bool option with get, set type [] [] CompletionsTriggerCharacter = - | [] Dot - | [] DoubleQuote + | [] Period + | [] Backslash | [] SingleQuote | [] BackQuote | [] Slash diff --git a/yarn.lock b/yarn.lock index 906eefab..21fd8aeb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2352,9 +2352,9 @@ type-is@~1.6.18: mime-types "~2.1.24" typescript@4.7: - version "4.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.2.tgz#1f9aa2ceb9af87cca227813b4310fff0b51593c4" - integrity sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A== + version "4.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" + integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" From 8d8436dbd32772ace18f4d80e88c5cc45ef4f36b Mon Sep 17 00:00:00 2001 From: cannorin Date: Mon, 29 Aug 2022 21:18:40 +0900 Subject: [PATCH 09/17] Fix a bug on resolving fullname --- lib/JsHelper.fs | 5 +++- lib/Parser.fs | 68 ++++++++++++++++++++++++++----------------------- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/lib/JsHelper.fs b/lib/JsHelper.fs index 610b1fca..456c1f94 100644 --- a/lib/JsHelper.fs +++ b/lib/JsHelper.fs @@ -156,7 +156,10 @@ let inferPackageInfoFromFileName (sourceFile: Path.Absolute) : {| name: string; | _ -> None let inline stripExtension path = - path |> String.replace ".ts" "" |> String.replace ".d" "" + let stripEnd ext cont (path: string) = + if path.EndsWith(ext) then path.Substring(0, path.Length - ext.Length) + else cont path + stripEnd ".d.ts" (stripEnd ".ts" id) path let getJsModuleName (info: Syntax.PackageInfo option) (sourceFile: Path.Absolute) = let getSubmodule rest = diff --git a/lib/Parser.fs b/lib/Parser.fs index 9878e750..f7432740 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -18,7 +18,6 @@ type ParserContext = inherit IContext abstract checker: TypeChecker abstract currentSource: Ts.SourceFile with get, set - abstract currentAmbientModule: string option with get, set abstract program: Ts.Program abstract fileNames: Path.Absolute[] @@ -144,38 +143,43 @@ module private ParserImpl = ] |> Some go s - let normalizeQualifiedName (ctx: ParserContext) (fileNames: string list) (s: string) = - s - |> String.split "." - |> List.ofArray - |> function - | x :: xs when x.StartsWith("\"") -> - let basenames = fileNames |> List.map JsHelper.stripExtension - if basenames |> List.exists (fun basename -> x.Contains basename) then xs - else x :: xs - | x :: xs -> - match ctx.currentAmbientModule with - | None -> x :: xs - | Some amb -> amb :: x :: xs // workaround the bug which omits the enclosing ambient module from the full name - | xs -> xs - - let getFullName (ctx: ParserContext) (nd: Node) = - match ctx.checker.getSymbolAtLocation nd with - | None -> None - | Some s -> - let source = ctx.currentSource.fileName - let fullName = - ctx.checker.getFullyQualifiedName s |> normalizeQualifiedName ctx [source] - Some { source = source; name = fullName } + type Source = {| + file: Path.Absolute + moduleName: string option + |} + + let getSource (d: Ts.Declaration) : Source = + let sourceFile = d.getSourceFile() + let rec findAmbientModule (n: Ts.Node) = + if isNullOrUndefined n then None + else + match n.kind with + | Kind.SourceFile -> None + | Kind.ModuleDeclaration -> + let md = n :?> Ts.ModuleDeclaration + match md.name with + | ModuleName.StringLiteral s -> Some s.text + | ModuleName.Identifier _ -> findAmbientModule n.parent + | _ -> findAmbientModule n.parent + let ambientModuleName = findAmbientModule d + {| file = Path.absolute sourceFile.fileName; moduleName = ambientModuleName |} + + let makeFullName (fn: string list) (s: Source) = + let name = + match s.moduleName, fn with + | Some m, x :: _ when x = $"\"{m}\"" -> fn + | Some m, _ -> $"\"{m}\"" :: fn + | None, x :: fn when x.StartsWith("\"") -> fn + | None, _ -> fn + { source = s.file; name = name } let getFullNames (ctx: ParserContext) (nd: Node) = let getSources (s: Ts.Symbol) = s.declarations - |> Option.toList - |> List.collect (fun decs -> - decs |> Array.map (fun dec -> dec.getSourceFile()) |> List.ofArray) - |> List.map (fun x -> x.fileName |> Path.absolute) - |> List.distinct + |> Option.toArray + |> Array.collect (Array.map getSource) + |> Array.distinctBy (fun x -> x.file) + |> List.ofArray let getRootAndAliasedSymbols (s: Ts.Symbol) = let roots = ctx.checker.getRootSymbols(s) |> ResizeArray @@ -194,10 +198,11 @@ module private ParserImpl = let sources = getSources s let fullName = ctx.checker.getFullyQualifiedName s - |> normalizeQualifiedName ctx sources + |> String.split "." + |> List.ofArray let newItems = sources - |> List.map (fun source -> { source = source; name = fullName }) + |> List.map (makeFullName fullName) |> Set.ofList if Set.isSubset newItems acc then acc else @@ -982,7 +987,6 @@ module private ParserImpl = Namespace { name = i.text; isExported = isExported; statements = statements ctx; comments = comments; loc = loc } | ModuleName.StringLiteral s -> let orig = $"\"{s.text}\"" - let ctx = ctx |> JS.cloneWith (fun x -> x.currentAmbientModule <- Some orig) AmbientModule { name = { orig = orig; unquoted = s.text }; isExported = (); statements = statements ctx; comments = comments; loc = loc } and readStatement (ctx: ParserContext) (stmt: Ts.Statement) : Statement list = From 51a8891efacc09688f1acab5f59334e32370dcf8 Mon Sep 17 00:00:00 2001 From: cannorin Date: Tue, 30 Aug 2022 20:27:12 +0900 Subject: [PATCH 10/17] Fix property parsing --- lib/Parser.fs | 12 ++-- lib/Typer.fs | 91 ++++++++++++++++++---------- src/Targets/JsOfOCaml/OCamlHelper.fs | 7 ++- src/Targets/JsOfOCaml/Writer.fs | 2 +- 4 files changed, 75 insertions(+), 37 deletions(-) diff --git a/lib/Parser.fs b/lib/Parser.fs index f7432740..e3264894 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -576,7 +576,8 @@ module private ParserImpl = | UnknownType None -> nodeWarn ctx nd "type not specified for field '%s'" (getText nd.name) | _ -> () - let fl = { name = name; isOptional = false; value = ty } + let isOptional = nd.questionToken |> Option.isSome + let fl = { name = name; isOptional = isOptional; value = ty } attr, Field (fl, (if isReadOnly nd.modifiers then ReadOnly else Mutable)) | Error expr -> readSymbolIndexer expr (Choice1Of2 ty) fail | Kind.PropertyDeclaration -> @@ -592,7 +593,8 @@ module private ParserImpl = | UnknownType None -> nodeWarn ctx nd "type not specified for field '%s'" (getText nd.name) | _ -> () - let fl = { name = name; isOptional = false; value = ty } + let isOptional = nd.questionToken |> Option.isSome + let fl = { name = name; isOptional = isOptional; value = ty } attr, Field (fl, (if isReadOnly nd.modifiers then ReadOnly else Mutable)) | Error _ -> nodeWarn ctx nd "unsupported property name '%s' in PropertyDeclaration" (getText nd.name); (attr, UnknownMember (Some (getText nd))) | Kind.CallSignature -> @@ -639,7 +641,8 @@ module private ParserImpl = | Ok name -> let localTyprm, ty = extractType nd if not (List.isEmpty localTyprm) then nodeWarn ctx nd "getter with type argument is not supported" - let fl = { name = name; isOptional = false; value = ty } + let isOptional = nd.questionToken |> Option.isSome + let fl = { name = name; isOptional = isOptional; value = ty } attr, Getter fl | Error _ -> nodeWarn ctx nd "unsupported property name '%s' in GetAccessor" (getText nd.name); (attr, UnknownMember (Some (getText nd))) | Kind.SetAccessor -> @@ -655,7 +658,8 @@ module private ParserImpl = | Choice1Of2 named -> attr, Setter { named with name = name } | Choice2Of2 ty -> - attr, Setter { name = name; isOptional = false; value = ty } + let isOptional = nd.questionToken |> Option.isSome + attr, Setter { name = name; isOptional = isOptional; value = ty } | _ -> nodeWarn ctx nd "invalid setter for '%s'" (getText nd.name) attr, UnknownMember (Some (getText nd)) diff --git a/lib/Typer.fs b/lib/Typer.fs index e0012172..da5c3f24 100644 --- a/lib/Typer.fs +++ b/lib/Typer.fs @@ -589,19 +589,35 @@ module Type = MultipleLocation (funcs |> List.map (fun f -> f.loc)) ) + let normalizeUnion (u: UnionType) : UnionType = + let rec go ts = + ts |> List.collect (function + | Union u -> go u.types + | t -> [t] + ) + { u with types = go u.types |> List.distinct } + + let normalizeIntersection (i: IntersectionType) : IntersectionType = + let rec go ts = + ts |> List.collect (function + | Intersection i -> go i.types + | t -> [t] + ) + { i with types = go i.types |> List.distinct } + // TODO: more optimization - let createUnion (_ctx: TyperContext<_, _>) (types: Type list) = + let createUnion (types: Type list) = match types with | [] -> Prim Never | [x] -> x - | _ -> Union { types = types } + | _ -> Union (normalizeUnion { types = types }) // TODO: more optimization - let createIntersection (_ctx: TyperContext<_, _>) (types: Type list) = + let createIntersection (types: Type list) = match types with | [] -> Prim Any | [x] -> x - | _ -> Intersection { types = types } + | _ -> Intersection (normalizeIntersection { types = types }) let substTypeVarInInheritingType subst ctx = function | InheritingType.KnownIdent x -> @@ -765,7 +781,7 @@ module Type = let members = c.members |> List.map snd let intersection = function | [] -> None - | ts -> createIntersection ctx ts |> Some + | ts -> createIntersection ts |> Some let rec go = function | TypeLiteral (LString name) -> let funcs, others = @@ -886,7 +902,7 @@ module Type = | _ -> None) match types with | [] -> onFail () - | _ -> createIntersection ctx types + | _ -> createIntersection types | Keyof t -> let t = resolveErasedTypeImpl typeQueries ctx t @@ -1276,32 +1292,32 @@ module Statement = type Class<'a> with /// check if an interface consists only of fields and properties (but not methods) /// - /// setters are ignored + /// setters and indexers are ignored member this.isPOJO : bool = this.isInterface && this.members |> List.exists (fun (_, m) -> match m with Field _ | Getter _ -> true | _ -> false) && this.members - |> List.filter (fun (_, m) -> match m with Setter _ | UnknownMember _ -> false | _ -> true) + |> List.filter (fun (_, m) -> match m with Setter _ | UnknownMember _ | Indexer _ -> false | _ -> true) |> List.forall (fun (_, m) -> match m with | Field _ | Getter _ -> true - | Method _ | Callable _ | Newable _ | Indexer _ | Constructor _ | SymbolIndexer _ -> false - | Setter _ | UnknownMember _ -> true // impossible + | Method _ | Callable _ | Newable _ | Constructor _ | SymbolIndexer _ -> false + | Setter _ | UnknownMember _ | Indexer _ -> true // impossible ) /// check if an interface consists only of fields, properties, and methods (but not callable, newable, etc) /// - /// setters are ignored + /// setters and indexers are ignored member this.isPOJOWithMethods : bool = this.isInterface && this.members |> List.exists (fun (_, m) -> match m with Field _ | Getter _ | Method _ -> true | _ -> false) && this.members - |> List.filter (fun (_, m) -> match m with Setter _ | UnknownMember _ -> false | _ -> true) + |> List.filter (fun (_, m) -> match m with Setter _ | UnknownMember _ | Indexer _ -> false | _ -> true) |> List.forall (fun (_, m) -> match m with | Field _ | Getter _ | Method _ -> true - | Callable _ | Newable _ | Indexer _ | Constructor _ | SymbolIndexer _ -> false - | Setter _ | UnknownMember _ -> true // impossible + | Callable _ | Newable _ | Constructor _ | SymbolIndexer _ -> false + | Setter _ | UnknownMember _ | Indexer _ -> true // impossible ) type [] Typeofable = Number | String | Boolean | Symbol | BigInt @@ -1352,6 +1368,7 @@ module ResolvedUnion = cases |> String.concat " | " let checkNullOrUndefined (u: UnionType) : {| hasNull: bool; hasUndefined: bool; rest: Type list |} = + let u = Type.normalizeUnion u let nullOrUndefined, rest = u.types |> List.partition (function Prim (Null | Undefined) -> true | _ -> false) let hasNull = nullOrUndefined |> List.contains (Prim Null) @@ -1604,6 +1621,15 @@ module ResolvedUnion = resolveUnionMap <- resolveUnionMap |> Map.add u result result +module Member = + let getActualTypeOfFieldLike (fl: FieldLike) = + if fl.isOptional then + Type.createUnion [Prim Undefined; fl.value] + else + match fl.value with + | Union u -> Union (Type.normalizeUnion u) + | t -> t + let inferEnumCaseValue (stmts: Statement list) : Statement list = let rec go = function | Enum e -> @@ -1671,11 +1697,11 @@ let rec mergeStatements (stmts: Statement list) = let i = { i with isInterface = i.isInterface && i'.isInterface - comments = i.comments @ i'.comments |> List.distinct + comments = List.distinct (i.comments @ i'.comments) loc = i.loc ++ i'.loc typeParams = mergeTypeParams i.typeParams i'.typeParams implements = List.distinct (i.implements @ i'.implements) - members = i.members @ i'.members } + members = List.distinct (i.members @ i'.members) } iref'.Value <- i | Namespace n -> match nsMap |> Map.tryFind n.name with @@ -1688,8 +1714,8 @@ let rec mergeStatements (stmts: Statement list) = nref'.Value <- { n with loc = n.loc ++ n'.loc - comments = n.comments @ n'.comments |> List.distinct - statements = n'.statements @ n.statements } + comments = List.distinct (n.comments @ n'.comments) + statements = List.distinct (n'.statements @ n.statements) } | AmbientModule n -> match amMap |> Map.tryFind n.name with | None -> @@ -1702,7 +1728,7 @@ let rec mergeStatements (stmts: Statement list) = { n with loc = n.loc ++ n'.loc comments = n.comments @ n'.comments |> List.distinct - statements = n'.statements @ n.statements } + statements = n'.statements @ n.statements |> List.distinct } | Global n -> match globalM with | None -> @@ -2254,23 +2280,26 @@ let mergeESLibDefinitions (srcs: SourceFile list) = let getESVersionFromFileName (s: string) = let es = s.Split '.' |> Array.tryFind (fun s -> s.StartsWith "es") match es with - | None -> Ts.ScriptTarget.ESNext - | Some "es3" -> Ts.ScriptTarget.ES3 - | Some "es5" -> Ts.ScriptTarget.ES5 - | Some "es6" | Some "es2015" -> Ts.ScriptTarget.ES2015 - | Some "es2016" -> Ts.ScriptTarget.ES2016 - | Some "es2017" -> Ts.ScriptTarget.ES2017 - | Some "es2018" -> Ts.ScriptTarget.ES2018 - | Some "es2019" -> Ts.ScriptTarget.ES2019 - | Some "es2020" -> Ts.ScriptTarget.ES2020 - | Some _ -> Ts.ScriptTarget.ESNext + | None -> Some Ts.ScriptTarget.ESNext + | Some "es3" -> Some Ts.ScriptTarget.ES3 + | Some "es5" -> Some Ts.ScriptTarget.ES5 + | Some "es6" | Some "es2015" -> Some Ts.ScriptTarget.ES2015 + | Some "es2016" -> Some Ts.ScriptTarget.ES2016 + | Some "es2017" -> Some Ts.ScriptTarget.ES2017 + | Some "es2018" -> Some Ts.ScriptTarget.ES2018 + | Some "es2019" -> Some Ts.ScriptTarget.ES2019 + | Some "es2020" -> Some Ts.ScriptTarget.ES2020 + | Some "es2021" -> Some Ts.ScriptTarget.ES2021 + | Some "es2022" -> Some Ts.ScriptTarget.ES2022 + | Some "esnext" -> Some Ts.ScriptTarget.ESNext + | _ -> None let map (parentVersion: Ts.ScriptTarget option) (loc: Location) (x: ICommented<_>) = let esVersion = let rec go = function | UnknownLocation -> None - | LocationTs (sf, _) -> getESVersionFromFileName sf.fileName |> Some - | Location x -> getESVersionFromFileName x.src.fileName |> Some + | LocationTs (sf, _) -> getESVersionFromFileName sf.fileName + | Location x -> getESVersionFromFileName x.src.fileName | MultipleLocation ls -> match ls |> List.choose go with | [] -> None diff --git a/src/Targets/JsOfOCaml/OCamlHelper.fs b/src/Targets/JsOfOCaml/OCamlHelper.fs index a36031b7..fedf3b12 100644 --- a/src/Targets/JsOfOCaml/OCamlHelper.fs +++ b/src/Targets/JsOfOCaml/OCamlHelper.fs @@ -420,11 +420,16 @@ module Kind = Set.intersect kind (Set.ofList [Kind.Type; Kind.ClassLike; Kind.Module]) |> Set.isEmpty |> not let jsBuilder name (fields: {| isOptional: bool; name: string; value: text |} list) (thisType: text) = + let renamer = new OverloadRenamer(used=(fields |> List.map (fun x -> "arg", x.name) |> Set.ofList)) let args = fields + |> List.distinctBy (fun x -> x.name) |> List.map (fun f -> let prefix = if f.isOptional then str "?" else empty - let name = Naming.valueName f.name + let name = + match Naming.valueName f.name with + | "_" -> renamer.Rename "arg" "__" + | name -> name let value = if name = f.name then f.value else diff --git a/src/Targets/JsOfOCaml/Writer.fs b/src/Targets/JsOfOCaml/Writer.fs index 77a67ba7..15c21706 100644 --- a/src/Targets/JsOfOCaml/Writer.fs +++ b/src/Targets/JsOfOCaml/Writer.fs @@ -679,7 +679,7 @@ let rec emitMembers flags overrideFunc ctx (selfTy: Type) (ma: MemberAttribute) let ft = func { ft with args = Choice2Of2 selfTy :: ft.args } |> emitType_ ctx yield! comments () yield overloaded (fun rename -> [val_ (rename "create") ft + str " " + Attr.js_apply true]) - | Field ({ name = name; value = Func (ft, _typrm, _) }, _) + | Field ({ name = name; value = Func (ft, _typrm, _); isOptional = false }, _) | Method (name, ft, _typrm) -> let ty, attr = if ma.isStatic then func ft, Attr.js_global name From e3e94a02803d616ac163038e165d8c81fb5e331d Mon Sep 17 00:00:00 2001 From: cannorin Date: Thu, 1 Sep 2022 20:33:40 +0900 Subject: [PATCH 11/17] Use correct fullname path for auto-inherited types --- lib/Typer.fs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Typer.fs b/lib/Typer.fs index da5c3f24..65d600a5 100644 --- a/lib/Typer.fs +++ b/lib/Typer.fs @@ -1920,12 +1920,12 @@ let introduceAdditionalInheritance (ctx: IContext<#TyperOptions>) (stmts: Statem | _ -> false ) - let inline app t ts loc = + let inline app esVersion t ts loc = App ( AIdent { name = [t] kind = Some (Set.ofList [Kind.Type; Kind.ClassLike; Kind.Statement]) - fullName = [{ name = [t]; source = "lib.es.d.ts" }] + fullName = [{ name = [t]; source = Path.absolute $"./node_modules/typescript/lib/lib.{esVersion}.d.ts" }] loc = loc parent = None }, ts, loc) @@ -1936,35 +1936,35 @@ let introduceAdditionalInheritance (ctx: IContext<#TyperOptions>) (stmts: Statem | SymbolIndexer ("iterator", { returnType = ty }, _) when opts.inheritIterable -> match ty with | App (AIdent { name = ["Iterator"] }, [argTy], _) when not (has "Iterable") -> - inherits.Add(app "Iterable" [argTy] ma.loc) + inherits.Add(app "es2015.iterable" "Iterable" [argTy] ma.loc) | App (AIdent { name = ["IterableIterator"] }, [argTy], _) when not (has "IterableIterator") -> - inherits.Add(app "IterableIterator" [argTy] ma.loc) + inherits.Add(app "es2015.iterable" "IterableIterator" [argTy] ma.loc) | _ -> () // async iterator & iterable iterator | SymbolIndexer ("asyncIterator", { returnType = ty }, _) when opts.inheritIterable -> match ty with | App (AIdent { name = ["AsyncIterator"] }, [argTy], _) when not (has "AsyncIterable") -> - inherits.Add(app "AsyncIterable" [argTy] ma.loc) + inherits.Add(app "es2018.asynciterable" "AsyncIterable" [argTy] ma.loc) | App (AIdent { name = ["AsyncIterableIterator"] }, [argTy], _) when not (has "AsyncIterableIterator") -> - inherits.Add(app "AsyncIterableIterator" [argTy] ma.loc) + inherits.Add(app "es2018.asynciterable" "AsyncIterableIterator" [argTy] ma.loc) | _ -> () // ArrayLike | Indexer ({ args = [Choice1Of2 { value = Prim Number } | Choice2Of2 (Prim Number)]; returnType = retTy }, _) - when opts.inheritArraylike && not (has "ArrayLike") -> inherits.Add(app "ArrayLike" [retTy] ma.loc) + when opts.inheritArraylike && not (has "ArrayLike") -> inherits.Add(app "es5" "ArrayLike" [retTy] ma.loc) // PromiseLike | Method ("then", { args = [Choice1Of2 { name = "onfulfilled"; value = onfulfilled }; Choice1Of2 { name = "onrejected" }] }, _) when opts.inheritPromiselike && not (has "PromiseLike") -> match onfulfilled with | Func ({ args = [Choice1Of2 { value = t } | Choice2Of2 t] }, _, _) -> - inherits.Add(app "PromiseLike" [t] ma.loc) + inherits.Add(app "es5" "PromiseLike" [t] ma.loc) | Union { types = ts } -> for t in ts do match t with | Func ({ args = [Choice1Of2 { value = t } | Choice2Of2 t] }, _, _) -> - inherits.Add(app "PromiseLike" [t] ma.loc) + inherits.Add(app "es5" "PromiseLike" [t] ma.loc) | _ -> () | _ -> () From 38756ca48aa030e93b23660d5153d45ddc3e613d Mon Sep 17 00:00:00 2001 From: cannorin Date: Fri, 2 Sep 2022 18:16:15 +0900 Subject: [PATCH 12/17] Add ident misc data --- lib/Parser.fs | 23 ++++++++++++++++++++++- lib/Syntax.fs | 20 ++++++++++++++++++-- lib/Typer.fs | 1 + src/Targets/JsOfOCaml/Writer.fs | 8 ++++---- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/lib/Parser.fs b/lib/Parser.fs index e3264894..79a4fbc8 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -220,7 +220,7 @@ module private ParserImpl = let kind = getKindFromName ctx nd let loc = Node.location nd let fullName = getFullNames ctx nd - { name = name; kind = kind; fullName = fullName; loc = loc; parent = parent } + { name = name; kind = kind; fullName = fullName; loc = loc; parent = parent; misc = IdentMiscData.Empty } match nd.kind with | Kind.Identifier | Kind.PrivateIdentifier -> let i = nd :?> Ts.Identifier @@ -242,6 +242,25 @@ module private ParserImpl = else readIdent ctx nd |> Choice1Of2 + type DeclarationWithTypeParameters = + inherit Ts.Node + abstract typeParameters: Ts.TypeParameterDeclaration[] option with get + + let getArityOfIdentType (ctx: ParserContext) (nd: Ts.Node) (i: Ident) : Ident = + match ctx.checker.getSymbolAtLocation nd with + | None -> i + | Some symbol -> + let arity = + symbol.declarations + |> Option.toArray + |> Array.concat + |> Array.fold (fun maxArity decl -> + match (decl :?> DeclarationWithTypeParameters).typeParameters with + | Some tps when tps.Length > maxArity -> tps.Length + | _ -> maxArity + ) 0 + { i with misc = { i.misc with maxArity = Some arity } } + let sanitizeCommentText str : string list = str |> String.toLines |> List.ofArray @@ -393,8 +412,10 @@ module private ParserImpl = | Kind.TypeReference -> !!(t :?> Ts.TypeReferenceNode).typeName | Kind.ExpressionWithTypeArguments -> !!(t :?> Ts.ExpressionWithTypeArguments).expression | _ -> impossible "readTypeNode_TypeReference" + let arity = getArityOfIdentType ctx lhs match readIdentOrTypeVar ctx typrm lhs with | Choice1Of2 lt -> + let lt = lt |> getArityOfIdentType ctx lhs match t.typeArguments with | None -> Ident lt | Some args -> App (AIdent lt, args |> Array.map (readTypeNode typrm ctx) |> List.ofArray, Node.location t) diff --git a/lib/Syntax.fs b/lib/Syntax.fs index d68e38c4..0e4cb6e8 100644 --- a/lib/Syntax.fs +++ b/lib/Syntax.fs @@ -199,13 +199,29 @@ and TupleType = { isReadOnly: bool } -and Ident = { +and IdentMiscData = { + maxArity: int option + /// if true, then this ident was created by ts2ocaml. + /// otherwise, then this ident came from `.d.ts`. + internallyCreated: bool +} with + static member Empty = { + maxArity = None + internallyCreated = false + } + static member Internal = { IdentMiscData.Empty with internallyCreated = true } + +and [] Ident = { name: string list kind: Set option fullName: FullName list loc: Location parent: Ident option -} + misc: IdentMiscData +} with + member i.AsString = + String.concat "." i.name + " (at " + i.loc.AsString + ")" + override i.ToString() = i.AsString and [] FullName = { source: Path.Absolute diff --git a/lib/Typer.fs b/lib/Typer.fs index 65d600a5..68f83c43 100644 --- a/lib/Typer.fs +++ b/lib/Typer.fs @@ -1928,6 +1928,7 @@ let introduceAdditionalInheritance (ctx: IContext<#TyperOptions>) (stmts: Statem fullName = [{ name = [t]; source = Path.absolute $"./node_modules/typescript/lib/lib.{esVersion}.d.ts" }] loc = loc parent = None + misc = { IdentMiscData.Internal with maxArity = Some (List.length ts) } }, ts, loc) for ma, m in c.members do diff --git a/src/Targets/JsOfOCaml/Writer.fs b/src/Targets/JsOfOCaml/Writer.fs index 15c21706..3260ea1e 100644 --- a/src/Targets/JsOfOCaml/Writer.fs +++ b/src/Targets/JsOfOCaml/Writer.fs @@ -755,11 +755,11 @@ let rec emitMembers flags overrideFunc ctx (selfTy: Type) (ma: MemberAttribute) let emitMappers (ctx: Context) emitType tName (typrms: TypeParam list) = let t = - { name = [tName]; fullName = []; kind = None; loc = UnknownLocation; parent = None } + { name = [tName]; fullName = []; kind = None; loc = UnknownLocation; parent = None; misc = IdentMiscData.Internal } let t_ty = if List.isEmpty typrms then Ident t else App (AIdent t, typrms |> List.map (fun typrm -> TypeVar typrm.name), UnknownLocation) - let ojs_t = { name = ["Ojs"; "t"]; fullName = []; kind = None; loc = UnknownLocation; parent = None } + let ojs_t = { name = ["Ojs"; "t"]; fullName = []; kind = None; loc = UnknownLocation; parent = None; misc = IdentMiscData.Internal } let ojs_t_ty = Ident ojs_t let orf _flags _emitType _ctx ty = match ty with @@ -880,7 +880,7 @@ module GetSelfTyText = let getExportFromStatement (ctx: Context) (name: string) (kind: Kind list) (kindString: string) (s: Statement) : ExportItem option = let fn = ctx |> Context.getFullName [name] - let ident = { name = [name]; fullName = [fn]; kind = Some (Set.ofList kind); parent = None; loc = s.loc } + let ident = { name = [name]; fullName = [fn]; kind = Some (Set.ofList kind); parent = None; loc = s.loc; misc = IdentMiscData.Internal } match s.isExported.AsExport ident with | None -> None | Some clause -> @@ -917,7 +917,7 @@ let rec emitClass flags overrideFunc (ctx: Context) (current: StructuredText) (c match c.name with | Choice1Of2 (Name n) -> let k = ctx |> Context.getFullName [n] - let ident = { name = [n]; fullName = [k]; kind = Some (Set.ofList Kind.OfClass); parent = None; loc = UnknownLocation } + let ident = { name = [n]; fullName = [k]; kind = Some (Set.ofList Kind.OfClass); parent = None; loc = UnknownLocation; misc = IdentMiscData.Internal } let selfTy = if List.isEmpty c.typeParams then Ident ident else App (AIdent ident, typrms, UnknownLocation) From ce6ea450676f9cf8e387c13ce1813de722be18b8 Mon Sep 17 00:00:00 2001 From: cannorin Date: Fri, 2 Sep 2022 19:23:43 +0900 Subject: [PATCH 13/17] Deprecate --safe-arity --- build.fsx | 2 +- docs/js_of_ocaml.md | 163 ++++++++++++++------------------ lib/Typer.fs | 11 ++- src/Extensions.fs | 2 + src/Targets/JsOfOCaml/Common.fs | 21 ++-- src/Targets/JsOfOCaml/Writer.fs | 32 +++---- 6 files changed, 108 insertions(+), 123 deletions(-) diff --git a/build.fsx b/build.fsx index b4a1482c..6a77182a 100644 --- a/build.fsx +++ b/build.fsx @@ -143,7 +143,7 @@ module Test = "safe", !! "node_modules/@types/yargs-parser/index.d.ts", []; "safe", !! "node_modules/@types/yargs/index.d.ts", ["--rec-module=off"]; - "minimal", !! "node_modules/@types/vscode/index.d.ts", ["--safe-arity=full"; "--readable-names"]; + "minimal", !! "node_modules/@types/vscode/index.d.ts", ["--readable-names"]; ] for preset, package, additionalOptions in packages do diff --git a/docs/js_of_ocaml.md b/docs/js_of_ocaml.md index 2245012d..126e642d 100644 --- a/docs/js_of_ocaml.md +++ b/docs/js_of_ocaml.md @@ -318,7 +318,7 @@ Specify the preset to use. * `--preset=minimal` - It sets `--simplify=all` and `--rec-module=optimized`. * `--preset=safe` - - It sets `--safe-arity=full` and `--subtyping=cast-function`. + - It sets `--subtyping=cast-function`. - It also sets all the options `--preset=minimal` sets. * `--preset=full` - It sets `--inherit-with-tags=full` and `--subtyping=tag`. @@ -577,98 +577,8 @@ Otherwise, you can't safely cast `B.t` to `A.t`. To do it, you will have to * set [`--subtyping=cast-function`](#feature-cast-function) to obtain `val cast_to_A: t -> A.t`, or * manually add `` `A `` to the definition of `B.t` (and `B.tags` if you choose to provide). -> **Note:** `TypeName.tags` types will come with the "arity-safe" version of them if [`--safe-arity`](#--safe-arity) is also set. - # Code Generator Options -## `--safe-arity` - -Use `TypeName.t_n` type names to safely use overloaded types from other packages. - -* `--safe-arity=full` - - It generates `t_n` types in the module, and tries to use `t_n` type if the type is unknown (e.g. from another package). -* `--safe-arity=provide` - - It only generates `t_n` types in the module. -* `--safe-arity=consume` - - It only tries to use `t_n` type if the type is unknown. -* `--safe-arity=off` (default) - - It disables any usage of `t_n` types. - -For example, assume we have `node_modules/foo/index.d.ts` and `node_modules/bar/index.d.ts` as the following: - -```typescript -// foo/index.d.ts - -declare namespace foo { - interface A { ... } - - interface B { ... } -} - -export = foo; -``` - -```typescript -// bar/index.d.ts - -import * as Foo from 'foo'; - -declare function useA(a: Foo.A) : void; - -declare function useB(b: Foo.B) : void; - -declare function useBDefault(b: Foo.B) : void; -``` - -Then the outputs will look like depending on the option you set: - -```ocaml -(* Foo.mli *) - -module Foo : sig - module A : sig - type 'T t = [`A of 'T] intf - - (* this will be generated if `full` or `provide` is set *) - type 'T t_1 = 'T t (* for arity 1 *) - - ... - end - - module B : sig - type 'T t = [`B of 'T] intf - - (* this will be generated if `full` or `provide` is set *) - type 'T t_1 = 'T t (* for arity 1 *) - - (* this will be generated regardless of the option, since B contains an optional type parameter *) - type t_0 = any t (* for arity 0 *) - - ... - end -end - -(* export = foo; *) -module Export = Foo -``` - -```ocaml -(* Bar.mli *) - -(* import * as Foo from "foo"; *) -module Foo = Foo.Export - -(* if `full` or `consume` is set, this will be generated *) -val useA: 'T Foo.A.t_1 -> unit -val useB: 'T Foo.B.t_1 -> unit -val useBDefault: Foo.B.t_0 -> unit - -(* otherwise, this will be generated *) -val useA: 'T Foo.A.t -> unit -val useB: 'T Foo.B.t -> unit -val useBDefault: Foo.B.t -> unit (* this does not compile! *) -``` - ## `--rec-module` Use recursive modules to simplify the output. Can impact the compilation time. @@ -1093,3 +1003,74 @@ end > end > end > ``` + +# Deprecated Options in v2 + +## `--safe-arity` (deprecated) + +~~Use `TypeName.t_n` type names to safely use overloaded types from other packages.~~ + +From v2, `ts2ocaml` uses TypeScript API to check if a generic type has optional type parameters, +and generates the minimum type-safe output. This option is deprecated because the current behavior is the optimal. + +For example, assume we have `node_modules/foo/index.d.ts` and `node_modules/bar/index.d.ts` as the following: + +```typescript +// foo/index.d.ts + +declare namespace foo { + interface A { ... } + + interface B { ... } +} + +export = foo; +``` + +```typescript +// bar/index.d.ts + +import * as Foo from 'foo'; + +declare function useA(a: Foo.A) : void; + +declare function useB(b: Foo.B) : void; + +declare function useBDefault(b: Foo.B) : void; +``` + +Then the outputs will look like this: + +```ocaml +(* Foo.mli *) + +module Foo : sig + module A : sig + type 'T t = [`A of 'T] intf + + ... + end + + module B : sig + type 'T t = [`B of 'T] intf + + type t_0 = any t + + ... + end +end + +(* export = foo; *) +module Export = Foo +``` + +```ocaml +(* Bar.mli *) + +(* import * as Foo from "foo"; *) +module Foo = Foo.Export + +val useA: 'T Foo.A.t -> unit +val useB: 'T Foo.B.t -> unit +val useBDefault: Foo.B.t_0 -> unit +``` diff --git a/lib/Typer.fs b/lib/Typer.fs index 68f83c43..c1b06a6c 100644 --- a/lib/Typer.fs +++ b/lib/Typer.fs @@ -58,7 +58,7 @@ type [] InheritingType = | KnownIdent of {| fullName: FullName; tyargs: Type list |} | Prim of PrimType * tyargs:Type list | Other of Type - | UnknownIdent of {| name: string list; tyargs: Type list |} + | UnknownIdent of {| name: string list; tyargs: Type list; maxArity: int option |} type AnonymousInterfaceOrigin = { // the name of the type containing the anonymous interface. @@ -656,10 +656,10 @@ module Type = |> Seq.map (fun (t, d) -> substTypeVarInInheritingType subst ctx t, d) |> Some | _ -> None ) |> Seq.concat - | Ident { name = name } & Dummy ts | App (AIdent { name = name }, ts, _) -> + | Ident { name = name; misc = misc } & Dummy ts | App (AIdent { name = name; misc = misc }, ts, _) -> yield! treatPrimTypeInterfaces name ts |> Option.toList if includeSelf then - yield InheritingType.UnknownIdent {| name = name; tyargs = ts |}, depth + yield InheritingType.UnknownIdent {| name = name; tyargs = ts; maxArity = misc.maxArity |}, depth | Prim p & Dummy ts | App (APrim p, ts, _) -> if includeSelf then @@ -688,7 +688,10 @@ module Type = |> List.choose (function | Definition.Class c -> let self = - InheritingType.KnownIdent {| fullName = fn; tyargs = c.typeParams |> List.map (fun tp -> TypeVar tp.name) |} + InheritingType.KnownIdent {| + fullName = fn + tyargs = c.typeParams |> List.map (fun tp -> TypeVar tp.name) + |} let s = c.implements |> Seq.collect (getAllInheritancesImpl (depth+1) true ctx) Some (s, Some self) | Definition.TypeAlias a -> diff --git a/src/Extensions.fs b/src/Extensions.fs index 352c599d..3eadb51d 100644 --- a/src/Extensions.fs +++ b/src/Extensions.fs @@ -82,3 +82,5 @@ type Argv<'T> with | None -> failwithf "Unknown value '%s' for option '%s'" s key) |> Array.toList) :> Argv<'U> + member this.addDeprecated (key: string, ?msg) = + this.deprecateOption(key, ?msg=msg) diff --git a/src/Targets/JsOfOCaml/Common.fs b/src/Targets/JsOfOCaml/Common.fs index 1096d358..fc09e543 100644 --- a/src/Targets/JsOfOCaml/Common.fs +++ b/src/Targets/JsOfOCaml/Common.fs @@ -87,7 +87,6 @@ type Options = abstract subtyping: Subtyping list with get, set abstract inheritWithTags: FeatureFlag with get, set abstract recModule: RecModule with get, set - abstract safeArity: FeatureFlag with get, set abstract simplify: Simplify list with get, set abstract readableNames: bool with get, set abstract functor: Functor with get, set @@ -115,8 +114,6 @@ module Options = opts.recModule <- RecModule.Optimized if p = Preset.Safe || p = Preset.Full then - if opts.safeArity = FeatureFlag.Default then - opts.safeArity <- FeatureFlag.Full if subtypingIsDefault then opts.subtyping <- Subtyping.CastFunction :: opts.subtyping @@ -215,12 +212,6 @@ module Options = "functor" ], "Code Generator Options:") - .addChoice( - "safe-arity", - FeatureFlag.Values, - (fun (o: Options) -> o.safeArity), - descr="Use `TypeName.t_n` type names to safely use overloaded types from other packages.", - defaultValue=FeatureFlag.Default) .addChoice( "rec-module", RecModule.Values, @@ -248,6 +239,18 @@ module Options = defaultValue=Functor.On ) + .group( + !^ResizeArray[ + "safe-arity"; + ], + "Deprecated Options:") + .addOption( + "safe-arity", + (fun (o: Options) -> ""), + descr="Use `TypeName.t_n` type names to safely use overloaded types from other packages.", + defaultValue="") + .addDeprecated("safe-arity", "now optimal by default.") + .middleware(!^validate) diff --git a/src/Targets/JsOfOCaml/Writer.fs b/src/Targets/JsOfOCaml/Writer.fs index 3260ea1e..3d9fed81 100644 --- a/src/Targets/JsOfOCaml/Writer.fs +++ b/src/Targets/JsOfOCaml/Writer.fs @@ -206,10 +206,9 @@ let rec emitTypeImpl (flags: EmitTypeFlags) (overrideFunc: OverrideFunc) (ctx: C let tyName = let fallback () = let tyName = - match ctx.options.safeArity with - | FeatureFlag.Full | FeatureFlag.Consume -> - Naming.createTypeNameOfArity arity None "t" - | _ -> "t" + if Option.isSome i.misc.maxArity then + Naming.createTypeNameOfArity arity i.misc.maxArity "t" + else "t" Naming.structured Naming.moduleName i.name + "." + tyName |> str match i.name with | [name] -> @@ -495,13 +494,12 @@ and getLabelsFromInheritingTypes (flags: EmitTypeFlags) (overrideFunc: OverrideF | [] -> str (Naming.constructorName name) | [arg] -> tprintf "%s of %A" (Naming.constructorName name) arg | _ -> tprintf "%s of %A" (Naming.constructorName name) (Type.tuple args) - let emitTagType name args = + let emitTagType name args maxArity = let arity = List.length args let tagTypeName = - if ctx.options.safeArity.HasConsume then - Naming.createTypeNameOfArity arity None "tags" - else - "tags" + if Option.isSome maxArity then + Naming.createTypeNameOfArity arity maxArity "tags" + else "tags" let ty = Naming.structured Naming.moduleName name + "." + tagTypeName let args = args |> List.map (emitType_ ctx) Type.appOpt (str ty) args @@ -511,7 +509,7 @@ and getLabelsFromInheritingTypes (flags: EmitTypeFlags) (overrideFunc: OverrideF | InheritingType.KnownIdent i -> yield str pv_head + emitCase i.fullName.name (i.tyargs |> List.map (emitType_ ctx)) |> Case | InheritingType.UnknownIdent i -> - yield emitTagType i.name i.tyargs |> TagType + yield emitTagType i.name i.tyargs i.maxArity |> TagType | InheritingType.Prim (p, ts) -> match p.AsJSClassName with | Some name -> @@ -535,7 +533,11 @@ and getLabelOfFullName flags overrideFunc (ctx: Context) (fullName: FullName) (t let prim = Type.nonJsablePrimitives |> Map.find name Choice2Of2 (prim, Case (tprintf "%s%s" pv_head name)) | _ -> - let inheritingType = InheritingType.KnownIdent {| fullName = fullName; tyargs = typeParams |> List.map (fun tp -> TypeVar tp.name) |} + let inheritingType = + InheritingType.KnownIdent {| + fullName = fullName + tyargs = typeParams |> List.map (fun tp -> TypeVar tp.name) + |} getLabelsFromInheritingTypes flags overrideFunc ctx (Set.singleton inheritingType) |> Choice1Of2 type StructuredTextItem = @@ -801,7 +803,7 @@ let emitTypeAliasesImpl let arities = getPossibleArity typrms let maxArity = List.length tyargs for arity in arities |> Set.toSeq |> Seq.sortDescending do - if arity <> maxArity || ctx.options.safeArity.HasProvide then + if arity <> maxArity then let name = Naming.createTypeNameOfArity arity None baseName let tyargs' = List.take arity tyargs let typrms' = List.take arity typrms @@ -965,11 +967,6 @@ let rec emitClass flags overrideFunc (ctx: Context) (current: StructuredText) (c | ClassKind.NormalClass x -> Context.ofChildNamespace x.name | ClassKind.AnonymousInterface x -> Context.ofChildNamespace x.name | ClassKind.ExportDefaultClass _ -> id) - |> Context.mapOptions (fun options -> - if not isAnonymous then options - else - // no need to generate t_n types for anonymous interfaces - ctx.options |> JS.cloneWith (fun o -> o.safeArity <- o.safeArity.WithProvide(false))) let typrms = List.map (fun (tp: TypeParam) -> tprintf "'%s" tp.name) c.typeParams let selfTyText = Type.appOpt (str "t") typrms let currentNamespace = innerCtx |> Context.getFullName [] @@ -1909,7 +1906,6 @@ let emitStdlib (input: Input) (ctx: IContext) : Output list = let opts = ctx.options opts.simplify <- [Simplify.All] opts.inheritWithTags <- FeatureFlag.Full - opts.safeArity <- FeatureFlag.Full opts.recModule <- RecModule.Optimized opts.subtyping <- [Subtyping.Tag] opts.functor <- Functor.On From 745c88f969a42429e228a23863495e10698bbf25 Mon Sep 17 00:00:00 2001 From: cannorin Date: Mon, 5 Sep 2022 20:27:14 +0900 Subject: [PATCH 14/17] Externalize DependencyTrie from writer --- lib/DataTypes/Graph.fs | 50 +++++++++++++-- src/Targets/JsOfOCaml/Writer.fs | 105 ++++++++++---------------------- 2 files changed, 77 insertions(+), 78 deletions(-) diff --git a/lib/DataTypes/Graph.fs b/lib/DataTypes/Graph.fs index 54e0da7f..db138e40 100644 --- a/lib/DataTypes/Graph.fs +++ b/lib/DataTypes/Graph.fs @@ -117,7 +117,49 @@ module Graph = ordering.[group] <- order; ordering ) (Array.zeroCreate (List.length groups)) - xs - |> List.groupBy (fun s -> Map.find s cmps) - |> List.sortBy (fun (i, _) -> sortedGroups.[i]) - |> List.map (snd >> List.sort) + let result = + xs + |> List.groupBy (fun s -> Map.find s cmps) + |> List.sortBy (fun (i, _) -> sortedGroups.[i]) + |> List.map snd +#if DEBUG + assert (Set.ofList xs = Set.ofList (List.concat result)) +#endif + result + +type DependencyTrie<'k when 'k: comparison> = Trie<'k, 'k list list> + +module DependencyTrie = + open Ts2Ml.Extensions + + let ofTrie (getReferences: 'v -> WeakTrie<'k>) (trie: Trie<'k, 'v>) : DependencyTrie<'k> = + let refTrieMap = new MutableMap<'k list, WeakTrie<'k>>() + let rec getRefTrie nsRev (x: Trie<'k, 'v>) = + match refTrieMap.TryGetValue(nsRev) with + | true, wt -> wt + | false, _ -> + let wtCurrent = + x.value + |> Option.map getReferences + |? WeakTrie.empty + let wt = + x.children + |> Map.fold (fun state k child -> WeakTrie.union state (getRefTrie (k :: nsRev) child)) wtCurrent + |> WeakTrie.remove (List.rev nsRev) + refTrieMap[nsRev] <- wt + wt + let getDeps nsRev (x: Trie<'k, 'v>) : ('k * 'k) list = + x.children + |> Map.fold (fun state k child -> + let refs = + getRefTrie (k :: nsRev) child + |> WeakTrie.getSubTrie (List.rev nsRev) |? WeakTrie.empty + |> WeakTrie.ofDepth 1 |> WeakTrie.toList + |> List.choose (function [x] -> Some (k, x) | _ -> None (* should be impossible *)) + refs :: state) [] + |> List.rev |> List.concat + let rec go nsRev (x: Trie<'k, 'v>) : DependencyTrie<'k> = + let g = getDeps nsRev x |> Graph.ofEdges + let scc = Graph.stronglyConnectedComponents g (x.children |> Map.toList |> List.map fst) + { value = Some scc; children = x.children |> Map.map (fun k child -> go (k :: nsRev) child) } + go [] trie diff --git a/src/Targets/JsOfOCaml/Writer.fs b/src/Targets/JsOfOCaml/Writer.fs index 3d9fed81..4dcdc3a7 100644 --- a/src/Targets/JsOfOCaml/Writer.fs +++ b/src/Targets/JsOfOCaml/Writer.fs @@ -579,6 +579,7 @@ and StructuredText = Trie module StructuredTextNode = let empty : StructuredTextNode = {| scoped = Scoped.No; items = []; docCommentLines = []; exports = []; knownTypes = Set.empty; anonymousInterfaces = Set.empty |} + let union (a: StructuredTextNode) (b: StructuredTextNode) : StructuredTextNode = {| scoped = Scoped.union a.scoped b.scoped items = List.append a.items b.items @@ -587,70 +588,21 @@ module StructuredTextNode = knownTypes = Set.union a.knownTypes b.knownTypes anonymousInterfaces = Set.union a.anonymousInterfaces b.anonymousInterfaces |} + let getReferences (ctx: Context) (v: StructuredTextNode) : WeakTrie = + v.knownTypes + |> Set.fold (fun state -> function + | KnownType.Ident fn when fn.source = ctx.currentSourceFile -> state |> WeakTrie.add fn.name + | KnownType.AnonymousInterface (_, i) -> + state |> WeakTrie.add (i.namespace_ @ [anonymousInterfaceModuleName ctx i]) + | _ -> state + ) WeakTrie.empty + module StructuredTextItem = let emit renamer = function | ImportText t | TypeDef t | ScopeIndependent t -> [t] | Functor _ -> [] | OverloadedText f -> f renamer - -module StructuredText = - let pp (x: StructuredText) = - let rec go (x: StructuredText) = - concat newline [ - for k, v in x.children |> Map.toArray do - tprintf "- %s" k - indent (go v) - ] - go x - - let rec getReferences (ctx: Context) (x: StructuredText) : WeakTrie = - match ctx.state.referencesCache.TryGetValue(ctx.currentNamespace) with - | true, ts -> ts - | false, _ -> - let fn = ctx.currentNamespace - let trie = - x.value - |> Option.map (fun v -> - v.knownTypes - |> Set.fold (fun state -> function - | KnownType.Ident fn when fn.source = ctx.currentSourceFile -> state |> WeakTrie.add fn.name - | KnownType.AnonymousInterface (_, i) -> - state |> WeakTrie.add (i.namespace_ @ [anonymousInterfaceModuleName ctx i]) - | _ -> state - ) WeakTrie.empty) - |? WeakTrie.empty - let trie = - x.children - |> Map.fold (fun state k child -> - WeakTrie.union state (getReferences (ctx |> Context.ofChildNamespace k) child)) trie - |> WeakTrie.remove fn - ctx.state.referencesCache.[fn] <- trie - trie - - let getDependenciesOfChildren (ctx: Context) (x: StructuredText) : (string * string) list = - let parent = ctx.currentNamespace - x.children - |> Map.fold (fun state k child -> - let refs = - getReferences (ctx |> Context.ofChildNamespace k) child - |> WeakTrie.getSubTrie parent - |? WeakTrie.empty - |> WeakTrie.ofDepth 1 - |> WeakTrie.toList - |> List.map (function - | [x] -> k, x - | xs -> impossible "StructuredText_getDependencyGraphOfChildren_refs(%s): %A" (ctx |> Context.getFullNameString [k]) xs) - refs :: state) [] - |> List.rev - |> List.concat - - let calculateSCCOfChildren (ctx: Context) (x: StructuredText) : string list list = - let g = - let deps = getDependenciesOfChildren ctx x - Graph.ofEdges deps - Graph.stronglyConnectedComponents g (x.children |> Map.toList |> List.map fst) - let removeLabels (xs: Choice list) = xs |> List.map (function Choice2Of2 t -> Choice2Of2 t | Choice1Of2 fl -> Choice2Of2 fl.value) @@ -1607,26 +1559,30 @@ let createStructuredText (rootCtx: Context) (stmts: Statement list) : Structured stmts |> List.fold (folder rootCtx) Trie.empty -type ModuleEmitter = Context -> StructuredText -> (TextModuleSig list -> text list) +type ModuleEmitter = Context -> (TextModuleSig list -> text list) module ModuleEmitter = - let nonRec _ctx _st modules = moduleSigNonRec modules - let recAll _ctx _st modules = moduleSigRec modules - let recOptimized (ctx: Context) (st: StructuredText) = - if Map.count st.children < 3 then - recAll ctx st - else - let scc = StructuredText.calculateSCCOfChildren ctx st - fun (modules: TextModuleSig list) -> - let modules = modules |> List.fold (fun state x -> state |> Map.add x.origName x) Map.empty + let nonRec _ctx modules = moduleSigNonRec modules + let recAll _ctx modules = moduleSigRec modules + let recOptimized dt (ctx: Context) = + let scc = dt |> Trie.tryFind ctx.currentNamespace |? [] + let sccSet = scc |> List.concat |> Set.ofList + fun (modules: TextModuleSig list) -> + let modulesMap = modules |> List.fold (fun state x -> state |> Map.add x.origName x) Map.empty + let sccModules = scc |> List.map (fun group -> - group |> List.map (fun name -> modules |> Map.find name) |> moduleSigRec) + group |> List.choose (fun name -> modulesMap |> Map.tryFind name) |> moduleSigRec) |> List.concat - let fromOption (opt: Options) = + let otherModules = + modules + |> List.filter (fun x -> sccSet |> Set.contains x.origName |> not) + |> moduleSigNonRec + sccModules @ otherModules + let create (dt: DependencyTrie) (opt: Options) : ModuleEmitter = match opt.recModule with | RecModule.Off | RecModule.Default -> nonRec | RecModule.Naive -> recAll - | RecModule.Optimized -> recOptimized + | RecModule.Optimized -> recOptimized dt type ExportWithKind = {| comments: Comment list; clauses: (ExportClause * Set) list; loc: Location; origText: string |} @@ -1655,7 +1611,7 @@ let rec private emitStructuredText (reserved: bool) (moduleEmitter: ModuleEmitte docCommentBody = result.docCommentBody |} ) - let emitModules = moduleEmitter ctx st + let emitModules = moduleEmitter ctx let imports, typedefs, items, functors, docCommentBody = match st.value with | None -> [], [], [], [], [] @@ -1742,7 +1698,7 @@ and emitExportModule (moduleEmitter: ModuleEmitter) (ctx: Context) (exports: Exp go isFirst acc rest let st = go true Trie.empty exports - let emitted = st |> emitStructuredText true moduleEmitter ctx + let emitted = st |> emitStructuredText true ModuleEmitter.nonRec ctx // add newline if not empty if not (List.isEmpty emitted.content) then empty :: emitted.content @@ -1839,7 +1795,8 @@ let emitFlattenedDefinitions (ctx: Context) (stmts: Statement list) : text list ] let emitStatementsWithStructuredText (ctx: Context) (stmts: Statement list) (st: StructuredText) = - let moduleEmitter = ModuleEmitter.fromOption ctx.options + let dt = DependencyTrie.ofTrie (StructuredTextNode.getReferences ctx) st + let moduleEmitter = ModuleEmitter.create dt ctx.options let result = st |> emitStructuredText false moduleEmitter ctx let imports = if List.isEmpty result.imports then [] From e22ee3464a39e320ee13dd5c57021ccf5db23c0f Mon Sep 17 00:00:00 2001 From: cannorin Date: Mon, 3 Oct 2022 18:48:24 +0900 Subject: [PATCH 15/17] Upgrade to TypeScript 4.8 --- lib/Bindings/TypeScript.fs | 563 ++++++++++++++++++++++++++----------- lib/Parser.fs | 26 +- package.json | 2 +- yarn.lock | 8 +- 4 files changed, 418 insertions(+), 181 deletions(-) diff --git a/lib/Bindings/TypeScript.fs b/lib/Bindings/TypeScript.fs index 62e152d0..fcb47780 100644 --- a/lib/Bindings/TypeScript.fs +++ b/lib/Bindings/TypeScript.fs @@ -1,4 +1,4 @@ -// ts2fable 0.8.0-build.658 +// ts2fable 0.8.0-build.664 module rec TypeScript #nowarn "3390" // disable warnings for invalid XML comments @@ -51,7 +51,7 @@ module Ts = abstract isIdentifierPart: ch: float * languageVersion: ScriptTarget option * ?identifierVariant: LanguageVariant -> bool abstract createScanner: languageVersion: ScriptTarget * skipTrivia: bool * ?languageVariant: LanguageVariant * ?textInitial: string * ?onError: ErrorCallback * ?start: float * ?length: float -> Scanner abstract isExternalModuleNameRelative: moduleName: string -> bool - abstract sortAndDeduplicateDiagnostics: diagnostics: 'T[] -> SortedReadonlyArray<'T> when 'T :> Diagnostic + abstract sortAndDeduplicateDiagnostics: diagnostics: 'T[] -> SortedReadonlyArray<'T> abstract getDefaultLibFileName: options: CompilerOptions -> string abstract textSpanEnd: span: TextSpan -> float abstract textSpanIsEmpty: span: TextSpan -> bool @@ -73,7 +73,7 @@ module Ts = /// Called to merge all the changes that occurred across several versions of a script snapshot /// into a single change. i.e. if a user keeps making successive edits to a script we will /// have a text change from V1 to V2, V2 to V3, ..., Vn. - /// + /// /// This function will then merge those changes into a single change range valid between V1 and /// Vn. abstract collapseTextChangeRangesAcrossMultipleVersions: changes: TextChangeRange[] -> TextChangeRange @@ -88,14 +88,14 @@ module Ts = /// and if it is, attempts to set the appropriate language. abstract validateLocaleAndSetLanguage: locale: string * sys: {| getExecutingFilePath: unit -> string; resolvePath: string -> string; fileExists: string -> bool; readFile: string -> string option |} * ?errors: Push -> unit abstract getOriginalNode: node: Node -> Node - abstract getOriginalNode: node: Node * nodeTest: (Node -> bool) -> 'T when 'T :> Node + abstract getOriginalNode: node: Node * nodeTest: (Node -> bool) -> 'T abstract getOriginalNode: node: Node option -> Node option - abstract getOriginalNode: node: Node option * nodeTest: (Node option -> bool) -> 'T option when 'T :> Node + abstract getOriginalNode: node: Node option * nodeTest: (Node option -> bool) -> 'T option /// Iterates through the parent chain of a node and performs the callback on each parent until the callback /// returns a truthy value, then returns that value. /// If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" /// At that point findAncestor returns undefined. - abstract findAncestor: node: Node option * callback: (Node -> bool) -> 'T option when 'T :> Node + abstract findAncestor: node: Node option * callback: (Node -> bool) -> 'T option abstract findAncestor: node: Node option * callback: (Node -> U2) -> Node option /// Gets a value indicating whether a node originated in the parse tree. /// The node to test. @@ -108,7 +108,7 @@ module Ts = /// The original node. /// A callback used to ensure the correct type of parse tree node is returned. /// The original parse tree node if found; otherwise, undefined. - abstract getParseTreeNode: node: 'T option * ?nodeTest: (Node -> bool) -> 'T option when 'T :> Node + abstract getParseTreeNode: node: 'T option * ?nodeTest: (Node -> bool) -> 'T option /// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' abstract escapeLeadingUnderscores: identifier: string -> __String /// Remove extra underscore from escaped identifier text content. @@ -119,6 +119,8 @@ module Ts = abstract symbolName: symbol: Symbol -> string abstract getNameOfJSDocTypedef: declaration: JSDocTypedefTag -> U2 option abstract getNameOfDeclaration: declaration: U2 option -> DeclarationName option + abstract getDecorators: node: HasDecorators -> Decorator[] option + abstract getModifiers: node: HasModifiers -> Modifier[] option /// Gets the JSDoc parameter tags for the node if present. /// /// Returns any JSDoc param tag whose name matches the provided @@ -127,7 +129,7 @@ module Ts = /// initializer is the containing function. The tags closest to the /// node are returned first, so in the previous example, the param /// tag on the containing function expression would be first. - /// + /// /// For binding patterns, parameter tags are matched by position. /// abstract getJSDocParameterTags: param: ParameterDeclaration -> JSDocParameterTag[] @@ -194,7 +196,7 @@ module Ts = /// Get all JSDoc tags related to a node, including those on parent nodes. abstract getJSDocTags: node: Node -> JSDocTag[] /// Gets all JSDoc tags that match a specified predicate - abstract getAllJSDocTags: node: Node * predicate: (JSDocTag -> bool) -> 'T[] when 'T :> JSDocTag + abstract getAllJSDocTags: node: Node * predicate: (JSDocTag -> bool) -> 'T[] /// Gets all JSDoc tags of a specified kind abstract getAllJSDocTagsOfKind: node: Node * kind: SyntaxKind -> JSDocTag[] /// Gets the text of a jsdoc comment, flattening links to their text. @@ -202,6 +204,12 @@ module Ts = /// /// Gets the effective type parameters. If the node was parsed in a /// JavaScript file, gets the type parameters from the @template tag from JSDoc. + /// + /// This does *not* return type parameters from a jsdoc reference to a generic type, eg + /// + /// type Id = <T>(x: T) => T + /// /** @type {Id} / + /// function id(x) { return x } /// abstract getEffectiveTypeParameterDeclarations: node: DeclarationWithTypeParameters -> TypeParameterDeclaration[] abstract getEffectiveConstraintOfTypeParameter: node: TypeParameterDeclaration -> TypeNode option @@ -243,6 +251,7 @@ module Ts = abstract isClassElement: node: Node -> bool abstract isClassLike: node: Node -> bool abstract isAccessor: node: Node -> bool + abstract isModifierLike: node: Node -> bool abstract isTypeElement: node: Node -> bool abstract isClassOrTypeElement: node: Node -> bool abstract isObjectLiteralElementLike: node: Node -> bool @@ -270,6 +279,8 @@ module Ts = abstract isObjectLiteralElement: node: Node -> bool abstract isStringLiteralLike: node: Node -> bool abstract isJSDocLinkLike: node: Node -> bool + abstract hasRestParameter: s: U2 -> bool + abstract isRestParameter: node: U2 -> bool abstract factory: NodeFactory abstract createUnparsedSourceFile: text: string -> UnparsedSource abstract createUnparsedSourceFile: inputFile: InputFiles * ``type``: IExportsCreateUnparsedSourceFile * ?stripInternal: bool -> UnparsedSource @@ -279,39 +290,39 @@ module Ts = abstract createInputFiles: javascriptText: string * declarationText: string * javascriptMapPath: string option * javascriptMapText: string option * declarationMapPath: string option * declarationMapText: string option -> InputFiles /// Create an external source map source file reference abstract createSourceMapSource: fileName: string * text: string * ?skipTrivia: (float -> float) -> SourceMapSource - abstract setOriginalNode: node: 'T * original: Node option -> 'T when 'T :> Node + abstract setOriginalNode: node: 'T * original: Node option -> 'T /// Clears any EmitNode entries from parse-tree nodes. /// A source file. abstract disposeEmitNodes: sourceFile: SourceFile option -> unit /// Sets flags that control emit behavior of a node. - abstract setEmitFlags: node: 'T * emitFlags: EmitFlags -> 'T when 'T :> Node + abstract setEmitFlags: node: 'T * emitFlags: EmitFlags -> 'T /// Gets a custom text range to use when emitting source maps. abstract getSourceMapRange: node: Node -> SourceMapRange /// Sets a custom text range to use when emitting source maps. - abstract setSourceMapRange: node: 'T * range: SourceMapRange option -> 'T when 'T :> Node + abstract setSourceMapRange: node: 'T * range: SourceMapRange option -> 'T /// Gets the TextRange to use for source maps for a token of a node. abstract getTokenSourceMapRange: node: Node * token: SyntaxKind -> SourceMapRange option /// Sets the TextRange to use for source maps for a token of a node. - abstract setTokenSourceMapRange: node: 'T * token: SyntaxKind * range: SourceMapRange option -> 'T when 'T :> Node + abstract setTokenSourceMapRange: node: 'T * token: SyntaxKind * range: SourceMapRange option -> 'T /// Gets a custom text range to use when emitting comments. abstract getCommentRange: node: Node -> TextRange /// Sets a custom text range to use when emitting comments. - abstract setCommentRange: node: 'T * range: TextRange -> 'T when 'T :> Node + abstract setCommentRange: node: 'T * range: TextRange -> 'T abstract getSyntheticLeadingComments: node: Node -> SynthesizedComment[] option - abstract setSyntheticLeadingComments: node: 'T * comments: SynthesizedComment[] option -> 'T when 'T :> Node - abstract addSyntheticLeadingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T when 'T :> Node + abstract setSyntheticLeadingComments: node: 'T * comments: SynthesizedComment[] option -> 'T + abstract addSyntheticLeadingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T abstract getSyntheticTrailingComments: node: Node -> SynthesizedComment[] option - abstract setSyntheticTrailingComments: node: 'T * comments: SynthesizedComment[] option -> 'T when 'T :> Node - abstract addSyntheticTrailingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T when 'T :> Node - abstract moveSyntheticComments: node: 'T * original: Node -> 'T when 'T :> Node + abstract setSyntheticTrailingComments: node: 'T * comments: SynthesizedComment[] option -> 'T + abstract addSyntheticTrailingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T + abstract moveSyntheticComments: node: 'T * original: Node -> 'T /// Gets the constant value to emit for an expression representing an enum. abstract getConstantValue: node: AccessExpression -> U2 option /// Sets the constant value to emit for an expression. abstract setConstantValue: node: AccessExpression * value: U2 -> AccessExpression /// Adds an EmitHelper to a node. - abstract addEmitHelper: node: 'T * helper: EmitHelper -> 'T when 'T :> Node + abstract addEmitHelper: node: 'T * helper: EmitHelper -> 'T /// Add EmitHelpers to a node. - abstract addEmitHelpers: node: 'T * helpers: EmitHelper[] option -> 'T when 'T :> Node + abstract addEmitHelpers: node: 'T * helpers: EmitHelper[] option -> 'T /// Removes an EmitHelper from a node. abstract removeEmitHelper: node: Node * helper: EmitHelper -> bool /// Gets the EmitHelpers of a node. @@ -517,7 +528,9 @@ module Ts = abstract isJSDocUnknownTag: node: Node -> bool abstract isJSDocPropertyTag: node: Node -> bool abstract isJSDocImplementsTag: node: Node -> bool - abstract setTextRange: range: 'T * location: TextRange option -> 'T when 'T :> TextRange + abstract setTextRange: range: 'T * location: TextRange option -> 'T + abstract canHaveModifiers: node: Node -> bool + abstract canHaveDecorators: node: Node -> bool /// /// Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes /// stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -598,27 +611,27 @@ module Ts = /// The callback used to visit the Node. /// A callback to execute to verify the Node is valid. /// An optional callback to execute to lift a NodeArray into a valid Node. - abstract visitNode: node: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T when 'T :> Node + abstract visitNode: node: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. /// The Node to visit. /// The callback used to visit the Node. /// A callback to execute to verify the Node is valid. /// An optional callback to execute to lift a NodeArray into a valid Node. - abstract visitNode: node: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option when 'T :> Node + abstract visitNode: node: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. /// The NodeArray to visit. /// The callback used to visit a Node. /// A node test to execute for each node. /// An optional value indicating the starting offset at which to start visiting. /// An optional value indicating the maximum number of nodes to visit. - abstract visitNodes: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] when 'T :> Node + abstract visitNodes: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. /// The NodeArray to visit. /// The callback used to visit a Node. /// A node test to execute for each node. /// An optional value indicating the starting offset at which to start visiting. /// An optional value indicating the maximum number of nodes to visit. - abstract visitNodes: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option when 'T :> Node + abstract visitNodes: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option /// Starts a new lexical environment and visits a statement list, ending the lexical environment /// and merging hoisted declarations upon completion. abstract visitLexicalEnvironment: statements: Statement[] * visitor: Visitor * context: TransformationContext * ?start: float * ?ensureUseStrict: bool * ?nodesVisitor: NodesVisitor -> Statement[] @@ -641,12 +654,12 @@ module Ts = /// The Node whose children will be visited. /// The callback used to visit each child. /// A lexical environment context for the visitor. - abstract visitEachChild: node: 'T * visitor: Visitor * context: TransformationContext -> 'T when 'T :> Node + abstract visitEachChild: node: 'T * visitor: Visitor * context: TransformationContext -> 'T /// Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. /// The Node whose children will be visited. /// The callback used to visit each child. /// A lexical environment context for the visitor. - abstract visitEachChild: node: 'T option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: obj * ?tokenVisitor: Visitor -> 'T option when 'T :> Node + abstract visitEachChild: node: 'T option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: obj * ?tokenVisitor: Visitor -> 'T option abstract getTsBuildInfoEmitOutputFilePath: options: CompilerOptions -> string option abstract getOutputFileNames: commandLine: ParsedCommandLine * inputFileName: string * ignoreCase: bool -> string[] abstract createPrinter: ?printerOptions: PrinterOptions * ?handlers: PrintHandlers -> Printer @@ -693,7 +706,7 @@ module Ts = /// /// Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' /// that represent a compilation unit. - /// + /// /// Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and /// triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. /// @@ -703,7 +716,7 @@ module Ts = /// /// Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' /// that represent a compilation unit. - /// + /// /// Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and /// triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. /// @@ -731,20 +744,20 @@ module Ts = abstract createAbstractBuilder: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: BuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> BuilderProgram abstract readBuilderProgram: compilerOptions: CompilerOptions * host: ReadBuildProgramHost -> EmitAndSemanticDiagnosticsBuilderProgram option abstract createIncrementalCompilerHost: options: CompilerOptions * ?system: System -> CompilerHost - abstract createIncrementalProgram: p0: IncrementalProgramOptions<'T> -> 'T when 'T :> BuilderProgram + abstract createIncrementalProgram: p0: IncrementalProgramOptions<'T> -> 'T /// Create the watch compiler host for either configFile or fileNames and its options - abstract createWatchCompilerHost: configFileName: string * optionsToExtend: CompilerOptions option * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> WatchCompilerHostOfConfigFile<'T> when 'T :> BuilderProgram - abstract createWatchCompilerHost: rootFiles: string[] * options: CompilerOptions * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?projectReferences: ProjectReference[] * ?watchOptions: WatchOptions -> WatchCompilerHostOfFilesAndCompilerOptions<'T> when 'T :> BuilderProgram + abstract createWatchCompilerHost: configFileName: string * optionsToExtend: CompilerOptions option * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> WatchCompilerHostOfConfigFile<'T> + abstract createWatchCompilerHost: rootFiles: string[] * options: CompilerOptions * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?projectReferences: ProjectReference[] * ?watchOptions: WatchOptions -> WatchCompilerHostOfFilesAndCompilerOptions<'T> /// Creates the watch from the host for root files and compiler options - abstract createWatchProgram: host: WatchCompilerHostOfFilesAndCompilerOptions<'T> -> WatchOfFilesAndCompilerOptions<'T> when 'T :> BuilderProgram + abstract createWatchProgram: host: WatchCompilerHostOfFilesAndCompilerOptions<'T> -> WatchOfFilesAndCompilerOptions<'T> /// Creates the watch from the host for config file - abstract createWatchProgram: host: WatchCompilerHostOfConfigFile<'T> -> WatchOfConfigFile<'T> when 'T :> BuilderProgram + abstract createWatchProgram: host: WatchCompilerHostOfConfigFile<'T> -> WatchOfConfigFile<'T> /// Create a function that reports watch status by writing to the system and handles the formating of the diagnostic abstract createBuilderStatusReporter: system: System * ?pretty: bool -> DiagnosticReporter - abstract createSolutionBuilderHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportErrorSummary: ReportEmitErrorSummary -> SolutionBuilderHost<'T> when 'T :> BuilderProgram - abstract createSolutionBuilderWithWatchHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter -> SolutionBuilderWithWatchHost<'T> when 'T :> BuilderProgram - abstract createSolutionBuilder: host: SolutionBuilderHost<'T> * rootNames: string[] * defaultOptions: BuildOptions -> SolutionBuilder<'T> when 'T :> BuilderProgram - abstract createSolutionBuilderWithWatch: host: SolutionBuilderWithWatchHost<'T> * rootNames: string[] * defaultOptions: BuildOptions * ?baseWatchOptions: WatchOptions -> SolutionBuilder<'T> when 'T :> BuilderProgram + abstract createSolutionBuilderHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportErrorSummary: ReportEmitErrorSummary -> SolutionBuilderHost<'T> + abstract createSolutionBuilderWithWatchHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter -> SolutionBuilderWithWatchHost<'T> + abstract createSolutionBuilder: host: SolutionBuilderHost<'T> * rootNames: string[] * defaultOptions: BuildOptions -> SolutionBuilder<'T> + abstract createSolutionBuilderWithWatch: host: SolutionBuilderWithWatchHost<'T> * rootNames: string[] * defaultOptions: BuildOptions * ?baseWatchOptions: WatchOptions -> SolutionBuilder<'T> abstract getDefaultFormatCodeSettings: ?newLineCharacter: string -> FormatCodeSettings /// The classifier is used for syntactic highlighting in editors via the TSServer abstract createClassifier: unit -> Classifier @@ -769,7 +782,7 @@ module Ts = /// A single Node or an array of Node objects. /// An array of TransformerFactory callbacks used to process the transformation. /// Optional compiler options. - abstract transform: source: U2<'T, 'T[]> * transformers: TransformerFactory<'T>[] * ?compilerOptions: CompilerOptions -> TransformationResult<'T> when 'T :> Node + abstract transform: source: U2<'T, 'T[]> * transformers: TransformerFactory<'T>[] * ?compilerOptions: CompilerOptions -> TransformationResult<'T> /// /// Type of objects whose values are all of the same type. @@ -1178,6 +1191,7 @@ module Ts = | JSDocFunctionType = 317 | JSDocVariadicType = 318 | JSDocNamepathType = 319 + | JSDoc = 320 /// Use SyntaxKind.JSDoc | JSDocComment = 320 | JSDocText = 321 @@ -1246,7 +1260,6 @@ module Ts = | LastJSDocNode = 347 | FirstJSDocTagNode = 327 | LastJSDocTagNode = 347 - | JSDoc = 320 type TriviaSyntaxKind = SyntaxKind @@ -1327,13 +1340,15 @@ module Ts = | Override = 16384 | In = 32768 | Out = 65536 + | Decorator = 131072 | HasComputedFlags = 536870912 | AccessibilityModifier = 28 | ParameterPropertyModifier = 16476 | NonPublicAccessibilityModifier = 24 | TypeScriptModifier = 116958 | ExportDefault = 513 - | All = 125951 + | All = 257023 + | Modifier = 125951 type [] JsxFlags = | None = 0 @@ -1347,8 +1362,6 @@ module Ts = inherit ReadonlyTextRange abstract kind: SyntaxKind abstract flags: NodeFlags - abstract decorators: Decorator[] option - abstract modifiers: ModifiersArray option abstract parent: Node abstract getSourceFile: unit -> SourceFile abstract getChildCount: ?sourceFile: SourceFile -> float @@ -1456,7 +1469,6 @@ module Ts = | [] ParameterDeclaration of ParameterDeclaration | [] PropertyAssignment of PropertyAssignment | [] PropertyDeclaration of PropertyDeclaration - | [] PropertySignature of PropertySignature | [] VariableDeclaration of VariableDeclaration static member inline op_ErasedCast(x: BindingElement) = BindingElement x static member inline op_ErasedCast(x: EnumMember) = EnumMember x @@ -1467,7 +1479,6 @@ module Ts = static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x - static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] [] HasExpressionInitializer = @@ -1476,17 +1487,83 @@ module Ts = | [] ParameterDeclaration of ParameterDeclaration | [] PropertyAssignment of PropertyAssignment | [] PropertyDeclaration of PropertyDeclaration - | [] PropertySignature of PropertySignature | [] VariableDeclaration of VariableDeclaration static member inline op_ErasedCast(x: BindingElement) = BindingElement x static member inline op_ErasedCast(x: EnumMember) = EnumMember x static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x - static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x - type [] NodeArray<'T when 'T :> Node> = + type [] [] HasDecorators = + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] MethodDeclaration of MethodDeclaration + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyDeclaration of PropertyDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + + type [] [] HasModifiers = + | [] ArrowFunction of ArrowFunction + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] EnumDeclaration of EnumDeclaration + | [] ExportAssignment of ExportAssignment + | [] ExportDeclaration of ExportDeclaration + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] ImportDeclaration of ImportDeclaration + | [] ImportEqualsDeclaration of ImportEqualsDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] InterfaceDeclaration of InterfaceDeclaration + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] ModuleDeclaration of ModuleDeclaration + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyDeclaration of PropertyDeclaration + | [] PropertySignature of PropertySignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + | [] TypeParameterDeclaration of TypeParameterDeclaration + | [] VariableStatement of VariableStatement + static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + static member inline op_ErasedCast(x: EnumDeclaration) = EnumDeclaration x + static member inline op_ErasedCast(x: ExportAssignment) = ExportAssignment x + static member inline op_ErasedCast(x: ExportDeclaration) = ExportDeclaration x + static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + static member inline op_ErasedCast(x: ImportDeclaration) = ImportDeclaration x + static member inline op_ErasedCast(x: ImportEqualsDeclaration) = ImportEqualsDeclaration x + static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x + static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + static member inline op_ErasedCast(x: ModuleDeclaration) = ModuleDeclaration x + static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x + static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x + static member inline op_ErasedCast(x: TypeParameterDeclaration) = TypeParameterDeclaration x + static member inline op_ErasedCast(x: VariableStatement) = VariableStatement x + + type [] NodeArray<'T> = inherit ReadonlyArray<'T> inherit ReadonlyTextRange abstract hasTrailingComma: bool @@ -1621,6 +1698,23 @@ module Ts = [] member _.kind : SyntaxKind = jsNative + type [] [] ModifierLike = + | [] AbstractKeyword of AbstractKeyword + | [] AsyncKeyword of AsyncKeyword + | [] ConstKeyword of ConstKeyword + | [] DeclareKeyword of DeclareKeyword + | [] Decorator of Decorator + | [] DefaultKeyword of DefaultKeyword + | [] ExportKeyword of ExportKeyword + | [] InKeyword of InKeyword + | [] OutKeyword of OutKeyword + | [] OverrideKeyword of OverrideKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + | [] StaticKeyword of StaticKeyword + type [] [] AccessibilityModifier = | [] PrivateKeyword of PrivateKeyword | [] ProtectedKeyword of ProtectedKeyword @@ -1753,6 +1847,7 @@ module Ts = inherit NamedDeclaration abstract kind: SyntaxKind abstract parent: U2 + abstract modifiers: Modifier[] option abstract name: Identifier /// Note: Consider calling getEffectiveConstraintOfTypeParameter abstract ``constraint``: TypeNode option @@ -1837,6 +1932,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: SignatureDeclaration + abstract modifiers: ModifierLike[] option abstract dotDotDotToken: DotDotDotToken option abstract name: BindingName abstract questionToken: QuestionToken option @@ -1856,16 +1952,19 @@ module Ts = inherit TypeElement inherit JSDocContainer abstract kind: SyntaxKind + abstract modifiers: Modifier[] option abstract name: PropertyName abstract questionToken: QuestionToken option abstract ``type``: TypeNode option - abstract initializer: Expression option with get, set + [] + abstract initializer: Expression option type [] PropertyDeclaration = inherit ClassElement inherit JSDocContainer abstract kind: SyntaxKind abstract parent: ClassLikeDeclaration + abstract modifiers: ModifierLike[] option abstract name: PropertyName abstract questionToken: QuestionToken option abstract exclamationToken: ExclamationToken option @@ -1898,9 +1997,11 @@ module Ts = abstract kind: SyntaxKind abstract parent: ObjectLiteralExpression abstract name: PropertyName + abstract initializer: Expression + [] abstract questionToken: QuestionToken option + [] abstract exclamationToken: ExclamationToken option - abstract initializer: Expression type [] ShorthandPropertyAssignment = inherit ObjectLiteralElement @@ -1908,10 +2009,14 @@ module Ts = abstract kind: SyntaxKind abstract parent: ObjectLiteralExpression abstract name: Identifier - abstract questionToken: QuestionToken option - abstract exclamationToken: ExclamationToken option abstract equalsToken: EqualsToken option abstract objectAssignmentInitializer: Expression option + [] + abstract modifiers: Modifier[] option + [] + abstract questionToken: QuestionToken option + [] + abstract exclamationToken: ExclamationToken option type [] SpreadAssignment = inherit ObjectLiteralElement @@ -2010,6 +2115,7 @@ module Ts = inherit FunctionLikeDeclarationBase inherit DeclarationStatement abstract kind: SyntaxKind + abstract modifiers: Modifier[] option abstract name: Identifier option abstract body: FunctionBody option @@ -2018,6 +2124,7 @@ module Ts = inherit TypeElement abstract kind: SyntaxKind abstract parent: ObjectTypeDeclaration + abstract modifiers: Modifier[] option abstract name: PropertyName type [] MethodDeclaration = @@ -2027,6 +2134,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: U2 + abstract modifiers: ModifierLike[] option abstract name: PropertyName abstract body: FunctionBody option @@ -2036,6 +2144,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: ClassLikeDeclaration + abstract modifiers: Modifier[] option abstract body: FunctionBody option /// For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. @@ -2052,6 +2161,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: U4 + abstract modifiers: ModifierLike[] option abstract name: PropertyName abstract body: FunctionBody option @@ -2063,6 +2173,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: U4 + abstract modifiers: ModifierLike[] option abstract name: PropertyName abstract body: FunctionBody option @@ -2078,6 +2189,7 @@ module Ts = inherit TypeElement abstract kind: SyntaxKind abstract parent: ObjectTypeDeclaration + abstract modifiers: Modifier[] option abstract ``type``: TypeNode type [] ClassStaticBlockDeclaration = @@ -2133,10 +2245,13 @@ module Ts = type [] FunctionTypeNode = inherit FunctionOrConstructorTypeNodeBase abstract kind: SyntaxKind + [] + abstract modifiers: Modifier[] option type [] ConstructorTypeNode = inherit FunctionOrConstructorTypeNodeBase abstract kind: SyntaxKind + abstract modifiers: Modifier[] option type [] NodeWithTypeArguments = inherit TypeNode @@ -2641,6 +2756,7 @@ module Ts = inherit FunctionLikeDeclarationBase inherit JSDocContainer abstract kind: SyntaxKind + abstract modifiers: Modifier[] option abstract name: Identifier option abstract body: FunctionBody @@ -2649,6 +2765,7 @@ module Ts = inherit FunctionLikeDeclarationBase inherit JSDocContainer abstract kind: SyntaxKind + abstract modifiers: Modifier[] option abstract equalsGreaterThanToken: EqualsGreaterThanToken abstract body: ConciseBody abstract name: obj @@ -3028,7 +3145,19 @@ module Ts = abstract kind: SyntaxKind abstract parent: JsxAttributes abstract name: Identifier - abstract initializer: U2 option + abstract initializer: JsxAttributeValue option + + type [] [] JsxAttributeValue = + | [] JsxElement of JsxElement + | [] JsxExpression of JsxExpression + | [] JsxFragment of JsxFragment + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] StringLiteral of StringLiteral + static member inline op_ErasedCast(x: JsxElement) = JsxElement x + static member inline op_ErasedCast(x: JsxExpression) = JsxExpression x + static member inline op_ErasedCast(x: JsxFragment) = JsxFragment x + static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x + static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] JsxSpreadAttribute = inherit ObjectLiteralElement @@ -3115,6 +3244,7 @@ module Ts = type [] VariableStatement = inherit Statement abstract kind: SyntaxKind + abstract modifiers: Modifier[] option abstract declarationList: VariableDeclarationList type [] ExpressionStatement = @@ -3366,6 +3496,7 @@ module Ts = inherit ClassLikeDeclarationBase inherit DeclarationStatement abstract kind: SyntaxKind + abstract modifiers: ModifierLike[] option /// May be undefined in export default class { ... }. abstract name: Identifier option @@ -3373,6 +3504,7 @@ module Ts = inherit ClassLikeDeclarationBase inherit PrimaryExpression abstract kind: SyntaxKind + abstract modifiers: ModifierLike[] option type [] [] ClassLikeDeclaration = | [] ClassDeclaration of ClassDeclaration @@ -3395,6 +3527,7 @@ module Ts = inherit DeclarationStatement inherit JSDocContainer abstract kind: SyntaxKind + abstract modifiers: Modifier[] option abstract name: Identifier abstract typeParameters: TypeParameterDeclaration[] option abstract heritageClauses: HeritageClause[] option @@ -3411,6 +3544,7 @@ module Ts = inherit DeclarationStatement inherit JSDocContainer abstract kind: SyntaxKind + abstract modifiers: Modifier[] option abstract name: Identifier abstract typeParameters: TypeParameterDeclaration[] option abstract ``type``: TypeNode @@ -3427,6 +3561,7 @@ module Ts = inherit DeclarationStatement inherit JSDocContainer abstract kind: SyntaxKind + abstract modifiers: Modifier[] option abstract name: Identifier abstract members: EnumMember[] @@ -3449,6 +3584,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: U2 + abstract modifiers: Modifier[] option abstract name: ModuleName abstract body: U2 option @@ -3497,6 +3633,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: U2 + abstract modifiers: Modifier[] option abstract name: Identifier abstract isTypeOnly: bool abstract moduleReference: ModuleReference @@ -3511,6 +3648,7 @@ module Ts = inherit Statement abstract kind: SyntaxKind abstract parent: U2 + abstract modifiers: Modifier[] option abstract importClause: ImportClause option /// If this is not a StringLiteral it will be a grammar error. abstract moduleSpecifier: Expression @@ -3579,6 +3717,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: U2 + abstract modifiers: Modifier[] option abstract isTypeOnly: bool /// Will not be assigned in the case of export * from "foo"; abstract exportClause: NamedExportBindings option @@ -3651,6 +3790,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: SourceFile + abstract modifiers: Modifier[] option abstract isExportEquals: bool option abstract expression: Expression @@ -4025,9 +4165,9 @@ module Ts = abstract languageVariant: LanguageVariant with get, set abstract isDeclarationFile: bool with get, set /// lib.d.ts should have a reference comment like - /// + /// /// /// - /// + /// /// If any other file has this comment, it signals not to include lib.d.ts /// because this containing file is intended to act as a default library. abstract hasNoDefaultLib: bool with get, set @@ -4038,10 +4178,16 @@ module Ts = /// module. This is derived by the module resolver as it looks up the file, since /// it is derived from either the file extension of the module, or the containing /// package.json context, and affects both checking and emit. - /// + /// /// It is _public_ so that (pre)transformers can set this field, /// since it switches the builtin node module transform. Generally speaking, if unset, /// the field is treated as though it is ModuleKind.CommonJS. + /// + /// Note that this field is only set by the module resolution process when + /// moduleResolution is Node16 or NodeNext, which is implied by the module setting + /// of Node16 or NodeNext, respectively, but may be overriden (eg, by a moduleResolution + /// of node). If so, this field will be unset and source files will be considered to be + /// CommonJS-output-format by the node module transformer and type checker, regardless of extension or context. /// abstract impliedNodeFormat: ModuleKind option with get, set abstract getLineAndCharacterOfPosition: pos: float -> LineAndCharacter @@ -4088,8 +4234,6 @@ module Ts = | [] UnparsedTextLike of UnparsedTextLike | [] UnparsedPrepend of UnparsedPrepend | [] UnparsedTextLike' of UnparsedTextLike - static member inline op_ErasedCast(x: UnparsedTextLike) = UnparsedTextLike x - static member inline op_ErasedCast(x: UnparsedPrepend) = UnparsedPrepend x type [] [] UnparsedNode = | [] UnparsedTextLike of UnparsedTextLike @@ -4097,10 +4241,6 @@ module Ts = | [] UnparsedPrologue of UnparsedPrologue | [] UnparsedSyntheticReference of UnparsedSyntheticReference | [] UnparsedTextLike' of UnparsedTextLike - static member inline op_ErasedCast(x: UnparsedTextLike) = UnparsedTextLike x - static member inline op_ErasedCast(x: UnparsedPrepend) = UnparsedPrepend x - static member inline op_ErasedCast(x: UnparsedPrologue) = UnparsedPrologue x - static member inline op_ErasedCast(x: UnparsedSyntheticReference) = UnparsedSyntheticReference x type [] UnparsedSection = inherit Node @@ -4216,7 +4356,7 @@ module Ts = /// the JavaScript and declaration files will be produced for all the files in this program. /// If targetSourceFile is specified, then only the JavaScript and declaration for that /// specific file will be generated. - /// + /// /// If writeFile is not specified then the writeFile callback from the compiler host will be /// used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter /// will be invoked when writing the JavaScript and declaration files. @@ -4403,6 +4543,7 @@ module Ts = | UseAliasDefinedOutsideCurrentScope = 16384 | UseSingleQuotesForStringLiteralType = 268435456 | NoTypeReduction = 536870912 + | OmitThisParameter = 33554432 | AllowThisInObjectLiteral = 32768 | AllowQualifiedNameInPlaceOfIdentifier = 65536 /// AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. @@ -4433,6 +4574,7 @@ module Ts = | UseAliasDefinedOutsideCurrentScope = 16384 | UseSingleQuotesForStringLiteralType = 268435456 | NoTypeReduction = 536870912 + | OmitThisParameter = 33554432 | AllowUniqueESSymbolType = 1048576 | AddUndefined = 131072 | WriteArrowStyleSignature = 262144 @@ -4442,7 +4584,7 @@ module Ts = | InTypeAlias = 8388608 /// | WriteOwnNameForAnyLike = 0 - | NodeBuilderFlagsMask = 814775659 + | NodeBuilderFlagsMask = 848330091 type [] SymbolFormatFlags = | None = 0 @@ -5272,7 +5414,7 @@ Use typeAcquisition.enable instead.")>] /// Represents the result of module resolution. /// Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off. /// The Program will then filter results based on these flags. - /// + /// /// Prefer to return a ResolvedModuleFull so that the file type does not have to be inferred. /// type [] ResolvedModule = @@ -5368,7 +5510,7 @@ Use typeAcquisition.enable instead.")>] type [] SourceMapSource = abstract fileName: string with get, set abstract text: string with get, set - abstract skipTrivia: (float -> float) option with get, set + abstract skipTrivia: pos: float -> float abstract getLineAndCharacterOfPosition: pos: float -> LineAndCharacter type [] EmitFlags = @@ -5456,7 +5598,7 @@ Use typeAcquisition.enable instead.")>] | Function type [] NodeFactory = - abstract createNodeArray: ?elements: 'T[] * ?hasTrailingComma: bool -> 'T[] when 'T :> Node + abstract createNodeArray: ?elements: 'T[] * ?hasTrailingComma: bool -> 'T[] abstract createNumericLiteral: value: U2 * ?numericLiteralFlags: TokenFlags -> NumericLiteral abstract createBigIntLiteral: value: U2 -> BigIntLiteral abstract createStringLiteral: text: string * ?isSingleQuote: bool -> StringLiteral @@ -5487,7 +5629,7 @@ Use typeAcquisition.enable instead.")>] /// Create a unique name generated for a node. abstract getGeneratedNameForNode: node: Node option * ?flags: GeneratedIdentifierFlags -> Identifier abstract createPrivateIdentifier: text: string -> PrivateIdentifier - abstract createToken: token: 'TKind -> Token<'TKind> + abstract createToken: token: SyntaxKind -> SuperExpression abstract createSuper: unit -> SuperExpression abstract createThis: unit -> ThisExpression abstract createNull: unit -> NullLiteral @@ -5500,39 +5642,35 @@ Use typeAcquisition.enable instead.")>] abstract createComputedPropertyName: expression: Expression -> ComputedPropertyName abstract updateComputedPropertyName: node: ComputedPropertyName * expression: Expression -> ComputedPropertyName abstract createTypeParameterDeclaration: modifiers: Modifier[] option * name: U2 * ?``constraint``: TypeNode * ?defaultType: TypeNode -> TypeParameterDeclaration - [] - abstract createTypeParameterDeclaration: name: U2 * ?``constraint``: TypeNode * ?defaultType: TypeNode -> TypeParameterDeclaration abstract updateTypeParameterDeclaration: node: TypeParameterDeclaration * modifiers: Modifier[] option * name: Identifier * ``constraint``: TypeNode option * defaultType: TypeNode option -> TypeParameterDeclaration - [] - abstract updateTypeParameterDeclaration: node: TypeParameterDeclaration * name: Identifier * ``constraint``: TypeNode option * defaultType: TypeNode option -> TypeParameterDeclaration - abstract createParameterDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * ?questionToken: QuestionToken * ?``type``: TypeNode * ?initializer: Expression -> ParameterDeclaration - abstract updateParameterDeclaration: node: ParameterDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option * initializer: Expression option -> ParameterDeclaration + abstract createParameterDeclaration: modifiers: ModifierLike[] option * dotDotDotToken: DotDotDotToken option * name: U2 * ?questionToken: QuestionToken * ?``type``: TypeNode * ?initializer: Expression -> ParameterDeclaration + abstract updateParameterDeclaration: node: ParameterDeclaration * modifiers: ModifierLike[] option * dotDotDotToken: DotDotDotToken option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option * initializer: Expression option -> ParameterDeclaration abstract createDecorator: expression: Expression -> Decorator abstract updateDecorator: node: Decorator * expression: Expression -> Decorator abstract createPropertySignature: modifiers: Modifier[] option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option -> PropertySignature abstract updatePropertySignature: node: PropertySignature * modifiers: Modifier[] option * name: PropertyName * questionToken: QuestionToken option * ``type``: TypeNode option -> PropertySignature - abstract createPropertyDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration - abstract updatePropertyDeclaration: node: PropertyDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration + abstract createPropertyDeclaration: modifiers: ModifierLike[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration + abstract updatePropertyDeclaration: node: PropertyDeclaration * modifiers: ModifierLike[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration abstract createMethodSignature: modifiers: Modifier[] option * name: U2 * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> MethodSignature abstract updateMethodSignature: node: MethodSignature * modifiers: Modifier[] option * name: PropertyName * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> MethodSignature - abstract createMethodDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: U2 * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration - abstract updateMethodDeclaration: node: MethodDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: PropertyName * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration - abstract createConstructorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration - abstract updateConstructorDeclaration: node: ConstructorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration - abstract createGetAccessorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration - abstract updateGetAccessorDeclaration: node: GetAccessorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: PropertyName * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration - abstract createSetAccessorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration - abstract updateSetAccessorDeclaration: node: SetAccessorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: PropertyName * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration + abstract createMethodDeclaration: modifiers: ModifierLike[] option * asteriskToken: AsteriskToken option * name: U2 * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration + abstract updateMethodDeclaration: node: MethodDeclaration * modifiers: ModifierLike[] option * asteriskToken: AsteriskToken option * name: PropertyName * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration + abstract createConstructorDeclaration: modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration + abstract updateConstructorDeclaration: node: ConstructorDeclaration * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration + abstract createGetAccessorDeclaration: modifiers: ModifierLike[] option * name: U2 * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration + abstract updateGetAccessorDeclaration: node: GetAccessorDeclaration * modifiers: ModifierLike[] option * name: PropertyName * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration + abstract createSetAccessorDeclaration: modifiers: ModifierLike[] option * name: U2 * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration + abstract updateSetAccessorDeclaration: node: SetAccessorDeclaration * modifiers: ModifierLike[] option * name: PropertyName * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration abstract createCallSignature: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> CallSignatureDeclaration abstract updateCallSignature: node: CallSignatureDeclaration * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> CallSignatureDeclaration abstract createConstructSignature: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> ConstructSignatureDeclaration abstract updateConstructSignature: node: ConstructSignatureDeclaration * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> ConstructSignatureDeclaration - abstract createIndexSignature: decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration - abstract updateIndexSignature: node: IndexSignatureDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration + abstract createIndexSignature: modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration + abstract updateIndexSignature: node: IndexSignatureDeclaration * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration abstract createTemplateLiteralTypeSpan: ``type``: TypeNode * literal: U2 -> TemplateLiteralTypeSpan abstract updateTemplateLiteralTypeSpan: node: TemplateLiteralTypeSpan * ``type``: TypeNode * literal: U2 -> TemplateLiteralTypeSpan - abstract createClassStaticBlockDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * body: Block -> ClassStaticBlockDeclaration - abstract updateClassStaticBlockDeclaration: node: ClassStaticBlockDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * body: Block -> ClassStaticBlockDeclaration + abstract createClassStaticBlockDeclaration: body: Block -> ClassStaticBlockDeclaration + abstract updateClassStaticBlockDeclaration: node: ClassStaticBlockDeclaration * body: Block -> ClassStaticBlockDeclaration abstract createKeywordTypeNode: kind: 'TKind -> KeywordTypeNode<'TKind> abstract createTypePredicateNode: assertsModifier: AssertsKeyword option * parameterName: U3 * ``type``: TypeNode option -> TypePredicateNode abstract updateTypePredicateNode: node: TypePredicateNode * assertsModifier: AssertsKeyword option * parameterName: U2 * ``type``: TypeNode option -> TypePredicateNode @@ -5541,11 +5679,7 @@ Use typeAcquisition.enable instead.")>] abstract createFunctionTypeNode: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> FunctionTypeNode abstract updateFunctionTypeNode: node: FunctionTypeNode * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> FunctionTypeNode abstract createConstructorTypeNode: modifiers: Modifier[] option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode - [] - abstract createConstructorTypeNode: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode abstract updateConstructorTypeNode: node: ConstructorTypeNode * modifiers: Modifier[] option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode - [] - abstract updateConstructorTypeNode: node: ConstructorTypeNode * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode abstract createTypeQueryNode: exprName: EntityName * ?typeArguments: TypeNode[] -> TypeQueryNode abstract updateTypeQueryNode: node: TypeQueryNode * exprName: EntityName * ?typeArguments: TypeNode[] -> TypeQueryNode abstract createTypeLiteralNode: members: TypeElement[] option -> TypeLiteralNode @@ -5568,9 +5702,7 @@ Use typeAcquisition.enable instead.")>] abstract updateConditionalTypeNode: node: ConditionalTypeNode * checkType: TypeNode * extendsType: TypeNode * trueType: TypeNode * falseType: TypeNode -> ConditionalTypeNode abstract createInferTypeNode: typeParameter: TypeParameterDeclaration -> InferTypeNode abstract updateInferTypeNode: node: InferTypeNode * typeParameter: TypeParameterDeclaration -> InferTypeNode - abstract createImportTypeNode: argument: TypeNode * ?qualifier: EntityName * ?typeArguments: TypeNode[] * ?isTypeOf: bool -> ImportTypeNode abstract createImportTypeNode: argument: TypeNode * ?assertions: ImportTypeAssertionContainer * ?qualifier: EntityName * ?typeArguments: TypeNode[] * ?isTypeOf: bool -> ImportTypeNode - abstract updateImportTypeNode: node: ImportTypeNode * argument: TypeNode * qualifier: EntityName option * typeArguments: TypeNode[] option * ?isTypeOf: bool -> ImportTypeNode abstract updateImportTypeNode: node: ImportTypeNode * argument: TypeNode * assertions: ImportTypeAssertionContainer option * qualifier: EntityName option * typeArguments: TypeNode[] option * ?isTypeOf: bool -> ImportTypeNode abstract createParenthesizedType: ``type``: TypeNode -> ParenthesizedTypeNode abstract updateParenthesizedType: node: ParenthesizedTypeNode * ``type``: TypeNode -> ParenthesizedTypeNode @@ -5650,8 +5782,8 @@ Use typeAcquisition.enable instead.")>] abstract updateYieldExpression: node: YieldExpression * asteriskToken: AsteriskToken option * expression: Expression option -> YieldExpression abstract createSpreadElement: expression: Expression -> SpreadElement abstract updateSpreadElement: node: SpreadElement * expression: Expression -> SpreadElement - abstract createClassExpression: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression - abstract updateClassExpression: node: ClassExpression * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression + abstract createClassExpression: modifiers: ModifierLike[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression + abstract updateClassExpression: node: ClassExpression * modifiers: ModifierLike[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression abstract createOmittedExpression: unit -> OmittedExpression abstract createExpressionWithTypeArguments: expression: Expression * typeArguments: TypeNode[] option -> ExpressionWithTypeArguments abstract updateExpressionWithTypeArguments: node: ExpressionWithTypeArguments * expression: Expression * typeArguments: TypeNode[] option -> ExpressionWithTypeArguments @@ -5706,28 +5838,28 @@ Use typeAcquisition.enable instead.")>] abstract updateVariableDeclaration: node: VariableDeclaration * name: BindingName * exclamationToken: ExclamationToken option * ``type``: TypeNode option * initializer: Expression option -> VariableDeclaration abstract createVariableDeclarationList: declarations: VariableDeclaration[] * ?flags: NodeFlags -> VariableDeclarationList abstract updateVariableDeclarationList: node: VariableDeclarationList * declarations: VariableDeclaration[] -> VariableDeclarationList - abstract createFunctionDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration - abstract updateFunctionDeclaration: node: FunctionDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration - abstract createClassDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration - abstract updateClassDeclaration: node: ClassDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration - abstract createInterfaceDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration - abstract updateInterfaceDeclaration: node: InterfaceDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration - abstract createTypeAliasDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration - abstract updateTypeAliasDeclaration: node: TypeAliasDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration - abstract createEnumDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * members: EnumMember[] -> EnumDeclaration - abstract updateEnumDeclaration: node: EnumDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * members: EnumMember[] -> EnumDeclaration - abstract createModuleDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option * ?flags: NodeFlags -> ModuleDeclaration - abstract updateModuleDeclaration: node: ModuleDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option -> ModuleDeclaration + abstract createFunctionDeclaration: modifiers: ModifierLike[] option * asteriskToken: AsteriskToken option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration + abstract updateFunctionDeclaration: node: FunctionDeclaration * modifiers: ModifierLike[] option * asteriskToken: AsteriskToken option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration + abstract createClassDeclaration: modifiers: ModifierLike[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration + abstract updateClassDeclaration: node: ClassDeclaration * modifiers: ModifierLike[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration + abstract createInterfaceDeclaration: modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration + abstract updateInterfaceDeclaration: node: InterfaceDeclaration * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration + abstract createTypeAliasDeclaration: modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration + abstract updateTypeAliasDeclaration: node: TypeAliasDeclaration * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration + abstract createEnumDeclaration: modifiers: Modifier[] option * name: U2 * members: EnumMember[] -> EnumDeclaration + abstract updateEnumDeclaration: node: EnumDeclaration * modifiers: Modifier[] option * name: Identifier * members: EnumMember[] -> EnumDeclaration + abstract createModuleDeclaration: modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option * ?flags: NodeFlags -> ModuleDeclaration + abstract updateModuleDeclaration: node: ModuleDeclaration * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option -> ModuleDeclaration abstract createModuleBlock: statements: Statement[] -> ModuleBlock abstract updateModuleBlock: node: ModuleBlock * statements: Statement[] -> ModuleBlock abstract createCaseBlock: clauses: CaseOrDefaultClause[] -> CaseBlock abstract updateCaseBlock: node: CaseBlock * clauses: CaseOrDefaultClause[] -> CaseBlock abstract createNamespaceExportDeclaration: name: U2 -> NamespaceExportDeclaration abstract updateNamespaceExportDeclaration: node: NamespaceExportDeclaration * name: Identifier -> NamespaceExportDeclaration - abstract createImportEqualsDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * name: U2 * moduleReference: ModuleReference -> ImportEqualsDeclaration - abstract updateImportEqualsDeclaration: node: ImportEqualsDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * name: Identifier * moduleReference: ModuleReference -> ImportEqualsDeclaration - abstract createImportDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * ?assertClause: AssertClause -> ImportDeclaration - abstract updateImportDeclaration: node: ImportDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * assertClause: AssertClause option -> ImportDeclaration + abstract createImportEqualsDeclaration: modifiers: Modifier[] option * isTypeOnly: bool * name: U2 * moduleReference: ModuleReference -> ImportEqualsDeclaration + abstract updateImportEqualsDeclaration: node: ImportEqualsDeclaration * modifiers: Modifier[] option * isTypeOnly: bool * name: Identifier * moduleReference: ModuleReference -> ImportEqualsDeclaration + abstract createImportDeclaration: modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * ?assertClause: AssertClause -> ImportDeclaration + abstract updateImportDeclaration: node: ImportDeclaration * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * assertClause: AssertClause option -> ImportDeclaration abstract createImportClause: isTypeOnly: bool * name: Identifier option * namedBindings: NamedImportBindings option -> ImportClause abstract updateImportClause: node: ImportClause * isTypeOnly: bool * name: Identifier option * namedBindings: NamedImportBindings option -> ImportClause abstract createAssertClause: elements: AssertEntry[] * ?multiLine: bool -> AssertClause @@ -5744,10 +5876,10 @@ Use typeAcquisition.enable instead.")>] abstract updateNamedImports: node: NamedImports * elements: ImportSpecifier[] -> NamedImports abstract createImportSpecifier: isTypeOnly: bool * propertyName: Identifier option * name: Identifier -> ImportSpecifier abstract updateImportSpecifier: node: ImportSpecifier * isTypeOnly: bool * propertyName: Identifier option * name: Identifier -> ImportSpecifier - abstract createExportAssignment: decorators: Decorator[] option * modifiers: Modifier[] option * isExportEquals: bool option * expression: Expression -> ExportAssignment - abstract updateExportAssignment: node: ExportAssignment * decorators: Decorator[] option * modifiers: Modifier[] option * expression: Expression -> ExportAssignment - abstract createExportDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * ?moduleSpecifier: Expression * ?assertClause: AssertClause -> ExportDeclaration - abstract updateExportDeclaration: node: ExportDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * moduleSpecifier: Expression option * assertClause: AssertClause option -> ExportDeclaration + abstract createExportAssignment: modifiers: Modifier[] option * isExportEquals: bool option * expression: Expression -> ExportAssignment + abstract updateExportAssignment: node: ExportAssignment * modifiers: Modifier[] option * expression: Expression -> ExportAssignment + abstract createExportDeclaration: modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * ?moduleSpecifier: Expression * ?assertClause: AssertClause -> ExportDeclaration + abstract updateExportDeclaration: node: ExportDeclaration * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * moduleSpecifier: Expression option * assertClause: AssertClause option -> ExportDeclaration abstract createNamedExports: elements: ExportSpecifier[] -> NamedExports abstract updateNamedExports: node: NamedExports * elements: ExportSpecifier[] -> NamedExports abstract createExportSpecifier: isTypeOnly: bool * propertyName: U2 option * name: U2 -> ExportSpecifier @@ -5844,8 +5976,8 @@ Use typeAcquisition.enable instead.")>] abstract createJsxOpeningFragment: unit -> JsxOpeningFragment abstract createJsxJsxClosingFragment: unit -> JsxClosingFragment abstract updateJsxFragment: node: JsxFragment * openingFragment: JsxOpeningFragment * children: JsxChild[] * closingFragment: JsxClosingFragment -> JsxFragment - abstract createJsxAttribute: name: Identifier * initializer: U2 option -> JsxAttribute - abstract updateJsxAttribute: node: JsxAttribute * name: Identifier * initializer: U2 option -> JsxAttribute + abstract createJsxAttribute: name: Identifier * initializer: JsxAttributeValue option -> JsxAttribute + abstract updateJsxAttribute: node: JsxAttribute * name: Identifier * initializer: JsxAttributeValue option -> JsxAttribute abstract createJsxAttributes: properties: JsxAttributeLike[] -> JsxAttributes abstract updateJsxAttributes: node: JsxAttributes * properties: JsxAttributeLike[] -> JsxAttributes abstract createJsxSpreadAttribute: expression: Expression -> JsxSpreadAttribute @@ -5918,6 +6050,94 @@ Use typeAcquisition.enable instead.")>] abstract createExportDefault: expression: Expression -> ExportAssignment abstract createExternalModuleExport: exportName: Identifier -> ExportDeclaration abstract restoreOuterExpressions: outerExpression: Expression option * innerExpression: Expression * ?kinds: OuterExpressionKinds -> Expression + [] + abstract createConstructorTypeNode: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode + [] + abstract updateConstructorTypeNode: node: ConstructorTypeNode * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode + [] + abstract createImportTypeNode: argument: TypeNode * ?qualifier: EntityName * ?typeArguments: TypeNode[] * ?isTypeOf: bool -> ImportTypeNode + [] + abstract updateImportTypeNode: node: ImportTypeNode * argument: TypeNode * qualifier: EntityName option * typeArguments: TypeNode[] option * ?isTypeOf: bool -> ImportTypeNode + [] + abstract createTypeParameterDeclaration: name: U2 * ?``constraint``: TypeNode * ?defaultType: TypeNode -> TypeParameterDeclaration + [] + abstract updateTypeParameterDeclaration: node: TypeParameterDeclaration * name: Identifier * ``constraint``: TypeNode option * defaultType: TypeNode option -> TypeParameterDeclaration + [] + abstract createParameterDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * ?questionToken: QuestionToken * ?``type``: TypeNode * ?initializer: Expression -> ParameterDeclaration + [] + abstract updateParameterDeclaration: node: ParameterDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option * initializer: Expression option -> ParameterDeclaration + [] + abstract createPropertyDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration + [] + abstract updatePropertyDeclaration: node: PropertyDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration + [] + abstract createMethodDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: U2 * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration + [] + abstract updateMethodDeclaration: node: MethodDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: PropertyName * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration + [] + abstract createConstructorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration + [] + abstract updateConstructorDeclaration: node: ConstructorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration + [] + abstract createGetAccessorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration + [] + abstract updateGetAccessorDeclaration: node: GetAccessorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: PropertyName * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration + [] + abstract createSetAccessorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration + [] + abstract updateSetAccessorDeclaration: node: SetAccessorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: PropertyName * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration + [] + abstract createIndexSignature: decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration + [] + abstract updateIndexSignature: node: IndexSignatureDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration + [] + abstract createClassStaticBlockDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * body: Block -> ClassStaticBlockDeclaration + [] + abstract updateClassStaticBlockDeclaration: node: ClassStaticBlockDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * body: Block -> ClassStaticBlockDeclaration + [] + abstract createClassExpression: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression + [] + abstract updateClassExpression: node: ClassExpression * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression + [] + abstract createFunctionDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration + [] + abstract updateFunctionDeclaration: node: FunctionDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration + [] + abstract createClassDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration + [] + abstract updateClassDeclaration: node: ClassDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration + [] + abstract createInterfaceDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration + [] + abstract updateInterfaceDeclaration: node: InterfaceDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration + [] + abstract createTypeAliasDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration + [] + abstract updateTypeAliasDeclaration: node: TypeAliasDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration + [] + abstract createEnumDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * members: EnumMember[] -> EnumDeclaration + [] + abstract updateEnumDeclaration: node: EnumDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * members: EnumMember[] -> EnumDeclaration + [] + abstract createModuleDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option * ?flags: NodeFlags -> ModuleDeclaration + [] + abstract updateModuleDeclaration: node: ModuleDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option -> ModuleDeclaration + [] + abstract createImportEqualsDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * name: U2 * moduleReference: ModuleReference -> ImportEqualsDeclaration + [] + abstract updateImportEqualsDeclaration: node: ImportEqualsDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * name: Identifier * moduleReference: ModuleReference -> ImportEqualsDeclaration + [] + abstract createImportDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * ?assertClause: AssertClause -> ImportDeclaration + [] + abstract updateImportDeclaration: node: ImportDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * assertClause: AssertClause option -> ImportDeclaration + [] + abstract createExportAssignment: decorators: Decorator[] option * modifiers: Modifier[] option * isExportEquals: bool option * expression: Expression -> ExportAssignment + [] + abstract updateExportAssignment: node: ExportAssignment * decorators: Decorator[] option * modifiers: Modifier[] option * expression: Expression -> ExportAssignment + [] + abstract createExportDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * ?moduleSpecifier: Expression * ?assertClause: AssertClause -> ExportDeclaration + [] + abstract updateExportDeclaration: node: ExportDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * moduleSpecifier: Expression option * assertClause: AssertClause option -> ExportDeclaration type [] CoreTransformationContext = abstract factory: NodeFactory @@ -5949,11 +6169,11 @@ Use typeAcquisition.enable instead.")>] /// /// Hook used by transformers to substitute expressions just before they /// are emitted by the pretty printer. - /// + /// /// NOTE: Transformation hooks should only be modified during Transformer initialization, /// before returning the NodeTransformer callback. /// - abstract onSubstituteNode: (EmitHint -> Node -> Node) with get, set + abstract onSubstituteNode: hint: EmitHint * node: Node -> Node /// Enables before/after emit notifications in the pretty printer for the provided /// SyntaxKind. abstract enableEmitNotification: kind: SyntaxKind -> unit @@ -5963,13 +6183,13 @@ Use typeAcquisition.enable instead.")>] /// /// Hook used to allow transformers to capture state before or after /// the printer emits a node. - /// + /// /// NOTE: Transformation hooks should only be modified during Transformer initialization, /// before returning the NodeTransformer callback. /// - abstract onEmitNode: (EmitHint -> Node -> (EmitHint -> Node -> unit) -> unit) with get, set + abstract onEmitNode: hint: EmitHint * node: Node * emitCallback: (EmitHint -> Node -> unit) -> unit - type [] TransformationResult<'T when 'T :> Node> = + type [] TransformationResult<'T> = /// Gets the transformed source files. abstract transformed: 'T[] with get, set /// Gets diagnostics for the transformation. @@ -6018,7 +6238,7 @@ Use typeAcquisition.enable instead.")>] [] abstract Invoke: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] [] abstract Invoke: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option - type VisitResult<'T when 'T :> Node> = + type VisitResult<'T> = U2<'T, 'T[]> option type [] Printer = @@ -6041,7 +6261,7 @@ Use typeAcquisition.enable instead.")>] /// abstract printNode: hint: EmitHint * node: Node * sourceFile: SourceFile -> string /// Prints a list of nodes using the given format flags - abstract printList: format: ListFormat * list: 'T[] * sourceFile: SourceFile -> string when 'T :> Node + abstract printList: format: ListFormat * list: 'T[] * sourceFile: SourceFile -> string /// Prints a source file as-is, without any emit transformations. abstract printFile: sourceFile: SourceFile -> string /// Prints a bundle of source files as-is, without any emit transformations. @@ -6146,7 +6366,7 @@ Use typeAcquisition.enable instead.")>] | NoSpaceIfEmpty = 524288 | SingleElement = 1048576 | SpaceAfterList = 2097152 - | Modifiers = 262656 + | Modifiers = 2359808 | HeritageClauses = 512 | SingleLineTypeLiteralMembers = 768 | MultiLineTypeLiteralMembers = 32897 @@ -6210,9 +6430,12 @@ Use typeAcquisition.enable instead.")>] abstract includeInlayParameterNameHintsWhenArgumentMatchesName: bool option abstract includeInlayFunctionParameterTypeHints: bool option abstract includeInlayVariableTypeHints: bool option + abstract includeInlayVariableTypeHintsWhenTypeMatchesName: bool option abstract includeInlayPropertyDeclarationTypeHints: bool option abstract includeInlayFunctionLikeReturnTypeHints: bool option abstract includeInlayEnumMemberValueHints: bool option + abstract allowRenameOfImportPath: bool option + abstract autoImportFileExcludePatterns: string[] option /// Represents a bigint literal value without requiring bigint support type [] PseudoBigInt = @@ -6225,7 +6448,7 @@ Use typeAcquisition.enable instead.")>] | Deleted = 2 type [] FileWatcherCallback = - [] abstract Invoke: fileName: string * eventKind: FileWatcherEventKind -> unit + [] abstract Invoke: fileName: string * eventKind: FileWatcherEventKind * ?modifiedTime: DateTime -> unit type [] DirectoryWatcherCallback = [] abstract Invoke: fileName: string -> unit @@ -6327,7 +6550,7 @@ Use typeAcquisition.enable instead.")>] /// getSetExternalModuleIndicator on a valid CompilerOptions object. If not present, the default /// check specified by isFileProbablyExternalModule will be used to set the field. /// - abstract setExternalModuleIndicator: (SourceFile -> unit) option with get, set + abstract setExternalModuleIndicator: file: SourceFile -> unit type [] DiagnosticReporter = [] abstract Invoke: diagnostic: Diagnostic -> unit @@ -6420,7 +6643,7 @@ Use typeAcquisition.enable instead.")>] /// return true if file names are treated with case sensitivity abstract useCaseSensitiveFileNames: unit -> bool /// If provided this would be used this hash instead of actual file shape text for detecting changes - abstract createHash: (string -> string) option with get, set + abstract createHash: data: string -> string /// When emit or emitNextAffectedFile are called without writeFile, /// this callback if present would be used to write files abstract writeFile: WriteFileCallback option with get, set @@ -6460,7 +6683,7 @@ Use typeAcquisition.enable instead.")>] /// In case of EmitAndSemanticDiagnosticsBuilderProgram, when targetSourceFile is specified, /// it is assumed that that file is handled from affected file list. If targetSourceFile is not specified, /// it will only emit all the affected files instead of whole program - /// + /// /// The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host /// in that order would be used to write the files abstract emit: ?targetSourceFile: SourceFile * ?writeFile: WriteFileCallback * ?cancellationToken: CancellationToken * ?emitOnlyDtsFiles: bool * ?customTransformers: CustomTransformers -> EmitResult @@ -6488,7 +6711,7 @@ Use typeAcquisition.enable instead.")>] abstract getCurrentDirectory: unit -> string abstract readFile: fileName: string -> string option - type [] IncrementalProgramOptions<'T when 'T :> BuilderProgram> = + type [] IncrementalProgramOptions<'T> = abstract rootNames: string[] with get, set abstract options: CompilerOptions with get, set abstract configFileParsingDiagnostics: Diagnostic[] option with get, set @@ -6500,7 +6723,7 @@ Use typeAcquisition.enable instead.")>] [] abstract Invoke: diagnostic: Diagnostic * newLine: string * options: CompilerOptions * ?errorCount: float -> unit /// Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program - type [] CreateProgram<'T when 'T :> BuilderProgram> = + type [] CreateProgram<'T> = /// Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program [] abstract Invoke: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: 'T * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> 'T @@ -6517,7 +6740,7 @@ Use typeAcquisition.enable instead.")>] /// If provided, will be used to reset existing delayed compilation abstract clearTimeout: timeoutId: obj option -> unit - type [] ProgramHost<'T when 'T :> BuilderProgram> = + type [] ProgramHost<'T> = /// Used to create the program when need for program creation or recreation detected abstract createProgram: CreateProgram<'T> with get, set abstract useCaseSensitiveFileNames: unit -> bool @@ -6548,8 +6771,10 @@ Use typeAcquisition.enable instead.")>] abstract resolveModuleNames: moduleNames: string[] * containingFile: string * reusedNames: string[] option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResolvedModule option[] /// If provided, used to resolve type reference directives, otherwise typescript's default resolution abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: U2 * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingFileMode: obj -> ResolvedTypeReferenceDirective option[] + /// Returns the module resolution cache used by a provided resolveModuleNames implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it + abstract getModuleResolutionCache: unit -> ModuleResolutionCache option - type [] WatchCompilerHost<'T when 'T :> BuilderProgram> = + type [] WatchCompilerHost<'T> = inherit ProgramHost<'T> inherit WatchHost /// Instead of using output d.ts file from project reference, use its source file @@ -6560,7 +6785,7 @@ Use typeAcquisition.enable instead.")>] abstract afterProgramCreate: program: 'T -> unit /// Host to create watch with root files and options - type [] WatchCompilerHostOfFilesAndCompilerOptions<'T when 'T :> BuilderProgram> = + type [] WatchCompilerHostOfFilesAndCompilerOptions<'T> = inherit WatchCompilerHost<'T> /// root files to use to generate program abstract rootFiles: string[] with get, set @@ -6571,7 +6796,7 @@ Use typeAcquisition.enable instead.")>] abstract projectReferences: ProjectReference[] option with get, set /// Host to create watch with config file - type [] WatchCompilerHostOfConfigFile<'T when 'T :> BuilderProgram> = + type [] WatchCompilerHostOfConfigFile<'T> = inherit WatchCompilerHost<'T> inherit ConfigFileDiagnosticsReporter /// Name of the config file to compile @@ -6616,13 +6841,13 @@ Use typeAcquisition.enable instead.")>] abstract fileName: string with get, set abstract line: float with get, set - type [] SolutionBuilderHostBase<'T when 'T :> BuilderProgram> = + type [] SolutionBuilderHostBase<'T> = inherit ProgramHost<'T> abstract createDirectory: path: string -> unit /// Should provide create directory and writeFile if done of invalidatedProjects is not invoked with /// writeFileCallback abstract writeFile: path: string * data: string * ?writeByteOrderMark: bool -> unit - abstract getCustomTransformers: (string -> CustomTransformers option) option with get, set + abstract getCustomTransformers: project: string -> CustomTransformers option abstract getModifiedTime: fileName: string -> DateTime option abstract setModifiedTime: fileName: string * date: DateTime -> unit abstract deleteFile: fileName: string -> unit @@ -6631,15 +6856,15 @@ Use typeAcquisition.enable instead.")>] abstract reportSolutionBuilderStatus: DiagnosticReporter with get, set abstract afterProgramEmitAndDiagnostics: program: 'T -> unit - type [] SolutionBuilderHost<'T when 'T :> BuilderProgram> = + type [] SolutionBuilderHost<'T> = inherit SolutionBuilderHostBase<'T> abstract reportErrorSummary: ReportEmitErrorSummary option with get, set - type [] SolutionBuilderWithWatchHost<'T when 'T :> BuilderProgram> = + type [] SolutionBuilderWithWatchHost<'T> = inherit SolutionBuilderHostBase<'T> inherit WatchHost - type [] SolutionBuilder<'T when 'T :> BuilderProgram> = + type [] SolutionBuilder<'T> = abstract build: ?project: string * ?cancellationToken: CancellationToken * ?writeFile: WriteFileCallback * ?getCustomTransformers: (string -> CustomTransformers) -> ExitStatus abstract clean: ?project: string -> ExitStatus abstract buildReferences: project: string * ?cancellationToken: CancellationToken * ?writeFile: WriteFileCallback * ?getCustomTransformers: (string -> CustomTransformers) -> ExitStatus @@ -6664,7 +6889,7 @@ Use typeAcquisition.enable instead.")>] abstract kind: InvalidatedProjectKind abstract updateOutputFileStatmps: unit -> unit - type [] BuildInvalidedProject<'T when 'T :> BuilderProgram> = + type [] BuildInvalidedProject<'T> = inherit InvalidatedProjectBase abstract kind: InvalidatedProjectKind abstract getBuilderProgram: unit -> 'T option @@ -6680,12 +6905,12 @@ Use typeAcquisition.enable instead.")>] abstract getSemanticDiagnosticsOfNextAffectedFile: ?cancellationToken: CancellationToken * ?ignoreSourceFile: (SourceFile -> bool) -> AffectedFileResult abstract emit: ?targetSourceFile: SourceFile * ?writeFile: WriteFileCallback * ?cancellationToken: CancellationToken * ?emitOnlyDtsFiles: bool * ?customTransformers: CustomTransformers -> EmitResult option - type [] UpdateBundleProject<'T when 'T :> BuilderProgram> = + type [] UpdateBundleProject<'T> = inherit InvalidatedProjectBase abstract kind: InvalidatedProjectKind abstract emit: ?writeFile: WriteFileCallback * ?customTransformers: CustomTransformers -> U2> option - type [] [] InvalidatedProject<'T when 'T :> BuilderProgram> = + type [] [] InvalidatedProject<'T> = | [] BuildInvalidedProject of BuildInvalidedProject<'T> | [] UpdateBundleProject of UpdateBundleProject<'T> | [] UpdateOutputFileStampsProject of UpdateOutputFileStampsProject @@ -6890,16 +7115,16 @@ Use typeAcquisition.enable instead.")>] abstract cleanupSemanticCache: unit -> unit /// /// Gets errors indicating invalid syntax in a file. - /// + /// /// In English, "this cdeo have, erorrs" is syntactically invalid because it has typos, /// grammatical errors, and misplaced punctuation. Likewise, examples of syntax /// errors in TypeScript are missing parentheses in an if statement, mismatched /// curly braces, and using a reserved keyword as a variable name. - /// + /// /// These diagnostics are inexpensive to compute and don't require knowledge of /// other files. Note that a non-empty result increases the likelihood of false positives /// from getSemanticDiagnostics. - /// + /// /// While these represent the majority of syntax-related diagnostics, there are some /// that require the type system, which will be present in getSemanticDiagnostics. /// @@ -6909,11 +7134,11 @@ Use typeAcquisition.enable instead.")>] /// Gets warnings or errors indicating type system issues in a given file. /// Requesting semantic diagnostics may start up the type system and /// run deferred work, so the first call may take longer than subsequent calls. - /// + /// /// Unlike the other get*Diagnostics functions, these diagnostics can potentially not /// include a reference to a source file. Specifically, the first time this is called, /// it will return global diagnostics with no associated location. - /// + /// /// To contrast the differences between semantic and syntactic diagnostics, consider the /// sentence: "The sun is green." is syntactically correct; those are real English words with /// correct sentence structure. However, it is semantically invalid, because it is not true. @@ -6975,6 +7200,8 @@ Use typeAcquisition.enable instead.")>] abstract getNameOrDottedNameSpan: fileName: string * startPos: float * endPos: float -> TextSpan option abstract getBreakpointStatementAtPosition: fileName: string * position: float -> TextSpan option abstract getSignatureHelpItems: fileName: string * position: float * options: SignatureHelpItemsOptions option -> SignatureHelpItems option + abstract getRenameInfo: fileName: string * position: float * preferences: UserPreferences -> RenameInfo + [] abstract getRenameInfo: fileName: string * position: float * ?options: RenameInfoOptions -> RenameInfo abstract findRenameLocations: fileName: string * position: float * findInStrings: bool * findInComments: bool * ?providePrefixAndSuffixTextForRename: bool -> RenameLocation[] option abstract getSmartSelectionRange: fileName: string * position: float -> SelectionRange @@ -7049,8 +7276,8 @@ Use typeAcquisition.enable instead.")>] abstract skipDestructiveCodeActions: bool option with get, set type [] [] CompletionsTriggerCharacter = - | [] Period - | [] Backslash + | [] Dot + | [] BackSlash | [] SingleQuote | [] BackQuote | [] Slash @@ -7254,7 +7481,7 @@ Use typeAcquisition.enable instead.")>] /// Inlineable refactorings can have their actions hoisted out to the top level /// of a context menu. Non-inlineanable refactorings should always be shown inside /// their parent grouping. - /// + /// /// If not specified, this value is assumed to be 'true' abstract inlineable: bool option with get, set abstract actions: RefactorActionInfo[] with get, set @@ -7352,6 +7579,7 @@ Use typeAcquisition.enable instead.")>] | Insert | Remove + [] type [] EditorOptions = abstract BaseIndentSize: float option with get, set abstract IndentSize: float with get, set @@ -7369,6 +7597,7 @@ Use typeAcquisition.enable instead.")>] abstract indentStyle: IndentStyle option with get, set abstract trimTrailingWhitespace: bool option with get, set + [] type [] FormatCodeOptions = inherit EditorOptions abstract InsertSpaceAfterCommaDelimiter: bool with get, set @@ -7504,6 +7733,7 @@ Use typeAcquisition.enable instead.")>] abstract canRename: bool with get, set abstract localizedErrorMessage: string with get, set + [] type [] RenameInfoOptions = abstract allowRenameOfImportPath: bool option @@ -7886,10 +8116,10 @@ Use typeAcquisition.enable instead.")>] /// the same DocumentRegistry instance between different instances of LanguageService allow /// for more efficient memory utilization since all projects will share at least the library /// file (lib.d.ts). - /// + /// /// A more advanced use of the document registry is to serialize sourceFile objects to disk /// and re-hydrate them when needed. - /// + /// /// To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it /// to all subsequent createLanguageService calls. type [] DocumentRegistry = @@ -7915,8 +8145,8 @@ Use typeAcquisition.enable instead.")>] /// Current version of the file. Only used if the file was not found /// in the registry and a new one was created. /// - abstract acquireDocument: fileName: string * compilationSettingsOrHost: U2 * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile - abstract acquireDocumentWithKey: fileName: string * path: Path * compilationSettingsOrHost: U2 * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile + abstract acquireDocument: fileName: string * compilationSettingsOrHost: U2 * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind * ?sourceFileOptions: U2 -> SourceFile + abstract acquireDocumentWithKey: fileName: string * path: Path * compilationSettingsOrHost: U2 * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind * ?sourceFileOptions: U2 -> SourceFile /// /// Request an updated version of an already existing SourceFile with a given fileName /// and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile @@ -7933,24 +8163,25 @@ Use typeAcquisition.enable instead.")>] /// /// Text of the file. /// Current version of the file. - abstract updateDocument: fileName: string * compilationSettingsOrHost: U2 * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile - abstract updateDocumentWithKey: fileName: string * path: Path * compilationSettingsOrHost: U2 * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile + abstract updateDocument: fileName: string * compilationSettingsOrHost: U2 * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind * ?sourceFileOptions: U2 -> SourceFile + abstract updateDocumentWithKey: fileName: string * path: Path * compilationSettingsOrHost: U2 * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind * ?sourceFileOptions: U2 -> SourceFile abstract getKeyForCompilationSettings: settings: CompilerOptions -> DocumentRegistryBucketKey - [] - abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions -> unit + [] + abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions * ?scriptKind: ScriptKind -> unit /// /// Informs the DocumentRegistry that a file is not needed any longer. - /// + /// /// Note: It is not allowed to call release on a SourceFile that was not acquired from /// this registry originally. /// /// The name of the file to be released /// The compilation settings used to acquire the file /// The script kind of the file to be released - abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions * scriptKind: ScriptKind -> unit - [] - abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey -> unit - abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey * scriptKind: ScriptKind -> unit + /// The implied source file format of the file to be released + abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions * scriptKind: ScriptKind * impliedNodeFormat: obj -> unit + [] + abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey * ?scriptKind: ScriptKind -> unit + abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey * scriptKind: ScriptKind * impliedNodeFormat: obj -> unit abstract reportStats: unit -> string type [] DocumentRegistryBucketKey = diff --git a/lib/Parser.fs b/lib/Parser.fs index 79a4fbc8..1ce95f9b 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -57,6 +57,9 @@ module private ParserImpl = ctx.logger.errorf "%s at %s\n%s" s (Node.ppLocation node) (Node.ppLine node) ) format + let modifiers (n: Ts.Node) = + if ts.canHaveModifiers(n) then ts.getModifiers(!!n) else None + let hasModifier (kind: Ts.SyntaxKind) (modifiers: Ts.ModifiersArray option) = match modifiers with | None -> false @@ -384,13 +387,13 @@ module private ParserImpl = | Kind.ArrayType -> let t = t :?> Ts.ArrayTypeNode let elem = readTypeNode typrm ctx t.elementType - if isReadOnly t.modifiers then + if t |> modifiers |> isReadOnly then App (APrim ReadonlyArray, [elem], Node.location t) else App (APrim Array, [elem], Node.location t) | Kind.TupleType -> let t = t :?> Ts.TupleTypeNode - readTupleTypeNode typrm ctx t (isReadOnly t.modifiers) + readTupleTypeNode typrm ctx t (t |> modifiers |> isReadOnly) // complex types | Kind.IntrinsicKeyword -> Intrinsic | Kind.ThisType -> PolymorphicThis @@ -545,8 +548,9 @@ module private ParserImpl = { args = args; isVariadic = isVariadic; returnType = retType; loc = Node.location parent } and readMemberAttribute (ctx: ParserContext) (nd: Ts.NamedDeclaration) : MemberAttribute = - let accessibility = getAccessibility nd.modifiers |? Public - let isStatic = hasModifier Kind.StaticKeyword nd.modifiers + let modifiers = modifiers nd + let accessibility = getAccessibility modifiers |? Public + let isStatic = hasModifier Kind.StaticKeyword modifiers let comments = readCommentsForNamedDeclaration ctx nd { accessibility = accessibility; isStatic = isStatic; comments = comments; loc = Node.location nd } @@ -578,7 +582,7 @@ module private ParserImpl = match ty with | Choice1Of2 t -> { args = []; isVariadic = false; returnType = t; loc = Node.location nd } | Choice2Of2 ft -> ft - attr, SymbolIndexer (symbolName, ft, if isReadOnly nd.modifiers then ReadOnly else Mutable) + attr, SymbolIndexer (symbolName, ft, if isReadOnly (modifiers nd) then ReadOnly else Mutable) | _ -> fail () | _ -> fail () @@ -616,7 +620,7 @@ module private ParserImpl = | _ -> () let isOptional = nd.questionToken |> Option.isSome let fl = { name = name; isOptional = isOptional; value = ty } - attr, Field (fl, (if isReadOnly nd.modifiers then ReadOnly else Mutable)) + attr, Field (fl, (if isReadOnly (modifiers nd) then ReadOnly else Mutable)) | Error _ -> nodeWarn ctx nd "unsupported property name '%s' in PropertyDeclaration" (getText nd.name); (attr, UnknownMember (Some (getText nd))) | Kind.CallSignature -> let nd = nd :?> Ts.CallSignatureDeclaration @@ -728,14 +732,15 @@ module private ParserImpl = let readClass (ctx: ParserContext) (i: Ts.ClassDeclaration) : Class = let typrms = readTypeParameters Set.empty ctx i.typeParameters let typrmsSet = typrms |> List.map (fun tp -> tp.name) |> Set.ofList + let modifiers = modifiers i { comments = readCommentsForNamedDeclaration ctx i name = i.name |> Option.map (fun id -> Name id.text) |? ExportDefaultUnnamedClass - accessibility = getAccessibility i.modifiers |? Public + accessibility = getAccessibility modifiers |? Public typeParams = typrms implements = readInherits typrmsSet ctx i.heritageClauses isInterface = false - isExported = getExported i.modifiers + isExported = getExported modifiers members = i.members |> Array.map (readNamedDeclaration typrmsSet ctx) |> List.ofArray loc = Node.location i } @@ -804,8 +809,9 @@ module private ParserImpl = nodeWarn ctx vd "type missing for variable '%s'" name UnknownType None let isConst = (int vd.flags) ||| (int Ts.NodeFlags.Const) <> 0 - let isExported = getExported vd.modifiers - let accessibility = getAccessibility vd.modifiers + let modifiers = modifiers vd + let isExported = getExported modifiers + let accessibility = getAccessibility modifiers Variable { comments = comments; loc = Node.location vd; name = name; typ = ty; isConst = isConst; isExported = isExported; accessibility = accessibility } ) |> List.ofArray diff --git a/package.json b/package.json index a5fc7c59..cb4f8c78 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@babel/code-frame": "^7.18.6", "browser-or-node": "^2.0.0", "chalk": "^5.0.1", - "typescript": "4.7", + "typescript": "4.8", "yargs": "17.5.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 15cfdfba..1923e184 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2325,10 +2325,10 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -typescript@4.7: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@4.8: + version "4.8.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" + integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" From 6733a6a3f6e95ec3137e87f28922d7312f5e7ee6 Mon Sep 17 00:00:00 2001 From: cannorin Date: Fri, 14 Jul 2023 01:14:57 +0900 Subject: [PATCH 16/17] Update TypeScript to 5.1 --- .github/workflows/ci.yml | 4 +- .github/workflows/publish.yml | 4 +- build/BindingUpdater.fs | 34 + build.fs => build/build.fs | 16 +- build.fsproj => build/build.fsproj | 25 +- docs/development.md | 10 +- fake | 13 + fake.cmd | 4 + lib/Bindings/TypeScript.fs | 4099 +++++++++++++++----------- lib/Extensions.fs | 5 + lib/Parser.fs | 32 +- package.json | 7 +- src/Targets/JsOfOCaml/OCamlHelper.fs | 1 + src/Targets/JsOfOCaml/Writer.fs | 31 +- ts2ocaml.sln | 2 +- yarn.lock | 52 +- 16 files changed, 2548 insertions(+), 1791 deletions(-) create mode 100644 build/BindingUpdater.fs rename build.fs => build/build.fs (95%) rename build.fsproj => build/build.fsproj (89%) create mode 100644 fake create mode 100644 fake.cmd diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8459e873..f4991c31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,8 +55,8 @@ jobs: - name: Install OCaml Dependencies run: opam install . --deps-only - - name: Run build.fs - run: dotnet run target Test + - name: Build and test the project + run: ./fake test auto-merge: name: Auto-Merge PRs by Dependabot diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 847c341e..bcf3c3b6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,8 +48,8 @@ jobs: - name: Install OCaml Dependencies run: opam install . --deps-only - - name: Run build.fs - run: dotnet run target All + - name: Build the project + run: ./fake - name: Push js_of_ocaml standard library to jsoo-stdlib if: success() diff --git a/build/BindingUpdater.fs b/build/BindingUpdater.fs new file mode 100644 index 00000000..b0d1aff7 --- /dev/null +++ b/build/BindingUpdater.fs @@ -0,0 +1,34 @@ +module BindingUpdater + +open Fake.Core +open Fake.IO +open System.Text.RegularExpressions + +let commonOptions = "--noresizearray --convertpropfns --tagged-union --remove-obsolete" +let ts2fable (srcs: string list) (dest: string) = + let src = srcs |> String.concat " " + Shell.Exec( + "yarn", + $"ts2fable {src} {dest} {commonOptions}" + ) + +let typeParamConstraints = + new Regex("""when '\w+ :> \w+(?: and '\w+ :> \w+)*""", RegexOptions.Compiled) + +let erasedCast = + new Regex("""static member inline op_ErasedCast.+$""", RegexOptions.Compiled ||| RegexOptions.Multiline) + +let replace (regex: Regex) (replacement: string) (s: string) = + printfn $"{regex.ToString()} ==> {replacement}" + regex.Replace(s, replacement) + +let typescript () = + let dest = "lib/Bindings/TypeScript.fs" + ts2fable ["node_modules/typescript/lib/typescript.d.ts"] dest |> ignore + File.readAsString dest + |> replace typeParamConstraints "" + |> replace erasedCast "// $&" + |> File.writeString false dest + +let run () = + typescript () \ No newline at end of file diff --git a/build.fs b/build/build.fs similarity index 95% rename from build.fs rename to build/build.fs index 3abc06eb..3df90a61 100644 --- a/build.fs +++ b/build/build.fs @@ -55,12 +55,11 @@ let setup () = Target.create "Restore" <| fun _ -> DotNet.restore - (DotNet.Options.withWorkingDirectory __SOURCE_DIRECTORY__) + id "ts2ocaml.sln" Target.create "YarnInstall" <| fun _ -> - Yarn.installFrozenLockFile (fun ``params`` -> - { ``params`` with WorkingDirectory = "./" }) + Yarn.installFrozenLockFile id Target.create "Prepare" ignore @@ -234,9 +233,17 @@ module Publish = "Build" ?=> "Test" ?=> "Publish" +// Utility targets + +module Utility = + let setup () = + Target.create "UpdateBindings" <| fun _ -> BindingUpdater.run () + "Prepare" ==> "UpdateBindings" + [] let main argv = - Shell.cd __SOURCE_DIRECTORY__ + // ensure working at the repository root + Shell.cd (Path.combine __SOURCE_DIRECTORY__ "..") argv |> Array.toList @@ -247,6 +254,7 @@ let main argv = setup () Test.setup () Publish.setup () + Utility.setup () Target.create "All" ignore "Prepare" diff --git a/build.fsproj b/build/build.fsproj similarity index 89% rename from build.fsproj rename to build/build.fsproj index 0679a0d3..9d9942e3 100644 --- a/build.fsproj +++ b/build/build.fsproj @@ -1,14 +1,12 @@ - - - - Exe - net6.0 - - - - - - + + + Exe + net6.0 + + + + + @@ -18,6 +16,5 @@ - - - + + \ No newline at end of file diff --git a/docs/development.md b/docs/development.md index b5cc20f6..a42146ff 100644 --- a/docs/development.md +++ b/docs/development.md @@ -42,7 +42,7 @@ Modules with **\[\\]** does not require `open` to use. - [.NET SDK 6.0](https://dotnet.microsoft.com/download/dotnet/6.0) - [Fable](https://fable.io/) is required to build this tool. - - Run `dotnet tool restore` in the root directory of this repo to install them. + - Run `dotnet tool restore` in the root directory of this repo to install it. - OCaml 4.08 or higher - [js_of_ocaml](https://github.com/ocsigen/js_of_ocaml) should be installed to your opam switch. @@ -54,13 +54,13 @@ Modules with **\[\\]** does not require `open` to use. ## Debugging -`dotnet run -t Watch` to live update `dist/ts2ocaml.js`. +`./fake watch` to live update `dist/ts2ocaml.js`. It will be bundled by Webpack with the `development` mode. ## Building -`dotnet run -t Build` performs the followings: +`./fake build` performs the followings: - `yarn install` to populate `node_modules` - `dotnet restore ts2ocaml.sln` to install required F# libraries - Compile F# source files into JS source files (through Fable) @@ -70,7 +70,7 @@ The resulting `dist/ts2ocaml.js` is then ready to run through `node`. ## Testing -`dotnet run -t Test` builds the tool and then performs the followings: +`./fake test` builds the tool and then performs the followings: ### Test the tool for [`js_of_ocaml` target](js_of_ocaml.md) @@ -92,7 +92,7 @@ The resulting `dist/ts2ocaml.js` is then ready to run through `node`. ## Publishing -`dotnet run -t Publish` builds the tool, runs the tests, and then performs the followings: +`./fake publish` builds the tool, runs the tests, and then performs the followings: ### Prepare for publishing the standard library for [`js_of_ocaml` target](js_of_ocaml.md) to the `jsoo-stdlib` branch diff --git a/fake b/fake new file mode 100644 index 00000000..d1f7bb53 --- /dev/null +++ b/fake @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -eu +set -o pipefail + +echo "Restoring dotnet tools..." +dotnet tool restore + +if [ -z "$@"]; then + FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj +else + FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj -- -t "$@" +fi \ No newline at end of file diff --git a/fake.cmd b/fake.cmd new file mode 100644 index 00000000..f36588f3 --- /dev/null +++ b/fake.cmd @@ -0,0 +1,4 @@ +echo Restoring dotnet tools... +dotnet tool restore + +dotnet run --project ./build/build.fsproj -- -t %* \ No newline at end of file diff --git a/lib/Bindings/TypeScript.fs b/lib/Bindings/TypeScript.fs index fcb47780..ffa9cc4b 100644 --- a/lib/Bindings/TypeScript.fs +++ b/lib/Bindings/TypeScript.fs @@ -1,4 +1,4 @@ -// ts2fable 0.8.0-build.664 +// ts2fable 0.8.0-build.723 module rec TypeScript #nowarn "3390" // disable warnings for invalid XML comments @@ -10,15 +10,11 @@ open Fable.Core.JS type Array<'T> = System.Collections.Generic.IList<'T> type ReadonlyArray<'T> = System.Collections.Generic.IReadOnlyList<'T> -type ReadonlySet<'T> = Set<'T> +type ReadonlyMap<'K, 'V> = Map<'K, 'V> type Symbol = obj let [] ts: Ts.IExports = jsNative -type [] IExports = - abstract setTimeout: handler: (obj option[] -> unit) * timeout: float -> obj option - abstract clearTimeout: handle: obj option -> unit - module Ts = let [] scriptSnapshot: ScriptSnapshot.IExports = jsNative @@ -27,7 +23,6 @@ module Ts = /// The version of the TypeScript compiler release abstract version: string abstract OperationCanceledException: OperationCanceledExceptionStatic - abstract getNodeMajorVersion: unit -> float option abstract sys: System with get, set abstract tokenToString: t: SyntaxKind -> string option abstract getPositionOfLineAndCharacter: sourceFile: SourceFileLike * line: float * character: float -> float @@ -41,8 +36,8 @@ module Ts = abstract forEachLeadingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'T -> 'U) * state: 'T -> 'U option abstract forEachTrailingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'U) -> 'U option abstract forEachTrailingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'T -> 'U) * state: 'T -> 'U option - abstract reduceEachLeadingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'T -> 'U -> 'U) * state: 'T * initial: 'U -> 'U option - abstract reduceEachTrailingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'T -> 'U -> 'U) * state: 'T * initial: 'U -> 'U option + abstract reduceEachLeadingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'T -> 'U) * state: 'T * initial: 'U -> 'U option + abstract reduceEachTrailingCommentRange: text: string * pos: float * cb: (float -> float -> CommentKind -> bool -> 'T -> 'U) * state: 'T * initial: 'U -> 'U option abstract getLeadingCommentRanges: text: string * pos: float -> CommentRange[] option abstract getTrailingCommentRanges: text: string * pos: float -> CommentRange[] option /// Optionally, get the shebang @@ -51,7 +46,7 @@ module Ts = abstract isIdentifierPart: ch: float * languageVersion: ScriptTarget option * ?identifierVariant: LanguageVariant -> bool abstract createScanner: languageVersion: ScriptTarget * skipTrivia: bool * ?languageVariant: LanguageVariant * ?textInitial: string * ?onError: ErrorCallback * ?start: float * ?length: float -> Scanner abstract isExternalModuleNameRelative: moduleName: string -> bool - abstract sortAndDeduplicateDiagnostics: diagnostics: 'T[] -> SortedReadonlyArray<'T> + abstract sortAndDeduplicateDiagnostics: diagnostics: 'T[] -> SortedReadonlyArray<'T> abstract getDefaultLibFileName: options: CompilerOptions -> string abstract textSpanEnd: span: TextSpan -> float abstract textSpanIsEmpty: span: TextSpan -> bool @@ -69,7 +64,6 @@ module Ts = abstract textChangeRangeNewSpan: range: TextChangeRange -> TextSpan abstract textChangeRangeIsUnchanged: range: TextChangeRange -> bool abstract createTextChangeRange: span: TextSpan * newLength: float -> TextChangeRange - abstract unchangedTextChangeRange: TextChangeRange with get, set /// Called to merge all the changes that occurred across several versions of a script snapshot /// into a single change. i.e. if a user keeps making successive edits to a script we will /// have a text change from V1 to V2, V2 to V3, ..., Vn. @@ -80,22 +74,22 @@ module Ts = abstract getTypeParameterOwner: d: Declaration -> Declaration option abstract isParameterPropertyDeclaration: node: Node * parent: Node -> bool abstract isEmptyBindingPattern: node: BindingName -> bool - abstract isEmptyBindingElement: node: BindingElement -> bool + abstract isEmptyBindingElement: node: U2 -> bool abstract walkUpBindingElementsAndPatterns: binding: BindingElement -> U2 abstract getCombinedModifierFlags: node: Declaration -> ModifierFlags abstract getCombinedNodeFlags: node: Node -> NodeFlags /// Checks to see if the locale is in the appropriate format, /// and if it is, attempts to set the appropriate language. - abstract validateLocaleAndSetLanguage: locale: string * sys: {| getExecutingFilePath: unit -> string; resolvePath: string -> string; fileExists: string -> bool; readFile: string -> string option |} * ?errors: Push -> unit + abstract validateLocaleAndSetLanguage: locale: string * sys: {| getExecutingFilePath: unit -> string; resolvePath: string -> string; fileExists: string -> bool; readFile: string -> string option |} * ?errors: Diagnostic[] -> unit abstract getOriginalNode: node: Node -> Node - abstract getOriginalNode: node: Node * nodeTest: (Node -> bool) -> 'T + abstract getOriginalNode: node: Node * nodeTest: (Node -> bool) -> 'T abstract getOriginalNode: node: Node option -> Node option - abstract getOriginalNode: node: Node option * nodeTest: (Node option -> bool) -> 'T option + abstract getOriginalNode: node: Node option * nodeTest: (Node -> bool) -> 'T option /// Iterates through the parent chain of a node and performs the callback on each parent until the callback /// returns a truthy value, then returns that value. /// If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" /// At that point findAncestor returns undefined. - abstract findAncestor: node: Node option * callback: (Node -> bool) -> 'T option + abstract findAncestor: node: Node option * callback: (Node -> bool) -> 'T option abstract findAncestor: node: Node option * callback: (Node -> U2) -> Node option /// Gets a value indicating whether a node originated in the parse tree. /// The node to test. @@ -108,7 +102,7 @@ module Ts = /// The original node. /// A callback used to ensure the correct type of parse tree node is returned. /// The original parse tree node if found; otherwise, undefined. - abstract getParseTreeNode: node: 'T option * ?nodeTest: (Node -> bool) -> 'T option + abstract getParseTreeNode: node: 'T option * ?nodeTest: (Node -> bool) -> 'T option /// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' abstract escapeLeadingUnderscores: identifier: string -> __String /// Remove extra underscore from escaped identifier text content. @@ -116,6 +110,9 @@ module Ts = /// The unescaped identifier text. abstract unescapeLeadingUnderscores: identifier: __String -> string abstract idText: identifierOrPrivateName: U2 -> string + /// If the text of an Identifier matches a keyword (including contextual and TypeScript-specific keywords), returns the + /// SyntaxKind for the matching keyword. + abstract identifierToKeywordKind: node: Identifier -> KeywordSyntaxKind option abstract symbolName: symbol: Symbol -> string abstract getNameOfJSDocTypedef: declaration: JSDocTypedefTag -> U2 option abstract getNameOfDeclaration: declaration: U2 option -> DeclarationName option @@ -174,6 +171,7 @@ module Ts = abstract getJSDocReturnTag: node: Node -> JSDocReturnTag option /// Gets the JSDoc template tag for the node if present abstract getJSDocTemplateTag: node: Node -> JSDocTemplateTag option + abstract getJSDocSatisfiesTag: node: Node -> JSDocSatisfiesTag option /// Gets the JSDoc type tag for the node if present and valid abstract getJSDocTypeTag: node: Node -> JSDocTypeTag option /// Gets the type node for the node if provided via JSDoc. @@ -196,7 +194,7 @@ module Ts = /// Get all JSDoc tags related to a node, including those on parent nodes. abstract getJSDocTags: node: Node -> JSDocTag[] /// Gets all JSDoc tags that match a specified predicate - abstract getAllJSDocTags: node: Node * predicate: (JSDocTag -> bool) -> 'T[] + abstract getAllJSDocTags: node: Node * predicate: (JSDocTag -> bool) -> 'T[] /// Gets all JSDoc tags of a specified kind abstract getAllJSDocTagsOfKind: node: Node * kind: SyntaxKind -> JSDocTag[] /// Gets the text of a jsdoc comment, flattening links to their text. @@ -225,8 +223,6 @@ module Ts = abstract isNonNullChain: node: Node -> bool abstract isBreakOrContinueStatement: node: Node -> bool abstract isNamedExportBindings: node: Node -> bool - abstract isUnparsedTextLike: node: Node -> bool - abstract isUnparsedNode: node: Node -> bool abstract isJSDocPropertyLikeTag: node: Node -> bool /// True if kind is of some token syntax kind. /// For example, this is true for an IfKeyword but not for an IfStatement. @@ -240,6 +236,8 @@ module Ts = abstract isTemplateLiteralToken: node: Node -> bool abstract isTemplateMiddleOrTemplateTail: node: Node -> bool abstract isImportOrExportSpecifier: node: Node -> bool + abstract isTypeOnlyImportDeclaration: node: Node -> bool + abstract isTypeOnlyExportDeclaration: node: Node -> bool abstract isTypeOnlyImportOrExportDeclaration: node: Node -> bool abstract isAssertionKey: node: Node -> bool abstract isStringTextContainingNode: node: Node -> bool @@ -251,6 +249,7 @@ module Ts = abstract isClassElement: node: Node -> bool abstract isClassLike: node: Node -> bool abstract isAccessor: node: Node -> bool + abstract isAutoAccessorPropertyDeclaration: node: Node -> bool abstract isModifierLike: node: Node -> bool abstract isTypeElement: node: Node -> bool abstract isClassOrTypeElement: node: Node -> bool @@ -262,12 +261,28 @@ module Ts = /// abstract isTypeNode: node: Node -> bool abstract isFunctionOrConstructorTypeNode: node: Node -> bool + abstract isArrayBindingElement: node: Node -> bool abstract isPropertyAccessOrQualifiedName: node: Node -> bool abstract isCallLikeExpression: node: Node -> bool abstract isCallOrNewExpression: node: Node -> bool abstract isTemplateLiteral: node: Node -> bool + abstract isLeftHandSideExpression: node: Node -> bool + abstract isLiteralTypeLiteral: node: Node -> bool + /// Determines whether a node is an expression based only on its kind. + abstract isExpression: node: Node -> bool abstract isAssertionExpression: node: Node -> bool + [] abstract isIterationStatement_false: node: Node -> bool abstract isIterationStatement: node: Node * lookInLabeledStatements: bool -> bool + abstract isConciseBody: node: Node -> bool + abstract isForInitializer: node: Node -> bool + abstract isModuleBody: node: Node -> bool + abstract isNamedImportBindings: node: Node -> bool + abstract isStatement: node: Node -> bool + abstract isModuleReference: node: Node -> bool + abstract isJsxTagNameExpression: node: Node -> bool + abstract isJsxChild: node: Node -> bool + abstract isJsxAttributeLike: node: Node -> bool + abstract isStringLiteralOrJsxExpression: node: Node -> bool abstract isJsxOpeningLikeElement: node: Node -> bool abstract isCaseOrDefaultClause: node: Node -> bool /// True if node is of a kind that may contain comment text. @@ -277,52 +292,67 @@ module Ts = /// True if has initializer node attached to it. abstract hasOnlyExpressionInitializer: node: Node -> bool abstract isObjectLiteralElement: node: Node -> bool - abstract isStringLiteralLike: node: Node -> bool + abstract isStringLiteralLike: node: U2 -> bool abstract isJSDocLinkLike: node: Node -> bool abstract hasRestParameter: s: U2 -> bool abstract isRestParameter: node: U2 -> bool - abstract factory: NodeFactory - abstract createUnparsedSourceFile: text: string -> UnparsedSource - abstract createUnparsedSourceFile: inputFile: InputFiles * ``type``: IExportsCreateUnparsedSourceFile * ?stripInternal: bool -> UnparsedSource - abstract createUnparsedSourceFile: text: string * mapPath: string option * map: string option -> UnparsedSource - abstract createInputFiles: javascriptText: string * declarationText: string -> InputFiles - abstract createInputFiles: readFileText: (string -> string option) * javascriptPath: string * javascriptMapPath: string option * declarationPath: string * declarationMapPath: string option * buildInfoPath: string option -> InputFiles - abstract createInputFiles: javascriptText: string * declarationText: string * javascriptMapPath: string option * javascriptMapText: string option * declarationMapPath: string option * declarationMapText: string option -> InputFiles + abstract unchangedTextChangeRange: TextChangeRange with get, set + /// + /// This function checks multiple locations for JSDoc comments that apply to a host node. + /// At each location, the whole comment may apply to the node, or only a specific tag in + /// the comment. In the first case, location adds the entire object. In the + /// second case, it adds the applicable . + /// + /// For example, a JSDoc comment before a parameter adds the entire . But a + /// @param tag on the parent function only adds the for the @param. + /// + /// + /// /** JSDoc will be returned for `a` *\/ + /// const a = 0 + /// /** + /// * Entire JSDoc will be returned for `b` + /// * @param c JSDocTag will be returned for `c` + /// *\/ + /// function b(/** JSDoc will be returned for `c` *\/ c) {} + /// + /// + abstract getJSDocCommentsAndTags: hostNode: Node -> U2[] /// Create an external source map source file reference abstract createSourceMapSource: fileName: string * text: string * ?skipTrivia: (float -> float) -> SourceMapSource - abstract setOriginalNode: node: 'T * original: Node option -> 'T + abstract setOriginalNode: node: 'T * original: Node option -> 'T + abstract factory: NodeFactory /// Clears any EmitNode entries from parse-tree nodes. /// A source file. abstract disposeEmitNodes: sourceFile: SourceFile option -> unit /// Sets flags that control emit behavior of a node. - abstract setEmitFlags: node: 'T * emitFlags: EmitFlags -> 'T + abstract setEmitFlags: node: 'T * emitFlags: EmitFlags -> 'T /// Gets a custom text range to use when emitting source maps. abstract getSourceMapRange: node: Node -> SourceMapRange /// Sets a custom text range to use when emitting source maps. - abstract setSourceMapRange: node: 'T * range: SourceMapRange option -> 'T + abstract setSourceMapRange: node: 'T * range: SourceMapRange option -> 'T /// Gets the TextRange to use for source maps for a token of a node. abstract getTokenSourceMapRange: node: Node * token: SyntaxKind -> SourceMapRange option /// Sets the TextRange to use for source maps for a token of a node. - abstract setTokenSourceMapRange: node: 'T * token: SyntaxKind * range: SourceMapRange option -> 'T + abstract setTokenSourceMapRange: node: 'T * token: SyntaxKind * range: SourceMapRange option -> 'T /// Gets a custom text range to use when emitting comments. abstract getCommentRange: node: Node -> TextRange /// Sets a custom text range to use when emitting comments. - abstract setCommentRange: node: 'T * range: TextRange -> 'T + abstract setCommentRange: node: 'T * range: TextRange -> 'T abstract getSyntheticLeadingComments: node: Node -> SynthesizedComment[] option - abstract setSyntheticLeadingComments: node: 'T * comments: SynthesizedComment[] option -> 'T - abstract addSyntheticLeadingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T + abstract setSyntheticLeadingComments: node: 'T * comments: SynthesizedComment[] option -> 'T + abstract addSyntheticLeadingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T abstract getSyntheticTrailingComments: node: Node -> SynthesizedComment[] option - abstract setSyntheticTrailingComments: node: 'T * comments: SynthesizedComment[] option -> 'T - abstract addSyntheticTrailingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T - abstract moveSyntheticComments: node: 'T * original: Node -> 'T + abstract setSyntheticTrailingComments: node: 'T * comments: SynthesizedComment[] option -> 'T + abstract addSyntheticTrailingComment: node: 'T * kind: SyntaxKind * text: string * ?hasTrailingNewLine: bool -> 'T + abstract moveSyntheticComments: node: 'T * original: Node -> 'T /// Gets the constant value to emit for an expression representing an enum. abstract getConstantValue: node: AccessExpression -> U2 option /// Sets the constant value to emit for an expression. abstract setConstantValue: node: AccessExpression * value: U2 -> AccessExpression /// Adds an EmitHelper to a node. - abstract addEmitHelper: node: 'T * helper: EmitHelper -> 'T + abstract addEmitHelper: node: 'T * helper: EmitHelper -> 'T /// Add EmitHelpers to a node. - abstract addEmitHelpers: node: 'T * helpers: EmitHelper[] option -> 'T + abstract addEmitHelpers: node: 'T * helpers: EmitHelper[] option -> 'T /// Removes an EmitHelper from a node. abstract removeEmitHelper: node: Node * helper: EmitHelper -> bool /// Gets the EmitHelpers of a node. @@ -342,8 +372,15 @@ module Ts = abstract isPlusToken: node: Node -> bool abstract isMinusToken: node: Node -> bool abstract isAsteriskToken: node: Node -> bool + abstract isExclamationToken: node: Node -> bool + abstract isQuestionToken: node: Node -> bool + abstract isColonToken: node: Node -> bool + abstract isQuestionDotToken: node: Node -> bool + abstract isEqualsGreaterThanToken: node: Node -> bool abstract isIdentifier: node: Node -> bool abstract isPrivateIdentifier: node: Node -> bool + abstract isAssertsKeyword: node: Node -> bool + abstract isAwaitKeyword: node: Node -> bool abstract isQualifiedName: node: Node -> bool abstract isComputedPropertyName: node: Node -> bool abstract isTypeParameterDeclaration: node: Node -> bool @@ -413,6 +450,7 @@ module Ts = abstract isOmittedExpression: node: Node -> bool abstract isExpressionWithTypeArguments: node: Node -> bool abstract isAsExpression: node: Node -> bool + abstract isSatisfiesExpression: node: Node -> bool abstract isNonNullExpression: node: Node -> bool abstract isMetaProperty: node: Node -> bool abstract isSyntheticExpression: node: Node -> bool @@ -478,6 +516,7 @@ module Ts = abstract isJsxAttributes: node: Node -> bool abstract isJsxSpreadAttribute: node: Node -> bool abstract isJsxExpression: node: Node -> bool + abstract isJsxNamespacedName: node: Node -> bool abstract isCaseClause: node: Node -> bool abstract isDefaultClause: node: Node -> bool abstract isHeritageClause: node: Node -> bool @@ -486,10 +525,8 @@ module Ts = abstract isShorthandPropertyAssignment: node: Node -> bool abstract isSpreadAssignment: node: Node -> bool abstract isEnumMember: node: Node -> bool - abstract isUnparsedPrepend: node: Node -> bool abstract isSourceFile: node: Node -> bool abstract isBundle: node: Node -> bool - abstract isUnparsedSource: node: Node -> bool abstract isJSDocTypeExpression: node: Node -> bool abstract isJSDocNameReference: node: Node -> bool abstract isJSDocMemberName: node: Node -> bool @@ -516,6 +553,7 @@ module Ts = abstract isJSDocProtectedTag: node: Node -> bool abstract isJSDocReadonlyTag: node: Node -> bool abstract isJSDocOverrideTag: node: Node -> bool + abstract isJSDocOverloadTag: node: Node -> bool abstract isJSDocDeprecatedTag: node: Node -> bool abstract isJSDocSeeTag: node: Node -> bool abstract isJSDocEnumTag: node: Node -> bool @@ -528,7 +566,15 @@ module Ts = abstract isJSDocUnknownTag: node: Node -> bool abstract isJSDocPropertyTag: node: Node -> bool abstract isJSDocImplementsTag: node: Node -> bool - abstract setTextRange: range: 'T * location: TextRange option -> 'T + abstract isJSDocSatisfiesTag: node: Node -> bool + abstract isJSDocThrowsTag: node: Node -> bool + abstract isQuestionOrExclamationToken: node: Node -> bool + abstract isIdentifierOrThisTypeNode: node: Node -> bool + abstract isReadonlyKeywordOrPlusOrMinusToken: node: Node -> bool + abstract isQuestionOrPlusOrMinusToken: node: Node -> bool + abstract isModuleName: node: Node -> bool + abstract isBinaryOperatorToken: node: Node -> bool + abstract setTextRange: range: 'T * location: TextRange option -> 'T abstract canHaveModifiers: node: Node -> bool abstract canHaveDecorators: node: Node -> bool /// @@ -555,7 +601,7 @@ module Ts = abstract updateSourceFile: sourceFile: SourceFile * newText: string * textChangeRange: TextChangeRange * ?aggressiveChecks: bool -> SourceFile abstract parseCommandLine: commandLine: string[] * ?readFile: (string -> string option) -> ParsedCommandLine /// Reads the config file, reports errors if any and exits if the config file cannot be found - abstract getParsedCommandLineOfConfigFile: configFileName: string * optionsToExtend: CompilerOptions option * host: ParseConfigFileHost * ?extendedConfigCache: Map * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> ParsedCommandLine option + abstract getParsedCommandLineOfConfigFile: configFileName: string * optionsToExtend: CompilerOptions option * host: ParseConfigFileHost * ?extendedConfigCache: Map * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> ParsedCommandLine option /// Read tsconfig.json file /// The path to the config file abstract readConfigFile: fileName: string * readFile: (string -> string option) -> {| config: obj option; error: Diagnostic option |} @@ -567,7 +613,7 @@ module Ts = /// The path to the config file abstract readJsonConfigFile: fileName: string * readFile: (string -> string option) -> TsConfigSourceFile /// Convert the json syntax tree into the json value - abstract convertToObject: sourceFile: JsonSourceFile * errors: Push -> obj option + abstract convertToObject: sourceFile: JsonSourceFile * errors: Diagnostic[] -> obj option /// Parse the contents of a config file (tsconfig.json). /// The contents of the config file to parse /// Instance of ParseConfigHost used to enumerate files in folder. @@ -575,7 +621,7 @@ module Ts = /// A root directory to resolve relative path entries in the config /// file to. e.g. outDir /// - abstract parseJsonConfigFileContent: json: obj option * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: Path[] * ?extraFileExtensions: FileExtensionInfo[] * ?extendedConfigCache: Map * ?existingWatchOptions: WatchOptions -> ParsedCommandLine + abstract parseJsonConfigFileContent: json: obj option * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: Path[] * ?extraFileExtensions: FileExtensionInfo[] * ?extendedConfigCache: Map * ?existingWatchOptions: WatchOptions -> ParsedCommandLine /// Parse the contents of a config file (tsconfig.json). /// The contents of the config file to parse /// Instance of ParseConfigHost used to enumerate files in folder. @@ -583,7 +629,7 @@ module Ts = /// A root directory to resolve relative path entries in the config /// file to. e.g. outDir /// - abstract parseJsonSourceFileConfigFileContent: sourceFile: TsConfigSourceFile * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: Path[] * ?extraFileExtensions: FileExtensionInfo[] * ?extendedConfigCache: Map * ?existingWatchOptions: WatchOptions -> ParsedCommandLine + abstract parseJsonSourceFileConfigFileContent: sourceFile: TsConfigSourceFile * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: Path[] * ?extraFileExtensions: FileExtensionInfo[] * ?extendedConfigCache: Map * ?existingWatchOptions: WatchOptions -> ParsedCommandLine abstract convertCompilerOptionsFromJson: jsonOptions: obj option * basePath: string * ?configFileName: string -> {| options: CompilerOptions; errors: Diagnostic[] |} abstract convertTypeAcquisitionFromJson: jsonOptions: obj option * basePath: string * ?configFileName: string -> {| options: TypeAcquisition; errors: Diagnostic[] |} abstract getEffectiveTypeRoots: options: CompilerOptions * host: GetEffectiveTypeRootsHost -> string[] option @@ -592,7 +638,7 @@ module Ts = /// This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups /// is assumed to be the same as root directory of the project. /// - abstract resolveTypeReferenceDirective: typeReferenceDirectiveName: string * containingFile: string option * options: CompilerOptions * host: ModuleResolutionHost * ?redirectedReference: ResolvedProjectReference * ?cache: TypeReferenceDirectiveResolutionCache * ?resolutionMode: obj -> ResolvedTypeReferenceDirectiveWithFailedLookupLocations + abstract resolveTypeReferenceDirective: typeReferenceDirectiveName: string * containingFile: string option * options: CompilerOptions * host: ModuleResolutionHost * ?redirectedReference: ResolvedProjectReference * ?cache: TypeReferenceDirectiveResolutionCache * ?resolutionMode: ResolutionMode -> ResolvedTypeReferenceDirectiveWithFailedLookupLocations /// Given a set of options, returns the set of type directive names /// that should be included for this program automatically. /// This list could either come from the config file, @@ -600,38 +646,71 @@ module Ts = /// More type directives might appear in the program later as a result of loading actual source files; /// this list is only the set of defaults that are implicitly included. abstract getAutomaticTypeDirectiveNames: options: CompilerOptions * host: ModuleResolutionHost -> string[] - abstract createModuleResolutionCache: currentDirectory: string * getCanonicalFileName: (string -> string) * ?options: CompilerOptions -> ModuleResolutionCache + abstract createModuleResolutionCache: currentDirectory: string * getCanonicalFileName: (string -> string) * ?options: CompilerOptions * ?packageJsonInfoCache: PackageJsonInfoCache -> ModuleResolutionCache abstract createTypeReferenceDirectiveResolutionCache: currentDirectory: string * getCanonicalFileName: (string -> string) * ?options: CompilerOptions * ?packageJsonInfoCache: PackageJsonInfoCache -> TypeReferenceDirectiveResolutionCache - abstract resolveModuleNameFromCache: moduleName: string * containingFile: string * cache: ModuleResolutionCache * ?mode: ModuleKind -> ResolvedModuleWithFailedLookupLocations option - abstract resolveModuleName: moduleName: string * containingFile: string * compilerOptions: CompilerOptions * host: ModuleResolutionHost * ?cache: ModuleResolutionCache * ?redirectedReference: ResolvedProjectReference * ?resolutionMode: ModuleKind -> ResolvedModuleWithFailedLookupLocations + abstract resolveModuleNameFromCache: moduleName: string * containingFile: string * cache: ModuleResolutionCache * ?mode: ResolutionMode -> ResolvedModuleWithFailedLookupLocations option + abstract resolveModuleName: moduleName: string * containingFile: string * compilerOptions: CompilerOptions * host: ModuleResolutionHost * ?cache: ModuleResolutionCache * ?redirectedReference: ResolvedProjectReference * ?resolutionMode: ResolutionMode -> ResolvedModuleWithFailedLookupLocations + abstract bundlerModuleNameResolver: moduleName: string * containingFile: string * compilerOptions: CompilerOptions * host: ModuleResolutionHost * ?cache: ModuleResolutionCache * ?redirectedReference: ResolvedProjectReference -> ResolvedModuleWithFailedLookupLocations abstract nodeModuleNameResolver: moduleName: string * containingFile: string * compilerOptions: CompilerOptions * host: ModuleResolutionHost * ?cache: ModuleResolutionCache * ?redirectedReference: ResolvedProjectReference -> ResolvedModuleWithFailedLookupLocations abstract classicNameResolver: moduleName: string * containingFile: string * compilerOptions: CompilerOptions * host: ModuleResolutionHost * ?cache: NonRelativeModuleNameResolutionCache * ?redirectedReference: ResolvedProjectReference -> ResolvedModuleWithFailedLookupLocations - /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. + /// + /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. + /// + /// - If the input node is undefined, then the output is undefined. + /// - If the visitor returns undefined, then the output is undefined. + /// - If the output node is not undefined, then it will satisfy the test function. + /// - In order to obtain a return type that is more specific than Node, a test + /// function _must_ be provided, and that function must be a type predicate. + /// /// The Node to visit. /// The callback used to visit the Node. /// A callback to execute to verify the Node is valid. /// An optional callback to execute to lift a NodeArray into a valid Node. - abstract visitNode: node: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T - /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. + abstract visitNode: node: 'TIn * visitor: Visitor<'TIn, 'TVisited> * test: (Node -> bool) * ?lift: (Node[] -> Node) -> U2<'TOut, obj> + /// + /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. + /// + /// - If the input node is undefined, then the output is undefined. + /// - If the visitor returns undefined, then the output is undefined. + /// - If the output node is not undefined, then it will satisfy the test function. + /// - In order to obtain a return type that is more specific than Node, a test + /// function _must_ be provided, and that function must be a type predicate. + /// /// The Node to visit. /// The callback used to visit the Node. /// A callback to execute to verify the Node is valid. /// An optional callback to execute to lift a NodeArray into a valid Node. - abstract visitNode: node: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option - /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + abstract visitNode: node: 'TIn * visitor: Visitor<'TIn, 'TVisited> * ?test: (Node -> bool) * ?lift: (Node[] -> Node) -> U2 + /// + /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + /// + /// - If the input node array is undefined, the output is undefined. + /// - If the visitor can return undefined, the node it visits in the array will be reused. + /// - If the output node array is not undefined, then its contents will satisfy the test. + /// - In order to obtain a return type that is more specific than NodeArray<Node>, a test + /// function _must_ be provided, and that function must be a type predicate. + /// /// The NodeArray to visit. /// The callback used to visit a Node. /// A node test to execute for each node. /// An optional value indicating the starting offset at which to start visiting. /// An optional value indicating the maximum number of nodes to visit. - abstract visitNodes: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] - /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + abstract visitNodes: nodes: 'TInArray * visitor: Visitor<'TIn, Node option> * test: (Node -> bool) * ?start: float * ?count: float -> U2<'TOut[], obj> + /// + /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + /// + /// - If the input node array is undefined, the output is undefined. + /// - If the visitor can return undefined, the node it visits in the array will be reused. + /// - If the output node array is not undefined, then its contents will satisfy the test. + /// - In order to obtain a return type that is more specific than NodeArray<Node>, a test + /// function _must_ be provided, and that function must be a type predicate. + /// /// The NodeArray to visit. /// The callback used to visit a Node. /// A node test to execute for each node. /// An optional value indicating the starting offset at which to start visiting. /// An optional value indicating the maximum number of nodes to visit. - abstract visitNodes: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option + abstract visitNodes: nodes: 'TInArray * visitor: Visitor<'TIn, Node option> * ?test: (Node -> bool) * ?start: float * ?count: float -> U2 /// Starts a new lexical environment and visits a statement list, ending the lexical environment /// and merging hoisted declarations upon completion. abstract visitLexicalEnvironment: statements: Statement[] * visitor: Visitor * context: TransformationContext * ?start: float * ?ensureUseStrict: bool * ?nodesVisitor: NodesVisitor -> Statement[] @@ -650,16 +729,20 @@ module Ts = abstract visitFunctionBody: node: ConciseBody * visitor: Visitor * context: TransformationContext -> ConciseBody /// Visits an iteration body, adding any block-scoped variables required by the transformation. abstract visitIterationBody: body: Statement * visitor: Visitor * context: TransformationContext -> Statement + /// Visits the elements of a . + /// The visitor to use when visiting expressions whose result will not be discarded at runtime. + /// The visitor to use when visiting expressions whose result will be discarded at runtime. Defaults to . + abstract visitCommaListElements: elements: Expression[] * visitor: Visitor * ?discardVisitor: Visitor -> Expression[] /// Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. /// The Node whose children will be visited. /// The callback used to visit each child. /// A lexical environment context for the visitor. - abstract visitEachChild: node: 'T * visitor: Visitor * context: TransformationContext -> 'T + abstract visitEachChild: node: 'T * visitor: Visitor * context: TransformationContext -> 'T /// Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. /// The Node whose children will be visited. /// The callback used to visit each child. /// A lexical environment context for the visitor. - abstract visitEachChild: node: 'T option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: obj * ?tokenVisitor: Visitor -> 'T option + abstract visitEachChild: node: 'T option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: obj * ?tokenVisitor: Visitor -> 'T option abstract getTsBuildInfoEmitOutputFilePath: options: CompilerOptions -> string option abstract getOutputFileNames: commandLine: ParsedCommandLine * inputFileName: string * ignoreCase: bool -> string[] abstract createPrinter: ?printerOptions: PrinterOptions * ?handlers: PrintHandlers -> Printer @@ -673,7 +756,7 @@ module Ts = abstract flattenDiagnosticMessageText: diag: U2 option * newLine: string * ?indent: float -> string /// Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly /// provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. - abstract getModeForFileReference: ref: U2 * containingFileMode: obj -> ModuleKind option + abstract getModeForFileReference: ref: U2 * containingFileMode: ResolutionMode -> ResolutionMode /// /// Calculates the final resolution mode for an import at some index within a file's imports list. This is generally the explicitly /// defined mode of the import if provided, or, if not, the mode of the containing file (with some exceptions: import=require is always commonjs, dynamic import is always esm). @@ -681,7 +764,7 @@ module Ts = /// /// File to fetch the resolution mode within /// Index into the file's complete resolution list to get the resolution of - this is a concatenation of the file's imports and module augmentations - abstract getModeForResolutionAtIndex: file: SourceFile * index: float -> ModuleKind option + abstract getModeForResolutionAtIndex: file: SourceFile * index: float -> ResolutionMode /// /// Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if /// one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm). @@ -691,7 +774,7 @@ module Ts = /// The file the import or import-like reference is contained within /// The module reference string /// The final resolution mode of the import - abstract getModeForUsageLocation: file: {| impliedNodeFormat: obj option |} * usage: StringLiteralLike -> ModuleKind option + abstract getModeForUsageLocation: file: {| impliedNodeFormat: ResolutionMode option |} * usage: StringLiteralLike -> ModuleKind option abstract getConfigFileParsingDiagnostics: configFileParseResult: ParsedCommandLine -> Diagnostic[] /// /// A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the @@ -702,7 +785,7 @@ module Ts = /// The ModuleResolutionHost which can perform the filesystem lookups for package json data /// The compiler options to perform the analysis under - relevant options are moduleResolution and traceResolution /// undefined if the path has no relevant implied format, ModuleKind.ESNext for esm format, and ModuleKind.CommonJS for cjs format - abstract getImpliedNodeFormatForFile: fileName: Path * packageJsonInfoCache: PackageJsonInfoCache option * host: ModuleResolutionHost * options: CompilerOptions -> ModuleKind option + abstract getImpliedNodeFormatForFile: fileName: Path * packageJsonInfoCache: PackageJsonInfoCache option * host: ModuleResolutionHost * options: CompilerOptions -> ResolutionMode /// /// Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' /// that represent a compilation unit. @@ -730,8 +813,6 @@ module Ts = /// Returns the target config filename of a project reference. /// Note: The file might not exist. abstract resolveProjectReferencePath: ref: ProjectReference -> ResolvedConfigFileName - [] - abstract resolveProjectReferencePath: host: ResolveProjectReferencePathHost * ref: ProjectReference -> ResolvedConfigFileName /// Create the builder to manage semantic diagnostics and cache them abstract createSemanticDiagnosticsBuilderProgram: newProgram: Program * host: BuilderProgramHost * ?oldProgram: SemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] -> SemanticDiagnosticsBuilderProgram abstract createSemanticDiagnosticsBuilderProgram: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: SemanticDiagnosticsBuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> SemanticDiagnosticsBuilderProgram @@ -744,20 +825,20 @@ module Ts = abstract createAbstractBuilder: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: BuilderProgram * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> BuilderProgram abstract readBuilderProgram: compilerOptions: CompilerOptions * host: ReadBuildProgramHost -> EmitAndSemanticDiagnosticsBuilderProgram option abstract createIncrementalCompilerHost: options: CompilerOptions * ?system: System -> CompilerHost - abstract createIncrementalProgram: p0: IncrementalProgramOptions<'T> -> 'T + abstract createIncrementalProgram: p0: IncrementalProgramOptions<'T> -> 'T /// Create the watch compiler host for either configFile or fileNames and its options - abstract createWatchCompilerHost: configFileName: string * optionsToExtend: CompilerOptions option * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> WatchCompilerHostOfConfigFile<'T> - abstract createWatchCompilerHost: rootFiles: string[] * options: CompilerOptions * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?projectReferences: ProjectReference[] * ?watchOptions: WatchOptions -> WatchCompilerHostOfFilesAndCompilerOptions<'T> + abstract createWatchCompilerHost: configFileName: string * optionsToExtend: CompilerOptions option * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?watchOptionsToExtend: WatchOptions * ?extraFileExtensions: FileExtensionInfo[] -> WatchCompilerHostOfConfigFile<'T> + abstract createWatchCompilerHost: rootFiles: string[] * options: CompilerOptions * system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter * ?projectReferences: ProjectReference[] * ?watchOptions: WatchOptions -> WatchCompilerHostOfFilesAndCompilerOptions<'T> /// Creates the watch from the host for root files and compiler options - abstract createWatchProgram: host: WatchCompilerHostOfFilesAndCompilerOptions<'T> -> WatchOfFilesAndCompilerOptions<'T> + abstract createWatchProgram: host: WatchCompilerHostOfFilesAndCompilerOptions<'T> -> WatchOfFilesAndCompilerOptions<'T> /// Creates the watch from the host for config file - abstract createWatchProgram: host: WatchCompilerHostOfConfigFile<'T> -> WatchOfConfigFile<'T> + abstract createWatchProgram: host: WatchCompilerHostOfConfigFile<'T> -> WatchOfConfigFile<'T> /// Create a function that reports watch status by writing to the system and handles the formating of the diagnostic abstract createBuilderStatusReporter: system: System * ?pretty: bool -> DiagnosticReporter - abstract createSolutionBuilderHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportErrorSummary: ReportEmitErrorSummary -> SolutionBuilderHost<'T> - abstract createSolutionBuilderWithWatchHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter -> SolutionBuilderWithWatchHost<'T> - abstract createSolutionBuilder: host: SolutionBuilderHost<'T> * rootNames: string[] * defaultOptions: BuildOptions -> SolutionBuilder<'T> - abstract createSolutionBuilderWithWatch: host: SolutionBuilderWithWatchHost<'T> * rootNames: string[] * defaultOptions: BuildOptions * ?baseWatchOptions: WatchOptions -> SolutionBuilder<'T> + abstract createSolutionBuilderHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportErrorSummary: ReportEmitErrorSummary -> SolutionBuilderHost<'T> + abstract createSolutionBuilderWithWatchHost: ?system: System * ?createProgram: CreateProgram<'T> * ?reportDiagnostic: DiagnosticReporter * ?reportSolutionBuilderStatus: DiagnosticReporter * ?reportWatchStatus: WatchStatusReporter -> SolutionBuilderWithWatchHost<'T> + abstract createSolutionBuilder: host: SolutionBuilderHost<'T> * rootNames: string[] * defaultOptions: BuildOptions -> SolutionBuilder<'T> + abstract createSolutionBuilderWithWatch: host: SolutionBuilderWithWatchHost<'T> * rootNames: string[] * defaultOptions: BuildOptions * ?baseWatchOptions: WatchOptions -> SolutionBuilder<'T> abstract getDefaultFormatCodeSettings: ?newLineCharacter: string -> FormatCodeSettings /// The classifier is used for syntactic highlighting in editors via the TSServer abstract createClassifier: unit -> Classifier @@ -765,8 +846,6 @@ module Ts = abstract preProcessFile: sourceText: string * ?readImportFiles: bool * ?detectJavaScriptImports: bool -> PreProcessedFileInfo abstract transpileModule: input: string * transpileOptions: TranspileOptions -> TranspileOutput abstract transpile: input: string * ?compilerOptions: CompilerOptions * ?fileName: string * ?diagnostics: Diagnostic[] * ?moduleName: string -> string - /// The version of the language service API - abstract servicesVersion: obj abstract toEditorSettings: options: U2 -> EditorSettings abstract displayPartsToString: displayParts: SymbolDisplayPart[] option -> string abstract getDefaultCompilerOptions: unit -> CompilerOptions @@ -778,11 +857,13 @@ module Ts = /// node package. /// The functionality is not supported if the ts module is consumed outside of a node module. abstract getDefaultLibFilePath: options: CompilerOptions -> string + /// The version of the language service API + abstract servicesVersion: obj /// Transform one or more nodes using the supplied transformers. /// A single Node or an array of Node objects. /// An array of TransformerFactory callbacks used to process the transformation. /// Optional compiler options. - abstract transform: source: U2<'T, 'T[]> * transformers: TransformerFactory<'T>[] * ?compilerOptions: CompilerOptions -> TransformationResult<'T> + abstract transform: source: U2<'T, 'T[]> * transformers: TransformerFactory<'T>[] * ?compilerOptions: CompilerOptions -> TransformationResult<'T> /// /// Type of objects whose values are all of the same type. @@ -800,63 +881,6 @@ module Ts = inherit Array<'T> abstract `` __sortedArrayBrand``: obj option with get, set - /// Common read methods for ES6 Map/Set. - type [] ReadonlyCollection<'K> = - abstract size: float - abstract has: key: 'K -> bool - abstract keys: unit -> Iterator<'K> - - /// Common write methods for ES6 Map/Set. - type [] Collection<'K> = - inherit ReadonlyCollection<'K> - abstract delete: key: 'K -> bool - abstract clear: unit -> unit - - /// ES6 Map interface, only read methods included. - type [] ReadonlyESMap<'K, 'V> = - inherit ReadonlyCollection<'K> - abstract get: key: 'K -> 'V option - abstract values: unit -> Iterator<'V> - abstract entries: unit -> Iterator<'K * 'V> - abstract forEach: action: ('V -> 'K -> unit) -> unit - - /// ES6 Map interface, only read methods included. - type [] ReadonlyMap<'T> = - inherit ReadonlyESMap - - /// ES6 Map interface. - type [] ESMap<'K, 'V> = - inherit ReadonlyESMap<'K, 'V> - inherit Collection<'K> - abstract set: key: 'K * value: 'V -> ESMap<'K, 'V> - - /// ES6 Map interface. - type [] Map<'T> = - inherit ESMap - - /// ES6 Set interface, only read methods included. - type [] ReadonlySet<'T> = - inherit ReadonlyCollection<'T> - abstract has: value: 'T -> bool - abstract values: unit -> Iterator<'T> - abstract entries: unit -> Iterator<'T * 'T> - abstract forEach: action: ('T -> 'T -> unit) -> unit - - /// ES6 Set interface. - type [] Set<'T> = - inherit ReadonlySet<'T> - inherit Collection<'T> - abstract add: value: 'T -> Set<'T> - abstract delete: value: 'T -> bool - - /// ES6 Iterator type. - type [] Iterator<'T> = - abstract next: unit -> U2<{| value: 'T; ``done``: bool option |}, {| value: unit; ``done``: bool |}> - - /// Array that is only intended to be pushed to, never read. - type [] Push<'T> = - abstract push: [] values: 'T[] -> unit - type [] Path = interface end @@ -877,419 +901,492 @@ module Ts = | WhitespaceTrivia = 5 | ShebangTrivia = 6 | ConflictMarkerTrivia = 7 - | NumericLiteral = 8 - | BigIntLiteral = 9 - | StringLiteral = 10 - | JsxText = 11 - | JsxTextAllWhiteSpaces = 12 - | RegularExpressionLiteral = 13 - | NoSubstitutionTemplateLiteral = 14 - | TemplateHead = 15 - | TemplateMiddle = 16 - | TemplateTail = 17 - | OpenBraceToken = 18 - | CloseBraceToken = 19 - | OpenParenToken = 20 - | CloseParenToken = 21 - | OpenBracketToken = 22 - | CloseBracketToken = 23 - | DotToken = 24 - | DotDotDotToken = 25 - | SemicolonToken = 26 - | CommaToken = 27 - | QuestionDotToken = 28 - | LessThanToken = 29 - | LessThanSlashToken = 30 - | GreaterThanToken = 31 - | LessThanEqualsToken = 32 - | GreaterThanEqualsToken = 33 - | EqualsEqualsToken = 34 - | ExclamationEqualsToken = 35 - | EqualsEqualsEqualsToken = 36 - | ExclamationEqualsEqualsToken = 37 - | EqualsGreaterThanToken = 38 - | PlusToken = 39 - | MinusToken = 40 - | AsteriskToken = 41 - | AsteriskAsteriskToken = 42 - | SlashToken = 43 - | PercentToken = 44 - | PlusPlusToken = 45 - | MinusMinusToken = 46 - | LessThanLessThanToken = 47 - | GreaterThanGreaterThanToken = 48 - | GreaterThanGreaterThanGreaterThanToken = 49 - | AmpersandToken = 50 - | BarToken = 51 - | CaretToken = 52 - | ExclamationToken = 53 - | TildeToken = 54 - | AmpersandAmpersandToken = 55 - | BarBarToken = 56 - | QuestionToken = 57 - | ColonToken = 58 - | AtToken = 59 - | QuestionQuestionToken = 60 + | NonTextFileMarkerTrivia = 8 + | NumericLiteral = 9 + | BigIntLiteral = 10 + | StringLiteral = 11 + | JsxText = 12 + | JsxTextAllWhiteSpaces = 13 + | RegularExpressionLiteral = 14 + | NoSubstitutionTemplateLiteral = 15 + | TemplateHead = 16 + | TemplateMiddle = 17 + | TemplateTail = 18 + | OpenBraceToken = 19 + | CloseBraceToken = 20 + | OpenParenToken = 21 + | CloseParenToken = 22 + | OpenBracketToken = 23 + | CloseBracketToken = 24 + | DotToken = 25 + | DotDotDotToken = 26 + | SemicolonToken = 27 + | CommaToken = 28 + | QuestionDotToken = 29 + | LessThanToken = 30 + | LessThanSlashToken = 31 + | GreaterThanToken = 32 + | LessThanEqualsToken = 33 + | GreaterThanEqualsToken = 34 + | EqualsEqualsToken = 35 + | ExclamationEqualsToken = 36 + | EqualsEqualsEqualsToken = 37 + | ExclamationEqualsEqualsToken = 38 + | EqualsGreaterThanToken = 39 + | PlusToken = 40 + | MinusToken = 41 + | AsteriskToken = 42 + | AsteriskAsteriskToken = 43 + | SlashToken = 44 + | PercentToken = 45 + | PlusPlusToken = 46 + | MinusMinusToken = 47 + | LessThanLessThanToken = 48 + | GreaterThanGreaterThanToken = 49 + | GreaterThanGreaterThanGreaterThanToken = 50 + | AmpersandToken = 51 + | BarToken = 52 + | CaretToken = 53 + | ExclamationToken = 54 + | TildeToken = 55 + | AmpersandAmpersandToken = 56 + | BarBarToken = 57 + | QuestionToken = 58 + | ColonToken = 59 + | AtToken = 60 + | QuestionQuestionToken = 61 /// Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. - | BacktickToken = 61 + | BacktickToken = 62 /// Only the JSDoc scanner produces HashToken. The normal scanner produces PrivateIdentifier. - | HashToken = 62 - | EqualsToken = 63 - | PlusEqualsToken = 64 - | MinusEqualsToken = 65 - | AsteriskEqualsToken = 66 - | AsteriskAsteriskEqualsToken = 67 - | SlashEqualsToken = 68 - | PercentEqualsToken = 69 - | LessThanLessThanEqualsToken = 70 - | GreaterThanGreaterThanEqualsToken = 71 - | GreaterThanGreaterThanGreaterThanEqualsToken = 72 - | AmpersandEqualsToken = 73 - | BarEqualsToken = 74 - | BarBarEqualsToken = 75 - | AmpersandAmpersandEqualsToken = 76 - | QuestionQuestionEqualsToken = 77 - | CaretEqualsToken = 78 - | Identifier = 79 - | PrivateIdentifier = 80 - | BreakKeyword = 81 - | CaseKeyword = 82 - | CatchKeyword = 83 - | ClassKeyword = 84 - | ConstKeyword = 85 - | ContinueKeyword = 86 - | DebuggerKeyword = 87 - | DefaultKeyword = 88 - | DeleteKeyword = 89 - | DoKeyword = 90 - | ElseKeyword = 91 - | EnumKeyword = 92 - | ExportKeyword = 93 - | ExtendsKeyword = 94 - | FalseKeyword = 95 - | FinallyKeyword = 96 - | ForKeyword = 97 - | FunctionKeyword = 98 - | IfKeyword = 99 - | ImportKeyword = 100 - | InKeyword = 101 - | InstanceOfKeyword = 102 - | NewKeyword = 103 - | NullKeyword = 104 - | ReturnKeyword = 105 - | SuperKeyword = 106 - | SwitchKeyword = 107 - | ThisKeyword = 108 - | ThrowKeyword = 109 - | TrueKeyword = 110 - | TryKeyword = 111 - | TypeOfKeyword = 112 - | VarKeyword = 113 - | VoidKeyword = 114 - | WhileKeyword = 115 - | WithKeyword = 116 - | ImplementsKeyword = 117 - | InterfaceKeyword = 118 - | LetKeyword = 119 - | PackageKeyword = 120 - | PrivateKeyword = 121 - | ProtectedKeyword = 122 - | PublicKeyword = 123 - | StaticKeyword = 124 - | YieldKeyword = 125 - | AbstractKeyword = 126 - | AsKeyword = 127 - | AssertsKeyword = 128 - | AssertKeyword = 129 - | AnyKeyword = 130 - | AsyncKeyword = 131 - | AwaitKeyword = 132 - | BooleanKeyword = 133 - | ConstructorKeyword = 134 - | DeclareKeyword = 135 - | GetKeyword = 136 - | InferKeyword = 137 - | IntrinsicKeyword = 138 - | IsKeyword = 139 - | KeyOfKeyword = 140 - | ModuleKeyword = 141 - | NamespaceKeyword = 142 - | NeverKeyword = 143 - | OutKeyword = 144 - | ReadonlyKeyword = 145 - | RequireKeyword = 146 - | NumberKeyword = 147 - | ObjectKeyword = 148 - | SetKeyword = 149 - | StringKeyword = 150 - | SymbolKeyword = 151 - | TypeKeyword = 152 - | UndefinedKeyword = 153 - | UniqueKeyword = 154 - | UnknownKeyword = 155 - | FromKeyword = 156 - | GlobalKeyword = 157 - | BigIntKeyword = 158 - | OverrideKeyword = 159 - | OfKeyword = 160 - | QualifiedName = 161 - | ComputedPropertyName = 162 - | TypeParameter = 163 - | Parameter = 164 - | Decorator = 165 - | PropertySignature = 166 - | PropertyDeclaration = 167 - | MethodSignature = 168 - | MethodDeclaration = 169 - | ClassStaticBlockDeclaration = 170 - | Constructor = 171 - | GetAccessor = 172 - | SetAccessor = 173 - | CallSignature = 174 - | ConstructSignature = 175 - | IndexSignature = 176 - | TypePredicate = 177 - | TypeReference = 178 - | FunctionType = 179 - | ConstructorType = 180 - | TypeQuery = 181 - | TypeLiteral = 182 - | ArrayType = 183 - | TupleType = 184 - | OptionalType = 185 - | RestType = 186 - | UnionType = 187 - | IntersectionType = 188 - | ConditionalType = 189 - | InferType = 190 - | ParenthesizedType = 191 - | ThisType = 192 - | TypeOperator = 193 - | IndexedAccessType = 194 - | MappedType = 195 - | LiteralType = 196 - | NamedTupleMember = 197 - | TemplateLiteralType = 198 - | TemplateLiteralTypeSpan = 199 - | ImportType = 200 - | ObjectBindingPattern = 201 - | ArrayBindingPattern = 202 - | BindingElement = 203 - | ArrayLiteralExpression = 204 - | ObjectLiteralExpression = 205 - | PropertyAccessExpression = 206 - | ElementAccessExpression = 207 - | CallExpression = 208 - | NewExpression = 209 - | TaggedTemplateExpression = 210 - | TypeAssertionExpression = 211 - | ParenthesizedExpression = 212 - | FunctionExpression = 213 - | ArrowFunction = 214 - | DeleteExpression = 215 - | TypeOfExpression = 216 - | VoidExpression = 217 - | AwaitExpression = 218 - | PrefixUnaryExpression = 219 - | PostfixUnaryExpression = 220 - | BinaryExpression = 221 - | ConditionalExpression = 222 - | TemplateExpression = 223 - | YieldExpression = 224 - | SpreadElement = 225 - | ClassExpression = 226 - | OmittedExpression = 227 - | ExpressionWithTypeArguments = 228 - | AsExpression = 229 - | NonNullExpression = 230 - | MetaProperty = 231 - | SyntheticExpression = 232 - | TemplateSpan = 233 - | SemicolonClassElement = 234 - | Block = 235 - | EmptyStatement = 236 - | VariableStatement = 237 - | ExpressionStatement = 238 - | IfStatement = 239 - | DoStatement = 240 - | WhileStatement = 241 - | ForStatement = 242 - | ForInStatement = 243 - | ForOfStatement = 244 - | ContinueStatement = 245 - | BreakStatement = 246 - | ReturnStatement = 247 - | WithStatement = 248 - | SwitchStatement = 249 - | LabeledStatement = 250 - | ThrowStatement = 251 - | TryStatement = 252 - | DebuggerStatement = 253 - | VariableDeclaration = 254 - | VariableDeclarationList = 255 - | FunctionDeclaration = 256 - | ClassDeclaration = 257 - | InterfaceDeclaration = 258 - | TypeAliasDeclaration = 259 - | EnumDeclaration = 260 - | ModuleDeclaration = 261 - | ModuleBlock = 262 - | CaseBlock = 263 - | NamespaceExportDeclaration = 264 - | ImportEqualsDeclaration = 265 - | ImportDeclaration = 266 - | ImportClause = 267 - | NamespaceImport = 268 - | NamedImports = 269 - | ImportSpecifier = 270 - | ExportAssignment = 271 - | ExportDeclaration = 272 - | NamedExports = 273 - | NamespaceExport = 274 - | ExportSpecifier = 275 - | MissingDeclaration = 276 - | ExternalModuleReference = 277 - | JsxElement = 278 - | JsxSelfClosingElement = 279 - | JsxOpeningElement = 280 - | JsxClosingElement = 281 - | JsxFragment = 282 - | JsxOpeningFragment = 283 - | JsxClosingFragment = 284 - | JsxAttribute = 285 - | JsxAttributes = 286 - | JsxSpreadAttribute = 287 - | JsxExpression = 288 - | CaseClause = 289 - | DefaultClause = 290 - | HeritageClause = 291 - | CatchClause = 292 - | AssertClause = 293 - | AssertEntry = 294 - | ImportTypeAssertionContainer = 295 - | PropertyAssignment = 296 - | ShorthandPropertyAssignment = 297 - | SpreadAssignment = 298 - | EnumMember = 299 - | UnparsedPrologue = 300 - | UnparsedPrepend = 301 - | UnparsedText = 302 - | UnparsedInternalText = 303 - | UnparsedSyntheticReference = 304 - | SourceFile = 305 - | Bundle = 306 - | UnparsedSource = 307 - | InputFiles = 308 - | JSDocTypeExpression = 309 - | JSDocNameReference = 310 - | JSDocMemberName = 311 - | JSDocAllType = 312 - | JSDocUnknownType = 313 - | JSDocNullableType = 314 - | JSDocNonNullableType = 315 - | JSDocOptionalType = 316 - | JSDocFunctionType = 317 - | JSDocVariadicType = 318 - | JSDocNamepathType = 319 - | JSDoc = 320 + | HashToken = 63 + | EqualsToken = 64 + | PlusEqualsToken = 65 + | MinusEqualsToken = 66 + | AsteriskEqualsToken = 67 + | AsteriskAsteriskEqualsToken = 68 + | SlashEqualsToken = 69 + | PercentEqualsToken = 70 + | LessThanLessThanEqualsToken = 71 + | GreaterThanGreaterThanEqualsToken = 72 + | GreaterThanGreaterThanGreaterThanEqualsToken = 73 + | AmpersandEqualsToken = 74 + | BarEqualsToken = 75 + | BarBarEqualsToken = 76 + | AmpersandAmpersandEqualsToken = 77 + | QuestionQuestionEqualsToken = 78 + | CaretEqualsToken = 79 + | Identifier = 80 + | PrivateIdentifier = 81 + | BreakKeyword = 83 + | CaseKeyword = 84 + | CatchKeyword = 85 + | ClassKeyword = 86 + | ConstKeyword = 87 + | ContinueKeyword = 88 + | DebuggerKeyword = 89 + | DefaultKeyword = 90 + | DeleteKeyword = 91 + | DoKeyword = 92 + | ElseKeyword = 93 + | EnumKeyword = 94 + | ExportKeyword = 95 + | ExtendsKeyword = 96 + | FalseKeyword = 97 + | FinallyKeyword = 98 + | ForKeyword = 99 + | FunctionKeyword = 100 + | IfKeyword = 101 + | ImportKeyword = 102 + | InKeyword = 103 + | InstanceOfKeyword = 104 + | NewKeyword = 105 + | NullKeyword = 106 + | ReturnKeyword = 107 + | SuperKeyword = 108 + | SwitchKeyword = 109 + | ThisKeyword = 110 + | ThrowKeyword = 111 + | TrueKeyword = 112 + | TryKeyword = 113 + | TypeOfKeyword = 114 + | VarKeyword = 115 + | VoidKeyword = 116 + | WhileKeyword = 117 + | WithKeyword = 118 + | ImplementsKeyword = 119 + | InterfaceKeyword = 120 + | LetKeyword = 121 + | PackageKeyword = 122 + | PrivateKeyword = 123 + | ProtectedKeyword = 124 + | PublicKeyword = 125 + | StaticKeyword = 126 + | YieldKeyword = 127 + | AbstractKeyword = 128 + | AccessorKeyword = 129 + | AsKeyword = 130 + | AssertsKeyword = 131 + | AssertKeyword = 132 + | AnyKeyword = 133 + | AsyncKeyword = 134 + | AwaitKeyword = 135 + | BooleanKeyword = 136 + | ConstructorKeyword = 137 + | DeclareKeyword = 138 + | GetKeyword = 139 + | InferKeyword = 140 + | IntrinsicKeyword = 141 + | IsKeyword = 142 + | KeyOfKeyword = 143 + | ModuleKeyword = 144 + | NamespaceKeyword = 145 + | NeverKeyword = 146 + | OutKeyword = 147 + | ReadonlyKeyword = 148 + | RequireKeyword = 149 + | NumberKeyword = 150 + | ObjectKeyword = 151 + | SatisfiesKeyword = 152 + | SetKeyword = 153 + | StringKeyword = 154 + | SymbolKeyword = 155 + | TypeKeyword = 156 + | UndefinedKeyword = 157 + | UniqueKeyword = 158 + | UnknownKeyword = 159 + | FromKeyword = 160 + | GlobalKeyword = 161 + | BigIntKeyword = 162 + | OverrideKeyword = 163 + | OfKeyword = 164 + | QualifiedName = 165 + | ComputedPropertyName = 166 + | TypeParameter = 167 + | Parameter = 168 + | Decorator = 169 + | PropertySignature = 170 + | PropertyDeclaration = 171 + | MethodSignature = 172 + | MethodDeclaration = 173 + | ClassStaticBlockDeclaration = 174 + | Constructor = 175 + | GetAccessor = 176 + | SetAccessor = 177 + | CallSignature = 178 + | ConstructSignature = 179 + | IndexSignature = 180 + | TypePredicate = 181 + | TypeReference = 182 + | FunctionType = 183 + | ConstructorType = 184 + | TypeQuery = 185 + | TypeLiteral = 186 + | ArrayType = 187 + | TupleType = 188 + | OptionalType = 189 + | RestType = 190 + | UnionType = 191 + | IntersectionType = 192 + | ConditionalType = 193 + | InferType = 194 + | ParenthesizedType = 195 + | ThisType = 196 + | TypeOperator = 197 + | IndexedAccessType = 198 + | MappedType = 199 + | LiteralType = 200 + | NamedTupleMember = 201 + | TemplateLiteralType = 202 + | TemplateLiteralTypeSpan = 203 + | ImportType = 204 + | ObjectBindingPattern = 205 + | ArrayBindingPattern = 206 + | BindingElement = 207 + | ArrayLiteralExpression = 208 + | ObjectLiteralExpression = 209 + | PropertyAccessExpression = 210 + | ElementAccessExpression = 211 + | CallExpression = 212 + | NewExpression = 213 + | TaggedTemplateExpression = 214 + | TypeAssertionExpression = 215 + | ParenthesizedExpression = 216 + | FunctionExpression = 217 + | ArrowFunction = 218 + | DeleteExpression = 219 + | TypeOfExpression = 220 + | VoidExpression = 221 + | AwaitExpression = 222 + | PrefixUnaryExpression = 223 + | PostfixUnaryExpression = 224 + | BinaryExpression = 225 + | ConditionalExpression = 226 + | TemplateExpression = 227 + | YieldExpression = 228 + | SpreadElement = 229 + | ClassExpression = 230 + | OmittedExpression = 231 + | ExpressionWithTypeArguments = 232 + | AsExpression = 233 + | NonNullExpression = 234 + | MetaProperty = 235 + | SyntheticExpression = 236 + | SatisfiesExpression = 237 + | TemplateSpan = 238 + | SemicolonClassElement = 239 + | Block = 240 + | EmptyStatement = 241 + | VariableStatement = 242 + | ExpressionStatement = 243 + | IfStatement = 244 + | DoStatement = 245 + | WhileStatement = 246 + | ForStatement = 247 + | ForInStatement = 248 + | ForOfStatement = 249 + | ContinueStatement = 250 + | BreakStatement = 251 + | ReturnStatement = 252 + | WithStatement = 253 + | SwitchStatement = 254 + | LabeledStatement = 255 + | ThrowStatement = 256 + | TryStatement = 257 + | DebuggerStatement = 258 + | VariableDeclaration = 259 + | VariableDeclarationList = 260 + | FunctionDeclaration = 261 + | ClassDeclaration = 262 + | InterfaceDeclaration = 263 + | TypeAliasDeclaration = 264 + | EnumDeclaration = 265 + | ModuleDeclaration = 266 + | ModuleBlock = 267 + | CaseBlock = 268 + | NamespaceExportDeclaration = 269 + | ImportEqualsDeclaration = 270 + | ImportDeclaration = 271 + | ImportClause = 272 + | NamespaceImport = 273 + | NamedImports = 274 + | ImportSpecifier = 275 + | ExportAssignment = 276 + | ExportDeclaration = 277 + | NamedExports = 278 + | NamespaceExport = 279 + | ExportSpecifier = 280 + | MissingDeclaration = 281 + | ExternalModuleReference = 282 + | JsxElement = 283 + | JsxSelfClosingElement = 284 + | JsxOpeningElement = 285 + | JsxClosingElement = 286 + | JsxFragment = 287 + | JsxOpeningFragment = 288 + | JsxClosingFragment = 289 + | JsxAttribute = 290 + | JsxAttributes = 291 + | JsxSpreadAttribute = 292 + | JsxExpression = 293 + | JsxNamespacedName = 294 + | CaseClause = 295 + | DefaultClause = 296 + | HeritageClause = 297 + | CatchClause = 298 + | AssertClause = 299 + | AssertEntry = 300 + | ImportTypeAssertionContainer = 301 + | PropertyAssignment = 302 + | ShorthandPropertyAssignment = 303 + | SpreadAssignment = 304 + | EnumMember = 305 + /// + | UnparsedPrologue = 306 + /// + | UnparsedPrepend = 307 + /// + | UnparsedText = 308 + /// + | UnparsedInternalText = 309 + /// + | UnparsedSyntheticReference = 310 + | SourceFile = 311 + | Bundle = 312 + /// + | UnparsedSource = 313 + /// + | InputFiles = 314 + | JSDocTypeExpression = 315 + | JSDocNameReference = 316 + | JSDocMemberName = 317 + | JSDocAllType = 318 + | JSDocUnknownType = 319 + | JSDocNullableType = 320 + | JSDocNonNullableType = 321 + | JSDocOptionalType = 322 + | JSDocFunctionType = 323 + | JSDocVariadicType = 324 + | JSDocNamepathType = 325 + | JSDoc = 326 /// Use SyntaxKind.JSDoc - | JSDocComment = 320 - | JSDocText = 321 - | JSDocTypeLiteral = 322 - | JSDocSignature = 323 - | JSDocLink = 324 - | JSDocLinkCode = 325 - | JSDocLinkPlain = 326 - | JSDocTag = 327 - | JSDocAugmentsTag = 328 - | JSDocImplementsTag = 329 - | JSDocAuthorTag = 330 - | JSDocDeprecatedTag = 331 - | JSDocClassTag = 332 - | JSDocPublicTag = 333 - | JSDocPrivateTag = 334 - | JSDocProtectedTag = 335 - | JSDocReadonlyTag = 336 - | JSDocOverrideTag = 337 - | JSDocCallbackTag = 338 - | JSDocEnumTag = 339 - | JSDocParameterTag = 340 - | JSDocReturnTag = 341 - | JSDocThisTag = 342 - | JSDocTypeTag = 343 - | JSDocTemplateTag = 344 - | JSDocTypedefTag = 345 - | JSDocSeeTag = 346 - | JSDocPropertyTag = 347 - | SyntaxList = 348 - | NotEmittedStatement = 349 - | PartiallyEmittedExpression = 350 - | CommaListExpression = 351 - | MergeDeclarationMarker = 352 - | EndOfDeclarationMarker = 353 - | SyntheticReferenceExpression = 354 - | Count = 355 - | FirstAssignment = 63 - | LastAssignment = 78 - | FirstCompoundAssignment = 64 - | LastCompoundAssignment = 78 - | FirstReservedWord = 81 - | LastReservedWord = 116 - | FirstKeyword = 81 - | LastKeyword = 160 - | FirstFutureReservedWord = 117 - | LastFutureReservedWord = 125 - | FirstTypeNode = 177 - | LastTypeNode = 200 - | FirstPunctuation = 18 - | LastPunctuation = 78 + | JSDocComment = 326 + | JSDocText = 327 + | JSDocTypeLiteral = 328 + | JSDocSignature = 329 + | JSDocLink = 330 + | JSDocLinkCode = 331 + | JSDocLinkPlain = 332 + | JSDocTag = 333 + | JSDocAugmentsTag = 334 + | JSDocImplementsTag = 335 + | JSDocAuthorTag = 336 + | JSDocDeprecatedTag = 337 + | JSDocClassTag = 338 + | JSDocPublicTag = 339 + | JSDocPrivateTag = 340 + | JSDocProtectedTag = 341 + | JSDocReadonlyTag = 342 + | JSDocOverrideTag = 343 + | JSDocCallbackTag = 344 + | JSDocOverloadTag = 345 + | JSDocEnumTag = 346 + | JSDocParameterTag = 347 + | JSDocReturnTag = 348 + | JSDocThisTag = 349 + | JSDocTypeTag = 350 + | JSDocTemplateTag = 351 + | JSDocTypedefTag = 352 + | JSDocSeeTag = 353 + | JSDocPropertyTag = 354 + | JSDocThrowsTag = 355 + | JSDocSatisfiesTag = 356 + | SyntaxList = 357 + | NotEmittedStatement = 358 + | PartiallyEmittedExpression = 359 + | CommaListExpression = 360 + | SyntheticReferenceExpression = 361 + | Count = 362 + | FirstAssignment = 64 + | LastAssignment = 79 + | FirstCompoundAssignment = 65 + | LastCompoundAssignment = 79 + | FirstReservedWord = 83 + | LastReservedWord = 118 + | FirstKeyword = 83 + | LastKeyword = 164 + | FirstFutureReservedWord = 119 + | LastFutureReservedWord = 127 + | FirstTypeNode = 181 + | LastTypeNode = 204 + | FirstPunctuation = 19 + | LastPunctuation = 79 | FirstToken = 0 - | LastToken = 160 + | LastToken = 164 | FirstTriviaToken = 2 | LastTriviaToken = 7 - | FirstLiteralToken = 8 - | LastLiteralToken = 14 - | FirstTemplateToken = 14 - | LastTemplateToken = 17 - | FirstBinaryOperator = 29 - | LastBinaryOperator = 78 - | FirstStatement = 237 - | LastStatement = 253 - | FirstNode = 161 - | FirstJSDocNode = 309 - | LastJSDocNode = 347 - | FirstJSDocTagNode = 327 - | LastJSDocTagNode = 347 - + | FirstLiteralToken = 9 + | LastLiteralToken = 15 + | FirstTemplateToken = 15 + | LastTemplateToken = 18 + | FirstBinaryOperator = 30 + | LastBinaryOperator = 79 + | FirstStatement = 242 + | LastStatement = 258 + | FirstNode = 165 + | FirstJSDocNode = 315 + | LastJSDocNode = 356 + | FirstJSDocTagNode = 333 + | LastJSDocTagNode = 356 + + /// + /// Original in TypeScript: + /// + /// SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia + /// + /// type TriviaSyntaxKind = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral + /// + /// type LiteralSyntaxKind = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail + /// + /// type PseudoLiteralSyntaxKind = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.BarBarToken | SyntaxKind.BarBarEqualsToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionQuestionEqualsToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken + /// + /// type PunctuationSyntaxKind = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword + /// + /// type KeywordSyntaxKind = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword + /// + /// type ModifierSyntaxKind = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword + /// + /// type KeywordTypeSyntaxKind = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind + /// + /// type TokenSyntaxKind = - U6 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken + /// + /// type JsxTokenSyntaxKind = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.Unknown | KeywordSyntaxKind + /// + /// type JSDocSyntaxKind = - U2 + SyntaxKind type [] NodeFlags = | None = 0 @@ -1331,9 +1428,10 @@ module Ts = | Protected = 16 | Static = 32 | Readonly = 64 - | Abstract = 128 - | Async = 256 - | Default = 512 + | Accessor = 128 + | Abstract = 256 + | Async = 512 + | Default = 1024 | Const = 2048 | HasComputedJSDocModifiers = 4096 | Deprecated = 8192 @@ -1345,10 +1443,10 @@ module Ts = | AccessibilityModifier = 28 | ParameterPropertyModifier = 16476 | NonPublicAccessibilityModifier = 24 - | TypeScriptModifier = 116958 - | ExportDefault = 513 - | All = 257023 - | Modifier = 125951 + | TypeScriptModifier = 117086 + | ExportDefault = 1025 + | All = 258047 + | Modifier = 126975 type [] JsxFlags = | None = 0 @@ -1380,190 +1478,199 @@ module Ts = abstract forEachChild: cbNode: (Node -> 'T option) * ?cbNodeArray: (Node[] -> 'T option) -> 'T option type [] JSDocContainer = - interface end + inherit Node + abstract _jsdocContainerBrand: obj option with get, set + + type [] LocalsContainer = + inherit Node + abstract _localsContainerBrand: obj option with get, set + + type [] FlowContainer = + inherit Node + abstract _flowContainerBrand: obj option with get, set type HasJSDoc = obj type [] [] HasType = - | [] ArrowFunction of ArrowFunction - | [] AsExpression of AsExpression - | [] CallSignatureDeclaration of CallSignatureDeclaration - | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration - | [] ConstructorDeclaration of ConstructorDeclaration - | [] ConstructorTypeNode of ConstructorTypeNode - | [] FunctionDeclaration of FunctionDeclaration - | [] FunctionExpression of FunctionExpression - | [] FunctionTypeNode of FunctionTypeNode - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] IndexSignatureDeclaration of IndexSignatureDeclaration - | [] JSDocFunctionType of JSDocFunctionType - | [] JSDocNonNullableType of JSDocNonNullableType - | [] JSDocNullableType of JSDocNullableType - | [] JSDocOptionalType of JSDocOptionalType - | [] JSDocTypeExpression of JSDocTypeExpression - | [] JSDocVariadicType of JSDocVariadicType - | [] MappedTypeNode of MappedTypeNode - | [] MethodDeclaration of MethodDeclaration - | [] MethodSignature of MethodSignature - | [] ParameterDeclaration of ParameterDeclaration - | [] ParenthesizedTypeNode of ParenthesizedTypeNode - | [] PropertyDeclaration of PropertyDeclaration - | [] PropertySignature of PropertySignature - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] TypeAliasDeclaration of TypeAliasDeclaration - | [] TypeAssertion of TypeAssertion - | [] TypeOperatorNode of TypeOperatorNode - | [] TypePredicateNode of TypePredicateNode - | [] VariableDeclaration of VariableDeclaration - static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x - static member inline op_ErasedCast(x: AsExpression) = AsExpression x - static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x - static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x - static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x - static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x - static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x - static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x - static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x - static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x - static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x - static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x - static member inline op_ErasedCast(x: JSDocNonNullableType) = JSDocNonNullableType x - static member inline op_ErasedCast(x: JSDocNullableType) = JSDocNullableType x - static member inline op_ErasedCast(x: JSDocOptionalType) = JSDocOptionalType x - static member inline op_ErasedCast(x: JSDocTypeExpression) = JSDocTypeExpression x - static member inline op_ErasedCast(x: JSDocVariadicType) = JSDocVariadicType x - static member inline op_ErasedCast(x: MappedTypeNode) = MappedTypeNode x - static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x - static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x - static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x - static member inline op_ErasedCast(x: ParenthesizedTypeNode) = ParenthesizedTypeNode x - static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x - static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x - static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x - static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x - static member inline op_ErasedCast(x: TypeAssertion) = TypeAssertion x - static member inline op_ErasedCast(x: TypeOperatorNode) = TypeOperatorNode x - static member inline op_ErasedCast(x: TypePredicateNode) = TypePredicateNode x - static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x + | [] ArrowFunction of ArrowFunction + | [] AsExpression of AsExpression + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] FunctionTypeNode of FunctionTypeNode + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] JSDocFunctionType of JSDocFunctionType + | [] JSDocNonNullableType of JSDocNonNullableType + | [] JSDocNullableType of JSDocNullableType + | [] JSDocOptionalType of JSDocOptionalType + | [] JSDocTypeExpression of JSDocTypeExpression + | [] JSDocVariadicType of JSDocVariadicType + | [] MappedTypeNode of MappedTypeNode + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] ParameterDeclaration of ParameterDeclaration + | [] ParenthesizedTypeNode of ParenthesizedTypeNode + | [] PropertyDeclaration of PropertyDeclaration + | [] PropertySignature of PropertySignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + | [] TypeAssertion of TypeAssertion + | [] TypeOperatorNode of TypeOperatorNode + | [] TypePredicateNode of TypePredicateNode + | [] VariableDeclaration of VariableDeclaration + // static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + // static member inline op_ErasedCast(x: AsExpression) = AsExpression x + // static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x + // static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x + // static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + // static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + // static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + // static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + // static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x + // static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + // static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + // static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x + // static member inline op_ErasedCast(x: JSDocNonNullableType) = JSDocNonNullableType x + // static member inline op_ErasedCast(x: JSDocNullableType) = JSDocNullableType x + // static member inline op_ErasedCast(x: JSDocOptionalType) = JSDocOptionalType x + // static member inline op_ErasedCast(x: JSDocTypeExpression) = JSDocTypeExpression x + // static member inline op_ErasedCast(x: JSDocVariadicType) = JSDocVariadicType x + // static member inline op_ErasedCast(x: MappedTypeNode) = MappedTypeNode x + // static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + // static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + // static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + // static member inline op_ErasedCast(x: ParenthesizedTypeNode) = ParenthesizedTypeNode x + // static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + // static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x + // static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + // static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x + // static member inline op_ErasedCast(x: TypeAssertion) = TypeAssertion x + // static member inline op_ErasedCast(x: TypeOperatorNode) = TypeOperatorNode x + // static member inline op_ErasedCast(x: TypePredicateNode) = TypePredicateNode x + // static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] [] HasTypeArguments = - | [] CallExpression of CallExpression - | [] JsxOpeningElement of JsxOpeningElement - | [] JsxSelfClosingElement of JsxSelfClosingElement - | [] NewExpression of NewExpression - | [] TaggedTemplateExpression of TaggedTemplateExpression - static member inline op_ErasedCast(x: CallExpression) = CallExpression x - static member inline op_ErasedCast(x: JsxOpeningElement) = JsxOpeningElement x - static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x - static member inline op_ErasedCast(x: NewExpression) = NewExpression x - static member inline op_ErasedCast(x: TaggedTemplateExpression) = TaggedTemplateExpression x + | [] CallExpression of CallExpression + | [] JsxOpeningElement of JsxOpeningElement + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] NewExpression of NewExpression + | [] TaggedTemplateExpression of TaggedTemplateExpression + // static member inline op_ErasedCast(x: CallExpression) = CallExpression x + // static member inline op_ErasedCast(x: JsxOpeningElement) = JsxOpeningElement x + // static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x + // static member inline op_ErasedCast(x: NewExpression) = NewExpression x + // static member inline op_ErasedCast(x: TaggedTemplateExpression) = TaggedTemplateExpression x type [] [] HasInitializer = - | [] BindingElement of BindingElement - | [] EnumMember of EnumMember - | [] ForInStatement of ForInStatement - | [] ForOfStatement of ForOfStatement - | [] ForStatement of ForStatement - | [] JsxAttribute of JsxAttribute - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertyAssignment of PropertyAssignment - | [] PropertyDeclaration of PropertyDeclaration - | [] VariableDeclaration of VariableDeclaration - static member inline op_ErasedCast(x: BindingElement) = BindingElement x - static member inline op_ErasedCast(x: EnumMember) = EnumMember x - static member inline op_ErasedCast(x: ForInStatement) = ForInStatement x - static member inline op_ErasedCast(x: ForOfStatement) = ForOfStatement x - static member inline op_ErasedCast(x: ForStatement) = ForStatement x - static member inline op_ErasedCast(x: JsxAttribute) = JsxAttribute x - static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x - static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x - static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x - static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x + | [] BindingElement of BindingElement + | [] EnumMember of EnumMember + | [] ForInStatement of ForInStatement + | [] ForOfStatement of ForOfStatement + | [] ForStatement of ForStatement + | [] JsxAttribute of JsxAttribute + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] PropertyDeclaration of PropertyDeclaration + | [] VariableDeclaration of VariableDeclaration + // static member inline op_ErasedCast(x: BindingElement) = BindingElement x + // static member inline op_ErasedCast(x: EnumMember) = EnumMember x + // static member inline op_ErasedCast(x: ForInStatement) = ForInStatement x + // static member inline op_ErasedCast(x: ForOfStatement) = ForOfStatement x + // static member inline op_ErasedCast(x: ForStatement) = ForStatement x + // static member inline op_ErasedCast(x: JsxAttribute) = JsxAttribute x + // static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + // static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + // static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + // static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] [] HasExpressionInitializer = - | [] BindingElement of BindingElement - | [] EnumMember of EnumMember - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertyAssignment of PropertyAssignment - | [] PropertyDeclaration of PropertyDeclaration - | [] VariableDeclaration of VariableDeclaration - static member inline op_ErasedCast(x: BindingElement) = BindingElement x - static member inline op_ErasedCast(x: EnumMember) = EnumMember x - static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x - static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x - static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x - static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x + | [] BindingElement of BindingElement + | [] EnumMember of EnumMember + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] PropertyDeclaration of PropertyDeclaration + | [] VariableDeclaration of VariableDeclaration + // static member inline op_ErasedCast(x: BindingElement) = BindingElement x + // static member inline op_ErasedCast(x: EnumMember) = EnumMember x + // static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + // static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + // static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + // static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] [] HasDecorators = - | [] ClassDeclaration of ClassDeclaration - | [] ClassExpression of ClassExpression - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] MethodDeclaration of MethodDeclaration - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertyDeclaration of PropertyDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration - static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x - static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x - static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x - static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x - static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x - static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x - static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] MethodDeclaration of MethodDeclaration + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyDeclaration of PropertyDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + // static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + // static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + // static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + // static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + // static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + // static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + // static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x type [] [] HasModifiers = - | [] ArrowFunction of ArrowFunction - | [] ClassDeclaration of ClassDeclaration - | [] ClassExpression of ClassExpression - | [] ConstructorDeclaration of ConstructorDeclaration - | [] ConstructorTypeNode of ConstructorTypeNode - | [] EnumDeclaration of EnumDeclaration - | [] ExportAssignment of ExportAssignment - | [] ExportDeclaration of ExportDeclaration - | [] FunctionDeclaration of FunctionDeclaration - | [] FunctionExpression of FunctionExpression - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] ImportDeclaration of ImportDeclaration - | [] ImportEqualsDeclaration of ImportEqualsDeclaration - | [] IndexSignatureDeclaration of IndexSignatureDeclaration - | [] InterfaceDeclaration of InterfaceDeclaration - | [] MethodDeclaration of MethodDeclaration - | [] MethodSignature of MethodSignature - | [] ModuleDeclaration of ModuleDeclaration - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertyDeclaration of PropertyDeclaration - | [] PropertySignature of PropertySignature - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] TypeAliasDeclaration of TypeAliasDeclaration - | [] TypeParameterDeclaration of TypeParameterDeclaration - | [] VariableStatement of VariableStatement - static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x - static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x - static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x - static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x - static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x - static member inline op_ErasedCast(x: EnumDeclaration) = EnumDeclaration x - static member inline op_ErasedCast(x: ExportAssignment) = ExportAssignment x - static member inline op_ErasedCast(x: ExportDeclaration) = ExportDeclaration x - static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x - static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x - static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x - static member inline op_ErasedCast(x: ImportDeclaration) = ImportDeclaration x - static member inline op_ErasedCast(x: ImportEqualsDeclaration) = ImportEqualsDeclaration x - static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x - static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x - static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x - static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x - static member inline op_ErasedCast(x: ModuleDeclaration) = ModuleDeclaration x - static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x - static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x - static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x - static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x - static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x - static member inline op_ErasedCast(x: TypeParameterDeclaration) = TypeParameterDeclaration x - static member inline op_ErasedCast(x: VariableStatement) = VariableStatement x - - type [] NodeArray<'T> = + | [] ArrowFunction of ArrowFunction + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] EnumDeclaration of EnumDeclaration + | [] ExportAssignment of ExportAssignment + | [] ExportDeclaration of ExportDeclaration + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] ImportDeclaration of ImportDeclaration + | [] ImportEqualsDeclaration of ImportEqualsDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] InterfaceDeclaration of InterfaceDeclaration + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] ModuleDeclaration of ModuleDeclaration + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyDeclaration of PropertyDeclaration + | [] PropertySignature of PropertySignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + | [] TypeParameterDeclaration of TypeParameterDeclaration + | [] VariableStatement of VariableStatement + // static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + // static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + // static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + // static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + // static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + // static member inline op_ErasedCast(x: EnumDeclaration) = EnumDeclaration x + // static member inline op_ErasedCast(x: ExportAssignment) = ExportAssignment x + // static member inline op_ErasedCast(x: ExportDeclaration) = ExportDeclaration x + // static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + // static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + // static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + // static member inline op_ErasedCast(x: ImportDeclaration) = ImportDeclaration x + // static member inline op_ErasedCast(x: ImportEqualsDeclaration) = ImportEqualsDeclaration x + // static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + // static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x + // static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + // static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + // static member inline op_ErasedCast(x: ModuleDeclaration) = ModuleDeclaration x + // static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + // static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + // static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x + // static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + // static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x + // static member inline op_ErasedCast(x: TypeParameterDeclaration) = TypeParameterDeclaration x + // static member inline op_ErasedCast(x: VariableStatement) = VariableStatement x + + type [] NodeArray<'T > = inherit ReadonlyArray<'T> inherit ReadonlyTextRange abstract hasTrailingComma: bool @@ -1578,160 +1685,406 @@ module Ts = type [] PunctuationToken<'TKind> = inherit Token<'TKind> + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.DotToken> + /// + /// type DotToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.DotDotDotToken> + /// + /// type DotDotDotToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.QuestionToken> + /// + /// type QuestionToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.ExclamationToken> + /// + /// type ExclamationToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.ColonToken> + /// + /// type ColonToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.EqualsToken> + /// + /// type EqualsToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.AmpersandAmpersandEqualsToken> + /// + /// + type AmpersandAmpersandEqualsToken = + PunctuationToken + + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.BarBarEqualsToken> + /// + /// + type BarBarEqualsToken = + PunctuationToken + + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.QuestionQuestionEqualsToken> + /// + /// + type QuestionQuestionEqualsToken = + PunctuationToken + + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.AsteriskToken> + /// + /// type AsteriskToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.EqualsGreaterThanToken> + /// + /// type EqualsGreaterThanToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.PlusToken> + /// + /// type PlusToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.MinusToken> + /// + /// type MinusToken = PunctuationToken + /// + /// Original in TypeScript: + /// + /// PunctuationToken<SyntaxKind.QuestionDotToken> + /// + /// type QuestionDotToken = PunctuationToken type [] KeywordToken<'TKind> = inherit Token<'TKind> + /// + /// Original in TypeScript: + /// + /// KeywordToken<SyntaxKind.AssertsKeyword> + /// + /// type AssertsKeyword = KeywordToken + /// + /// Original in TypeScript: + /// + /// KeywordToken<SyntaxKind.AssertKeyword> + /// + /// type AssertKeyword = KeywordToken + /// + /// Original in TypeScript: + /// + /// KeywordToken<SyntaxKind.AwaitKeyword> + /// + /// type AwaitKeyword = KeywordToken - [] - type AwaitKeywordToken = - AwaitKeyword - - [] - type AssertsToken = - AssertsKeyword + /// + /// Original in TypeScript: + /// + /// KeywordToken<SyntaxKind.CaseKeyword> + /// + /// + type CaseKeyword = + KeywordToken type [] ModifierToken<'TKind> = inherit KeywordToken<'TKind> + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.AbstractKeyword> + /// + /// type AbstractKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.AccessorKeyword> + /// + /// + type AccessorKeyword = + ModifierToken + + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.AsyncKeyword> + /// + /// type AsyncKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.ConstKeyword> + /// + /// type ConstKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.DeclareKeyword> + /// + /// type DeclareKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.DefaultKeyword> + /// + /// type DefaultKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.ExportKeyword> + /// + /// type ExportKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.InKeyword> + /// + /// type InKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.PrivateKeyword> + /// + /// type PrivateKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.ProtectedKeyword> + /// + /// type ProtectedKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.PublicKeyword> + /// + /// type PublicKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.ReadonlyKeyword> + /// + /// type ReadonlyKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.OutKeyword> + /// + /// type OutKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.OverrideKeyword> + /// + /// type OverrideKeyword = ModifierToken + /// + /// Original in TypeScript: + /// + /// ModifierToken<SyntaxKind.StaticKeyword> + /// + /// type StaticKeyword = ModifierToken - [] - type ReadonlyToken = - ReadonlyKeyword - type [] [] Modifier = - | [] AbstractKeyword of AbstractKeyword - | [] AsyncKeyword of AsyncKeyword - | [] ConstKeyword of ConstKeyword - | [] DeclareKeyword of DeclareKeyword - | [] DefaultKeyword of DefaultKeyword - | [] ExportKeyword of ExportKeyword - | [] InKeyword of InKeyword - | [] OutKeyword of OutKeyword - | [] OverrideKeyword of OverrideKeyword - | [] PrivateKeyword of PrivateKeyword - | [] ProtectedKeyword of ProtectedKeyword - | [] PublicKeyword of PublicKeyword - | [] ReadonlyKeyword of ReadonlyKeyword - | [] StaticKeyword of StaticKeyword - [] - member _.kind : SyntaxKind = jsNative + | [] AbstractKeyword of AbstractKeyword + | [] AccessorKeyword of AccessorKeyword + | [] AsyncKeyword of AsyncKeyword + | [] ConstKeyword of ConstKeyword + | [] DeclareKeyword of DeclareKeyword + | [] DefaultKeyword of DefaultKeyword + | [] ExportKeyword of ExportKeyword + | [] InKeyword of InKeyword + | [] OutKeyword of OutKeyword + | [] OverrideKeyword of OverrideKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + | [] StaticKeyword of StaticKeyword + // static member inline op_ErasedCast(x: AbstractKeyword) = AbstractKeyword x + // static member inline op_ErasedCast(x: AccessorKeyword) = AccessorKeyword x + // static member inline op_ErasedCast(x: AsyncKeyword) = AsyncKeyword x + // static member inline op_ErasedCast(x: ConstKeyword) = ConstKeyword x + // static member inline op_ErasedCast(x: DeclareKeyword) = DeclareKeyword x + // static member inline op_ErasedCast(x: DefaultKeyword) = DefaultKeyword x + // static member inline op_ErasedCast(x: ExportKeyword) = ExportKeyword x + // static member inline op_ErasedCast(x: InKeyword) = InKeyword x + // static member inline op_ErasedCast(x: OutKeyword) = OutKeyword x + // static member inline op_ErasedCast(x: OverrideKeyword) = OverrideKeyword x + // static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x + // static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x + // static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x + // static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x + // static member inline op_ErasedCast(x: StaticKeyword) = StaticKeyword x type [] [] ModifierLike = - | [] AbstractKeyword of AbstractKeyword - | [] AsyncKeyword of AsyncKeyword - | [] ConstKeyword of ConstKeyword - | [] DeclareKeyword of DeclareKeyword - | [] Decorator of Decorator - | [] DefaultKeyword of DefaultKeyword - | [] ExportKeyword of ExportKeyword - | [] InKeyword of InKeyword - | [] OutKeyword of OutKeyword - | [] OverrideKeyword of OverrideKeyword - | [] PrivateKeyword of PrivateKeyword - | [] ProtectedKeyword of ProtectedKeyword - | [] PublicKeyword of PublicKeyword - | [] ReadonlyKeyword of ReadonlyKeyword - | [] StaticKeyword of StaticKeyword + | [] AbstractKeyword of AbstractKeyword + | [] AccessorKeyword of AccessorKeyword + | [] AsyncKeyword of AsyncKeyword + | [] ConstKeyword of ConstKeyword + | [] DeclareKeyword of DeclareKeyword + | [] Decorator of Decorator + | [] DefaultKeyword of DefaultKeyword + | [] ExportKeyword of ExportKeyword + | [] InKeyword of InKeyword + | [] OutKeyword of OutKeyword + | [] OverrideKeyword of OverrideKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + | [] StaticKeyword of StaticKeyword + // static member inline op_ErasedCast(x: AbstractKeyword) = AbstractKeyword x + // static member inline op_ErasedCast(x: AccessorKeyword) = AccessorKeyword x + // static member inline op_ErasedCast(x: AsyncKeyword) = AsyncKeyword x + // static member inline op_ErasedCast(x: ConstKeyword) = ConstKeyword x + // static member inline op_ErasedCast(x: DeclareKeyword) = DeclareKeyword x + // static member inline op_ErasedCast(x: Decorator) = Decorator x + // static member inline op_ErasedCast(x: DefaultKeyword) = DefaultKeyword x + // static member inline op_ErasedCast(x: ExportKeyword) = ExportKeyword x + // static member inline op_ErasedCast(x: InKeyword) = InKeyword x + // static member inline op_ErasedCast(x: OutKeyword) = OutKeyword x + // static member inline op_ErasedCast(x: OverrideKeyword) = OverrideKeyword x + // static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x + // static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x + // static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x + // static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x + // static member inline op_ErasedCast(x: StaticKeyword) = StaticKeyword x type [] [] AccessibilityModifier = - | [] PrivateKeyword of PrivateKeyword - | [] ProtectedKeyword of ProtectedKeyword - | [] PublicKeyword of PublicKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + // static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x + // static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x + // static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x type [] [] ParameterPropertyModifier = - | [] PrivateKeyword of PrivateKeyword - | [] ProtectedKeyword of ProtectedKeyword - | [] PublicKeyword of PublicKeyword - | [] ReadonlyKeyword of ReadonlyKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + // static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x + // static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x + // static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x + // static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x type [] [] ClassMemberModifier = - | [] PrivateKeyword of PrivateKeyword - | [] ProtectedKeyword of ProtectedKeyword - | [] PublicKeyword of PublicKeyword - | [] ReadonlyKeyword of ReadonlyKeyword - | [] StaticKeyword of StaticKeyword + | [] AccessorKeyword of AccessorKeyword + | [] PrivateKeyword of PrivateKeyword + | [] ProtectedKeyword of ProtectedKeyword + | [] PublicKeyword of PublicKeyword + | [] ReadonlyKeyword of ReadonlyKeyword + | [] StaticKeyword of StaticKeyword + // static member inline op_ErasedCast(x: AccessorKeyword) = AccessorKeyword x + // static member inline op_ErasedCast(x: PrivateKeyword) = PrivateKeyword x + // static member inline op_ErasedCast(x: ProtectedKeyword) = ProtectedKeyword x + // static member inline op_ErasedCast(x: PublicKeyword) = PublicKeyword x + // static member inline op_ErasedCast(x: ReadonlyKeyword) = ReadonlyKeyword x + // static member inline op_ErasedCast(x: StaticKeyword) = StaticKeyword x type ModifiersArray = Modifier[] @@ -1746,14 +2099,14 @@ module Ts = type [] Identifier = inherit PrimaryExpression inherit Declaration + inherit JSDocContainer + inherit FlowContainer abstract kind: SyntaxKind /// /// Prefer to use id.unescapedText. (Note: This is available only in services, not internally to the TypeScript compiler.) /// Text of identifier, but if the identifier begins with two underscores, this will begin with three. /// abstract escapedText: __String - abstract originalKeywordKind: SyntaxKind option - abstract isInJSDocNamespace: bool option with get, set abstract text: string type [] TransientIdentifier = @@ -1762,55 +2115,58 @@ module Ts = type [] QualifiedName = inherit Node + inherit FlowContainer abstract kind: SyntaxKind abstract left: EntityName abstract right: Identifier type [] [] EntityName = - | [] Identifier of Identifier - | [] QualifiedName of QualifiedName - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: QualifiedName) = QualifiedName x + | [] Identifier of Identifier + | [] QualifiedName of QualifiedName + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: QualifiedName) = QualifiedName x type [] [] PropertyName = - | [] ComputedPropertyName of ComputedPropertyName - | [] Identifier of Identifier - | [] NumericLiteral of NumericLiteral - | [] PrivateIdentifier of PrivateIdentifier - | [] StringLiteral of StringLiteral - static member inline op_ErasedCast(x: ComputedPropertyName) = ComputedPropertyName x - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x - static member inline op_ErasedCast(x: PrivateIdentifier) = PrivateIdentifier x - static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + | [] ComputedPropertyName of ComputedPropertyName + | [] Identifier of Identifier + | [] NumericLiteral of NumericLiteral + | [] PrivateIdentifier of PrivateIdentifier + | [] StringLiteral of StringLiteral + // static member inline op_ErasedCast(x: ComputedPropertyName) = ComputedPropertyName x + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + // static member inline op_ErasedCast(x: PrivateIdentifier) = PrivateIdentifier x + // static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] [] MemberName = - | [] Identifier of Identifier - | [] PrivateIdentifier of PrivateIdentifier - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: PrivateIdentifier) = PrivateIdentifier x + | [] Identifier of Identifier + | [] PrivateIdentifier of PrivateIdentifier + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: PrivateIdentifier) = PrivateIdentifier x type [] [] DeclarationName = - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ComputedPropertyName of ComputedPropertyName - | [] ElementAccessExpression of ElementAccessExpression - | [] Identifier of Identifier - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] NumericLiteral of NumericLiteral - | [] ObjectBindingPattern of ObjectBindingPattern - | [] PrivateIdentifier of PrivateIdentifier - | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression - | [] StringLiteral of StringLiteral - static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x - static member inline op_ErasedCast(x: ComputedPropertyName) = ComputedPropertyName x - static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x - static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x - static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x - static member inline op_ErasedCast(x: PrivateIdentifier) = PrivateIdentifier x - static member inline op_ErasedCast(x: PropertyAccessEntityNameExpression) = PropertyAccessEntityNameExpression x - static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ComputedPropertyName of ComputedPropertyName + | [] ElementAccessExpression of ElementAccessExpression + | [] Identifier of Identifier + | [] JsxNamespacedName of JsxNamespacedName + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] NumericLiteral of NumericLiteral + | [] ObjectBindingPattern of ObjectBindingPattern + | [] PrivateIdentifier of PrivateIdentifier + | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression + | [] StringLiteral of StringLiteral + // static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + // static member inline op_ErasedCast(x: ComputedPropertyName) = ComputedPropertyName x + // static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: JsxNamespacedName) = JsxNamespacedName x + // static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + // static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + // static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + // static member inline op_ErasedCast(x: PrivateIdentifier) = PrivateIdentifier x + // static member inline op_ErasedCast(x: PropertyAccessEntityNameExpression) = PropertyAccessEntityNameExpression x + // static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] Declaration = inherit Node @@ -1845,6 +2201,7 @@ module Ts = type [] TypeParameterDeclaration = inherit NamedDeclaration + inherit JSDocContainer abstract kind: SyntaxKind abstract parent: U2 abstract modifiers: Modifier[] option @@ -1864,52 +2221,54 @@ module Ts = abstract ``type``: TypeNode option type [] [] SignatureDeclaration = - | [] ArrowFunction of ArrowFunction - | [] CallSignatureDeclaration of CallSignatureDeclaration - | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration - | [] ConstructorDeclaration of ConstructorDeclaration - | [] ConstructorTypeNode of ConstructorTypeNode - | [] FunctionDeclaration of FunctionDeclaration - | [] FunctionExpression of FunctionExpression - | [] FunctionTypeNode of FunctionTypeNode - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] IndexSignatureDeclaration of IndexSignatureDeclaration - | [] JSDocFunctionType of JSDocFunctionType - | [] MethodDeclaration of MethodDeclaration - | [] MethodSignature of MethodSignature - | [] SetAccessorDeclaration of SetAccessorDeclaration - static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x - static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x - static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x - static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x - static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x - static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x - static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x - static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x - static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x - static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x - static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x - static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x - static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x - static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + | [] ArrowFunction of ArrowFunction + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] FunctionTypeNode of FunctionTypeNode + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] JSDocFunctionType of JSDocFunctionType + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + // static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + // static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x + // static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x + // static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + // static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + // static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + // static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + // static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x + // static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + // static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + // static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x + // static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + // static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + // static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x type [] CallSignatureDeclaration = inherit SignatureDeclarationBase inherit TypeElement + inherit LocalsContainer abstract kind: SyntaxKind type [] ConstructSignatureDeclaration = inherit SignatureDeclarationBase inherit TypeElement + inherit LocalsContainer abstract kind: SyntaxKind type [] [] BindingName = - | [] ArrayBindingPattern of ArrayBindingPattern - | [] Identifier of Identifier - | [] ObjectBindingPattern of ObjectBindingPattern - static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + | [] ArrayBindingPattern of ArrayBindingPattern + | [] Identifier of Identifier + | [] ObjectBindingPattern of ObjectBindingPattern + // static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x type [] VariableDeclaration = inherit NamedDeclaration @@ -1941,6 +2300,7 @@ module Ts = type [] BindingElement = inherit NamedDeclaration + inherit FlowContainer abstract kind: SyntaxKind abstract parent: BindingPattern abstract propertyName: PropertyName option @@ -1952,12 +2312,11 @@ module Ts = inherit TypeElement inherit JSDocContainer abstract kind: SyntaxKind + abstract parent: U2 abstract modifiers: Modifier[] option abstract name: PropertyName abstract questionToken: QuestionToken option abstract ``type``: TypeNode option - [] - abstract initializer: Expression option type [] PropertyDeclaration = inherit ClassElement @@ -1971,6 +2330,10 @@ module Ts = abstract ``type``: TypeNode option abstract initializer: Expression option + type [] AutoAccessorPropertyDeclaration = + inherit PropertyDeclaration + abstract _autoAccessorBrand: obj option with get, set + type [] ObjectLiteralElement = inherit NamedDeclaration abstract _objectLiteralBrand: obj option with get, set @@ -1978,18 +2341,18 @@ module Ts = /// Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. type [] [] ObjectLiteralElementLike = - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] MethodDeclaration of MethodDeclaration - | [] PropertyAssignment of PropertyAssignment - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment - | [] SpreadAssignment of SpreadAssignment - static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x - static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x - static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x - static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x - static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x - static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] MethodDeclaration of MethodDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] SpreadAssignment of SpreadAssignment + // static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + // static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + // static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + // static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + // static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x + // static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x type [] PropertyAssignment = inherit ObjectLiteralElement @@ -1998,10 +2361,6 @@ module Ts = abstract parent: ObjectLiteralExpression abstract name: PropertyName abstract initializer: Expression - [] - abstract questionToken: QuestionToken option - [] - abstract exclamationToken: ExclamationToken option type [] ShorthandPropertyAssignment = inherit ObjectLiteralElement @@ -2011,12 +2370,6 @@ module Ts = abstract name: Identifier abstract equalsToken: EqualsToken option abstract objectAssignmentInitializer: Expression option - [] - abstract modifiers: Modifier[] option - [] - abstract questionToken: QuestionToken option - [] - abstract exclamationToken: ExclamationToken option type [] SpreadAssignment = inherit ObjectLiteralElement @@ -2026,32 +2379,28 @@ module Ts = abstract expression: Expression type [] [] VariableLikeDeclaration = - | [] BindingElement of BindingElement - | [] EnumMember of EnumMember - | [] JSDocParameterTag of JSDocParameterTag - | [] JSDocPropertyTag of JSDocPropertyTag - | [] JsxAttribute of JsxAttribute - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertyAssignment of PropertyAssignment - | [] PropertyDeclaration of PropertyDeclaration - | [] PropertySignature of PropertySignature - | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment - | [] VariableDeclaration of VariableDeclaration - static member inline op_ErasedCast(x: BindingElement) = BindingElement x - static member inline op_ErasedCast(x: EnumMember) = EnumMember x - static member inline op_ErasedCast(x: JSDocParameterTag) = JSDocParameterTag x - static member inline op_ErasedCast(x: JSDocPropertyTag) = JSDocPropertyTag x - static member inline op_ErasedCast(x: JsxAttribute) = JsxAttribute x - static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x - static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x - static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x - static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x - static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x - static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x - - type [] PropertyLikeDeclaration = - inherit NamedDeclaration - abstract name: PropertyName + | [] BindingElement of BindingElement + | [] EnumMember of EnumMember + | [] JSDocParameterTag of JSDocParameterTag + | [] JSDocPropertyTag of JSDocPropertyTag + | [] JsxAttribute of JsxAttribute + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyAssignment of PropertyAssignment + | [] PropertyDeclaration of PropertyDeclaration + | [] PropertySignature of PropertySignature + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] VariableDeclaration of VariableDeclaration + // static member inline op_ErasedCast(x: BindingElement) = BindingElement x + // static member inline op_ErasedCast(x: EnumMember) = EnumMember x + // static member inline op_ErasedCast(x: JSDocParameterTag) = JSDocParameterTag x + // static member inline op_ErasedCast(x: JSDocPropertyTag) = JSDocPropertyTag x + // static member inline op_ErasedCast(x: JsxAttribute) = JsxAttribute x + // static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + // static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + // static member inline op_ErasedCast(x: PropertyDeclaration) = PropertyDeclaration x + // static member inline op_ErasedCast(x: PropertySignature) = PropertySignature x + // static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x + // static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] ObjectBindingPattern = inherit Node @@ -2066,16 +2415,16 @@ module Ts = abstract elements: ArrayBindingElement[] type [] [] BindingPattern = - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ObjectBindingPattern of ObjectBindingPattern - static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x - static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ObjectBindingPattern of ObjectBindingPattern + // static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + // static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x type [] [] ArrayBindingElement = - | [] BindingElement of BindingElement - | [] OmittedExpression of OmittedExpression - static member inline op_ErasedCast(x: BindingElement) = BindingElement x - static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x + | [] BindingElement of BindingElement + | [] OmittedExpression of OmittedExpression + // static member inline op_ErasedCast(x: BindingElement) = BindingElement x + // static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x /// Several node kinds share function-like features such as a signature, /// a name, and a body. These nodes should extend FunctionLikeDeclarationBase. @@ -2092,20 +2441,20 @@ module Ts = abstract body: U2 option type [] [] FunctionLikeDeclaration = - | [] ArrowFunction of ArrowFunction - | [] ConstructorDeclaration of ConstructorDeclaration - | [] FunctionDeclaration of FunctionDeclaration - | [] FunctionExpression of FunctionExpression - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] MethodDeclaration of MethodDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration - static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x - static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x - static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x - static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x - static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x - static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x - static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + | [] ArrowFunction of ArrowFunction + | [] ConstructorDeclaration of ConstructorDeclaration + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] MethodDeclaration of MethodDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + // static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + // static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + // static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + // static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + // static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + // static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + // static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x [] type FunctionLike = @@ -2114,16 +2463,18 @@ module Ts = type [] FunctionDeclaration = inherit FunctionLikeDeclarationBase inherit DeclarationStatement + inherit LocalsContainer abstract kind: SyntaxKind - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract name: Identifier option abstract body: FunctionBody option type [] MethodSignature = inherit SignatureDeclarationBase inherit TypeElement + inherit LocalsContainer abstract kind: SyntaxKind - abstract parent: ObjectTypeDeclaration + abstract parent: U2 abstract modifiers: Modifier[] option abstract name: PropertyName @@ -2132,6 +2483,8 @@ module Ts = inherit ClassElement inherit ObjectLiteralElement inherit JSDocContainer + inherit LocalsContainer + inherit FlowContainer abstract kind: SyntaxKind abstract parent: U2 abstract modifiers: ModifierLike[] option @@ -2142,14 +2495,16 @@ module Ts = inherit FunctionLikeDeclarationBase inherit ClassElement inherit JSDocContainer + inherit LocalsContainer abstract kind: SyntaxKind abstract parent: ClassLikeDeclaration - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract body: FunctionBody option /// For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. type [] SemicolonClassElement = inherit ClassElement + inherit JSDocContainer abstract kind: SyntaxKind abstract parent: ClassLikeDeclaration @@ -2159,6 +2514,8 @@ module Ts = inherit TypeElement inherit ObjectLiteralElement inherit JSDocContainer + inherit LocalsContainer + inherit FlowContainer abstract kind: SyntaxKind abstract parent: U4 abstract modifiers: ModifierLike[] option @@ -2171,6 +2528,8 @@ module Ts = inherit TypeElement inherit ObjectLiteralElement inherit JSDocContainer + inherit LocalsContainer + inherit FlowContainer abstract kind: SyntaxKind abstract parent: U4 abstract modifiers: ModifierLike[] option @@ -2178,23 +2537,25 @@ module Ts = abstract body: FunctionBody option type [] [] AccessorDeclaration = - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] SetAccessorDeclaration of SetAccessorDeclaration - static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x - static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] SetAccessorDeclaration of SetAccessorDeclaration + // static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + // static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x type [] IndexSignatureDeclaration = inherit SignatureDeclarationBase inherit ClassElement inherit TypeElement + inherit LocalsContainer abstract kind: SyntaxKind abstract parent: ObjectTypeDeclaration - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract ``type``: TypeNode type [] ClassStaticBlockDeclaration = inherit ClassElement inherit JSDocContainer + inherit LocalsContainer abstract kind: SyntaxKind abstract parent: U2 abstract body: Block @@ -2231,10 +2592,10 @@ module Ts = abstract kind: SyntaxKind type [] [] FunctionOrConstructorTypeNode = - | [] ConstructorTypeNode of ConstructorTypeNode - | [] FunctionTypeNode of FunctionTypeNode - static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x - static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionTypeNode of FunctionTypeNode + // static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + // static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x type [] FunctionOrConstructorTypeNodeBase = inherit TypeNode @@ -2244,12 +2605,12 @@ module Ts = type [] FunctionTypeNode = inherit FunctionOrConstructorTypeNodeBase + inherit LocalsContainer abstract kind: SyntaxKind - [] - abstract modifiers: Modifier[] option type [] ConstructorTypeNode = inherit FunctionOrConstructorTypeNodeBase + inherit LocalsContainer abstract kind: SyntaxKind abstract modifiers: Modifier[] option @@ -2258,10 +2619,10 @@ module Ts = abstract typeArguments: TypeNode[] option type [] [] TypeReferenceType = - | [] ExpressionWithTypeArguments of ExpressionWithTypeArguments - | [] TypeReferenceNode of TypeReferenceNode - static member inline op_ErasedCast(x: ExpressionWithTypeArguments) = ExpressionWithTypeArguments x - static member inline op_ErasedCast(x: TypeReferenceNode) = TypeReferenceNode x + | [] ExpressionWithTypeArguments of ExpressionWithTypeArguments + | [] TypeReferenceNode of TypeReferenceNode + // static member inline op_ErasedCast(x: ExpressionWithTypeArguments) = ExpressionWithTypeArguments x + // static member inline op_ErasedCast(x: TypeReferenceNode) = TypeReferenceNode x type [] TypeReferenceNode = inherit NodeWithTypeArguments @@ -2299,8 +2660,8 @@ module Ts = type [] NamedTupleMember = inherit TypeNode - inherit JSDocContainer inherit Declaration + inherit JSDocContainer abstract kind: SyntaxKind abstract dotDotDotToken: Token option abstract name: Identifier @@ -2318,10 +2679,10 @@ module Ts = abstract ``type``: TypeNode type [] [] UnionOrIntersectionTypeNode = - | [] IntersectionTypeNode of IntersectionTypeNode - | [] UnionTypeNode of UnionTypeNode - static member inline op_ErasedCast(x: IntersectionTypeNode) = IntersectionTypeNode x - static member inline op_ErasedCast(x: UnionTypeNode) = UnionTypeNode x + | [] IntersectionTypeNode of IntersectionTypeNode + | [] UnionTypeNode of UnionTypeNode + // static member inline op_ErasedCast(x: IntersectionTypeNode) = IntersectionTypeNode x + // static member inline op_ErasedCast(x: UnionTypeNode) = UnionTypeNode x type [] UnionTypeNode = inherit TypeNode @@ -2335,6 +2696,7 @@ module Ts = type [] ConditionalTypeNode = inherit TypeNode + inherit LocalsContainer abstract kind: SyntaxKind abstract checkType: TypeNode abstract extendsType: TypeNode @@ -2366,6 +2728,7 @@ module Ts = type [] MappedTypeNode = inherit TypeNode inherit Declaration + inherit LocalsContainer abstract kind: SyntaxKind abstract readonlyToken: U3 option abstract typeParameter: TypeParameterDeclaration @@ -2386,20 +2749,22 @@ module Ts = abstract kind: SyntaxKind type [] [] StringLiteralLike = - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] StringLiteral of StringLiteral - static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x - static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] StringLiteral of StringLiteral + // static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + // static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] [] PropertyNameLiteral = - | [] Identifier of Identifier - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] NumericLiteral of NumericLiteral - | [] StringLiteral of StringLiteral - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x - static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x - static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + | [] Identifier of Identifier + | [] JsxNamespacedName of JsxNamespacedName + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] NumericLiteral of NumericLiteral + | [] StringLiteral of StringLiteral + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: JsxNamespacedName) = JsxNamespacedName x + // static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + // static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + // static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] TemplateLiteralTypeNode = inherit TypeNode @@ -2439,6 +2804,12 @@ module Ts = inherit UnaryExpression abstract _updateExpressionBrand: obj option with get, set + /// + /// Original in TypeScript: + /// + /// SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken + /// + /// type PrefixUnaryOperator = SyntaxKind @@ -2448,6 +2819,12 @@ module Ts = abstract operator: PrefixUnaryOperator abstract operand: UnaryExpression + /// + /// Original in TypeScript: + /// + /// SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken + /// + /// type PostfixUnaryOperator = SyntaxKind @@ -2482,17 +2859,19 @@ module Ts = abstract kind: SyntaxKind type [] [] BooleanLiteral = - | [] FalseLiteral of FalseLiteral - | [] TrueLiteral of TrueLiteral - static member inline op_ErasedCast(x: FalseLiteral) = FalseLiteral x - static member inline op_ErasedCast(x: TrueLiteral) = TrueLiteral x + | [] FalseLiteral of FalseLiteral + | [] TrueLiteral of TrueLiteral + // static member inline op_ErasedCast(x: FalseLiteral) = FalseLiteral x + // static member inline op_ErasedCast(x: TrueLiteral) = TrueLiteral x type [] ThisExpression = inherit PrimaryExpression + inherit FlowContainer abstract kind: SyntaxKind type [] SuperExpression = inherit PrimaryExpression + inherit FlowContainer abstract kind: SyntaxKind type [] ImportExpression = @@ -2532,63 +2911,183 @@ module Ts = abstract ``type``: Type abstract tupleNameSource: U2 option + /// + /// Original in TypeScript: + /// + /// SyntaxKind.AsteriskAsteriskToken + /// + /// type ExponentiationOperator = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken + /// + /// type MultiplicativeOperator = SyntaxKind + /// + /// Original in TypeScript: + /// + /// ExponentiationOperator | MultiplicativeOperator + /// + /// type MultiplicativeOperatorOrHigher = - U2 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.PlusToken | SyntaxKind.MinusToken + /// + /// type AdditiveOperator = SyntaxKind + /// + /// Original in TypeScript: + /// + /// MultiplicativeOperatorOrHigher | AdditiveOperator + /// + /// type AdditiveOperatorOrHigher = - U2 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken + /// + /// type ShiftOperator = SyntaxKind + /// + /// Original in TypeScript: + /// + /// AdditiveOperatorOrHigher | ShiftOperator + /// + /// type ShiftOperatorOrHigher = - U2 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword + /// + /// type RelationalOperator = SyntaxKind + /// + /// Original in TypeScript: + /// + /// ShiftOperatorOrHigher | RelationalOperator + /// + /// type RelationalOperatorOrHigher = - U2 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken + /// + /// type EqualityOperator = SyntaxKind + /// + /// Original in TypeScript: + /// + /// RelationalOperatorOrHigher | EqualityOperator + /// + /// type EqualityOperatorOrHigher = - U2 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken + /// + /// type BitwiseOperator = SyntaxKind + /// + /// Original in TypeScript: + /// + /// EqualityOperatorOrHigher | BitwiseOperator + /// + /// type BitwiseOperatorOrHigher = - U2 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken + /// + /// type LogicalOperator = SyntaxKind + /// + /// Original in TypeScript: + /// + /// BitwiseOperatorOrHigher | LogicalOperator + /// + /// type LogicalOperatorOrHigher = - U2 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.BarBarEqualsToken | SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.QuestionQuestionEqualsToken + /// + /// type CompoundAssignmentOperator = SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.EqualsToken | CompoundAssignmentOperator + /// + /// type AssignmentOperator = - U2 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.QuestionQuestionToken | LogicalOperatorOrHigher | AssignmentOperator + /// + /// type AssignmentOperatorOrHigher = - U3 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// AssignmentOperatorOrHigher | SyntaxKind.CommaToken + /// + /// type BinaryOperator = - U2 + SyntaxKind + /// + /// Original in TypeScript: + /// + /// SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.BarBarEqualsToken | SyntaxKind.QuestionQuestionEqualsToken + /// + /// type LogicalOrCoalescingAssignmentOperator = SyntaxKind @@ -2598,6 +3097,7 @@ module Ts = type [] BinaryExpression = inherit Expression inherit Declaration + inherit JSDocContainer abstract kind: SyntaxKind abstract left: Expression abstract operatorToken: BinaryOperatorToken @@ -2606,7 +3106,7 @@ module Ts = type AssignmentOperatorToken = Token - type [] AssignmentExpression<'TOperator> = + type [] AssignmentExpression<'TOperator > = inherit BinaryExpression abstract left: LeftHandSideExpression abstract operatorToken: 'TOperator @@ -2623,118 +3123,118 @@ module Ts = U2 type [] [] BindingOrAssignmentElement = - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] AssignmentExpression of AssignmentExpression - | [] BindingElement of BindingElement - | [] ElementAccessExpression of ElementAccessExpression - | [] Identifier of Identifier - | [] ObjectLiteralExpression of ObjectLiteralExpression - | [] OmittedExpression of OmittedExpression - | [] ParameterDeclaration of ParameterDeclaration - | [] PropertyAccessExpression of PropertyAccessExpression - | [] PropertyAssignment of PropertyAssignment - | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment - | [] SpreadAssignment of SpreadAssignment - | [] SpreadElement of SpreadElement - | [] VariableDeclaration of VariableDeclaration - static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x - static member inline op_ErasedCast(x: AssignmentExpression) = AssignmentExpression x - static member inline op_ErasedCast(x: BindingElement) = BindingElement x - static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x - static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x - static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x - static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x - static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x - static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x - static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x - static member inline op_ErasedCast(x: SpreadElement) = SpreadElement x - static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] AssignmentExpression of AssignmentExpression + | [] BindingElement of BindingElement + | [] ElementAccessExpression of ElementAccessExpression + | [] Identifier of Identifier + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] OmittedExpression of OmittedExpression + | [] ParameterDeclaration of ParameterDeclaration + | [] PropertyAccessExpression of PropertyAccessExpression + | [] PropertyAssignment of PropertyAssignment + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] SpreadAssignment of SpreadAssignment + | [] SpreadElement of SpreadElement + | [] VariableDeclaration of VariableDeclaration + // static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + // static member inline op_ErasedCast(x: AssignmentExpression) = AssignmentExpression x + // static member inline op_ErasedCast(x: BindingElement) = BindingElement x + // static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + // static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x + // static member inline op_ErasedCast(x: ParameterDeclaration) = ParameterDeclaration x + // static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x + // static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + // static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x + // static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x + // static member inline op_ErasedCast(x: SpreadElement) = SpreadElement x + // static member inline op_ErasedCast(x: VariableDeclaration) = VariableDeclaration x type [] [] ObjectBindingOrAssignmentElement = - | [] BindingElement of BindingElement - | [] PropertyAssignment of PropertyAssignment - | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment - | [] SpreadAssignment of SpreadAssignment - static member inline op_ErasedCast(x: BindingElement) = BindingElement x - static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x - static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x - static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x + | [] BindingElement of BindingElement + | [] PropertyAssignment of PropertyAssignment + | [] ShorthandPropertyAssignment of ShorthandPropertyAssignment + | [] SpreadAssignment of SpreadAssignment + // static member inline op_ErasedCast(x: BindingElement) = BindingElement x + // static member inline op_ErasedCast(x: PropertyAssignment) = PropertyAssignment x + // static member inline op_ErasedCast(x: ShorthandPropertyAssignment) = ShorthandPropertyAssignment x + // static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x type [] [] ArrayBindingOrAssignmentElement = - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] AssignmentExpression of AssignmentExpression - | [] BindingElement of BindingElement - | [] ElementAccessExpression of ElementAccessExpression - | [] Identifier of Identifier - | [] ObjectLiteralExpression of ObjectLiteralExpression - | [] OmittedExpression of OmittedExpression - | [] PropertyAccessExpression of PropertyAccessExpression - | [] SpreadElement of SpreadElement - static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x - static member inline op_ErasedCast(x: AssignmentExpression) = AssignmentExpression x - static member inline op_ErasedCast(x: BindingElement) = BindingElement x - static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x - static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x - static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x - static member inline op_ErasedCast(x: SpreadElement) = SpreadElement x + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] AssignmentExpression of AssignmentExpression + | [] BindingElement of BindingElement + | [] ElementAccessExpression of ElementAccessExpression + | [] Identifier of Identifier + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] OmittedExpression of OmittedExpression + | [] PropertyAccessExpression of PropertyAccessExpression + | [] SpreadElement of SpreadElement + // static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + // static member inline op_ErasedCast(x: AssignmentExpression) = AssignmentExpression x + // static member inline op_ErasedCast(x: BindingElement) = BindingElement x + // static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + // static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x + // static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x + // static member inline op_ErasedCast(x: SpreadElement) = SpreadElement x type [] [] BindingOrAssignmentElementRestIndicator = - | [] DotDotDotToken of DotDotDotToken - | [] SpreadAssignment of SpreadAssignment - | [] SpreadElement of SpreadElement - static member inline op_ErasedCast(x: DotDotDotToken) = DotDotDotToken x - static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x - static member inline op_ErasedCast(x: SpreadElement) = SpreadElement x + | [] DotDotDotToken of DotDotDotToken + | [] SpreadAssignment of SpreadAssignment + | [] SpreadElement of SpreadElement + // static member inline op_ErasedCast(x: DotDotDotToken) = DotDotDotToken x + // static member inline op_ErasedCast(x: SpreadAssignment) = SpreadAssignment x + // static member inline op_ErasedCast(x: SpreadElement) = SpreadElement x type [] [] BindingOrAssignmentElementTarget = - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ElementAccessExpression of ElementAccessExpression - | [] Identifier of Identifier - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ObjectLiteralExpression of ObjectLiteralExpression - | [] OmittedExpression of OmittedExpression - | [] PropertyAccessExpression of PropertyAccessExpression - static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x - static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x - static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x - static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x - static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x - static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ElementAccessExpression of ElementAccessExpression + | [] Identifier of Identifier + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] OmittedExpression of OmittedExpression + | [] PropertyAccessExpression of PropertyAccessExpression + // static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + // static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + // static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + // static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + // static member inline op_ErasedCast(x: OmittedExpression) = OmittedExpression x + // static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x type [] [] ObjectBindingOrAssignmentPattern = - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ObjectLiteralExpression of ObjectLiteralExpression - static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x - static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ObjectLiteralExpression of ObjectLiteralExpression + // static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + // static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x type [] [] ArrayBindingOrAssignmentPattern = - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ArrayLiteralExpression of ArrayLiteralExpression - static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x - static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + // static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + // static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x type [] [] AssignmentPattern = - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectLiteralExpression of ObjectLiteralExpression - static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x - static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectLiteralExpression of ObjectLiteralExpression + // static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + // static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x type [] [] BindingOrAssignmentPattern = - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ObjectLiteralExpression of ObjectLiteralExpression - static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x - static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x - static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x - static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ObjectLiteralExpression of ObjectLiteralExpression + // static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + // static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + // static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + // static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x type [] ConditionalExpression = inherit Expression @@ -2755,6 +3255,8 @@ module Ts = inherit PrimaryExpression inherit FunctionLikeDeclarationBase inherit JSDocContainer + inherit LocalsContainer + inherit FlowContainer abstract kind: SyntaxKind abstract modifiers: Modifier[] option abstract name: Identifier option @@ -2764,6 +3266,8 @@ module Ts = inherit Expression inherit FunctionLikeDeclarationBase inherit JSDocContainer + inherit LocalsContainer + inherit FlowContainer abstract kind: SyntaxKind abstract modifiers: Modifier[] option abstract equalsGreaterThanToken: EqualsGreaterThanToken @@ -2813,18 +3317,18 @@ module Ts = abstract kind: SyntaxKind type [] [] LiteralToken = - | [] BigIntLiteral of BigIntLiteral - | [] JsxText of JsxText - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] NumericLiteral of NumericLiteral - | [] RegularExpressionLiteral of RegularExpressionLiteral - | [] StringLiteral of StringLiteral - static member inline op_ErasedCast(x: BigIntLiteral) = BigIntLiteral x - static member inline op_ErasedCast(x: JsxText) = JsxText x - static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x - static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x - static member inline op_ErasedCast(x: RegularExpressionLiteral) = RegularExpressionLiteral x - static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + | [] BigIntLiteral of BigIntLiteral + | [] JsxText of JsxText + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] NumericLiteral of NumericLiteral + | [] RegularExpressionLiteral of RegularExpressionLiteral + | [] StringLiteral of StringLiteral + // static member inline op_ErasedCast(x: BigIntLiteral) = BigIntLiteral x + // static member inline op_ErasedCast(x: JsxText) = JsxText x + // static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + // static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + // static member inline op_ErasedCast(x: RegularExpressionLiteral) = RegularExpressionLiteral x + // static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] TemplateHead = inherit TemplateLiteralLikeNode @@ -2842,22 +3346,22 @@ module Ts = abstract parent: U2 type [] [] PseudoLiteralToken = - | [] TemplateHead of TemplateHead - | [] TemplateMiddle of TemplateMiddle - | [] TemplateTail of TemplateTail - static member inline op_ErasedCast(x: TemplateHead) = TemplateHead x - static member inline op_ErasedCast(x: TemplateMiddle) = TemplateMiddle x - static member inline op_ErasedCast(x: TemplateTail) = TemplateTail x + | [] TemplateHead of TemplateHead + | [] TemplateMiddle of TemplateMiddle + | [] TemplateTail of TemplateTail + // static member inline op_ErasedCast(x: TemplateHead) = TemplateHead x + // static member inline op_ErasedCast(x: TemplateMiddle) = TemplateMiddle x + // static member inline op_ErasedCast(x: TemplateTail) = TemplateTail x type [] [] TemplateLiteralToken = - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] TemplateHead of TemplateHead - | [] TemplateMiddle of TemplateMiddle - | [] TemplateTail of TemplateTail - static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x - static member inline op_ErasedCast(x: TemplateHead) = TemplateHead x - static member inline op_ErasedCast(x: TemplateMiddle) = TemplateMiddle x - static member inline op_ErasedCast(x: TemplateTail) = TemplateTail x + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] TemplateHead of TemplateHead + | [] TemplateMiddle of TemplateMiddle + | [] TemplateTail of TemplateTail + // static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + // static member inline op_ErasedCast(x: TemplateHead) = TemplateHead x + // static member inline op_ErasedCast(x: TemplateMiddle) = TemplateMiddle x + // static member inline op_ErasedCast(x: TemplateTail) = TemplateTail x type [] TemplateExpression = inherit PrimaryExpression @@ -2866,10 +3370,10 @@ module Ts = abstract templateSpans: TemplateSpan[] type [] [] TemplateLiteral = - | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral - | [] TemplateExpression of TemplateExpression - static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x - static member inline op_ErasedCast(x: TemplateExpression) = TemplateExpression x + | [] NoSubstitutionTemplateLiteral of NoSubstitutionTemplateLiteral + | [] TemplateExpression of TemplateExpression + // static member inline op_ErasedCast(x: NoSubstitutionTemplateLiteral) = NoSubstitutionTemplateLiteral x + // static member inline op_ErasedCast(x: TemplateExpression) = TemplateExpression x type [] TemplateSpan = inherit Node @@ -2899,38 +3403,41 @@ module Ts = /// ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be /// JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type /// ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.) - type [] ObjectLiteralExpressionBase<'T> = + type [] ObjectLiteralExpressionBase<'T > = inherit PrimaryExpression inherit Declaration abstract properties: 'T[] type [] ObjectLiteralExpression = inherit ObjectLiteralExpressionBase + inherit JSDocContainer abstract kind: SyntaxKind type [] [] EntityNameExpression = - | [] Identifier of Identifier - | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: PropertyAccessEntityNameExpression) = PropertyAccessEntityNameExpression x + | [] Identifier of Identifier + | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: PropertyAccessEntityNameExpression) = PropertyAccessEntityNameExpression x type [] [] EntityNameOrEntityNameExpression = - | [] Identifier of Identifier - | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression - | [] QualifiedName of QualifiedName - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: PropertyAccessEntityNameExpression) = PropertyAccessEntityNameExpression x - static member inline op_ErasedCast(x: QualifiedName) = QualifiedName x + | [] Identifier of Identifier + | [] PropertyAccessEntityNameExpression of PropertyAccessEntityNameExpression + | [] QualifiedName of QualifiedName + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: PropertyAccessEntityNameExpression) = PropertyAccessEntityNameExpression x + // static member inline op_ErasedCast(x: QualifiedName) = QualifiedName x type [] [] AccessExpression = - | [] ElementAccessExpression of ElementAccessExpression - | [] PropertyAccessExpression of PropertyAccessExpression - static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x - static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x + | [] ElementAccessExpression of ElementAccessExpression + | [] PropertyAccessExpression of PropertyAccessExpression + // static member inline op_ErasedCast(x: ElementAccessExpression) = ElementAccessExpression x + // static member inline op_ErasedCast(x: PropertyAccessExpression) = PropertyAccessExpression x type [] PropertyAccessExpression = inherit MemberExpression inherit NamedDeclaration + inherit JSDocContainer + inherit FlowContainer abstract kind: SyntaxKind abstract expression: LeftHandSideExpression abstract questionDotToken: QuestionDotToken option @@ -2954,6 +3461,9 @@ module Ts = type [] ElementAccessExpression = inherit MemberExpression + inherit Declaration + inherit JSDocContainer + inherit FlowContainer abstract kind: SyntaxKind abstract expression: LeftHandSideExpression abstract questionDotToken: QuestionDotToken option @@ -2968,10 +3478,10 @@ module Ts = abstract expression: SuperExpression type [] [] SuperProperty = - | [] SuperElementAccessExpression of SuperElementAccessExpression - | [] SuperPropertyAccessExpression of SuperPropertyAccessExpression - static member inline op_ErasedCast(x: SuperElementAccessExpression) = SuperElementAccessExpression x - static member inline op_ErasedCast(x: SuperPropertyAccessExpression) = SuperPropertyAccessExpression x + | [] SuperElementAccessExpression of SuperElementAccessExpression + | [] SuperPropertyAccessExpression of SuperPropertyAccessExpression + // static member inline op_ErasedCast(x: SuperElementAccessExpression) = SuperElementAccessExpression x + // static member inline op_ErasedCast(x: SuperPropertyAccessExpression) = SuperPropertyAccessExpression x type [] CallExpression = inherit LeftHandSideExpression @@ -2987,14 +3497,14 @@ module Ts = abstract _optionalChainBrand: obj option with get, set type [] [] OptionalChain = - | [] CallChain of CallChain - | [] ElementAccessChain of ElementAccessChain - | [] NonNullChain of NonNullChain - | [] PropertyAccessChain of PropertyAccessChain - static member inline op_ErasedCast(x: CallChain) = CallChain x - static member inline op_ErasedCast(x: ElementAccessChain) = ElementAccessChain x - static member inline op_ErasedCast(x: NonNullChain) = NonNullChain x - static member inline op_ErasedCast(x: PropertyAccessChain) = PropertyAccessChain x + | [] CallChain of CallChain + | [] ElementAccessChain of ElementAccessChain + | [] NonNullChain of NonNullChain + | [] PropertyAccessChain of PropertyAccessChain + // static member inline op_ErasedCast(x: CallChain) = CallChain x + // static member inline op_ErasedCast(x: ElementAccessChain) = ElementAccessChain x + // static member inline op_ErasedCast(x: NonNullChain) = NonNullChain x + // static member inline op_ErasedCast(x: PropertyAccessChain) = PropertyAccessChain x type [] SuperCall = inherit CallExpression @@ -3026,18 +3536,18 @@ module Ts = abstract template: TemplateLiteral type [] [] CallLikeExpression = - | [] CallExpression of CallExpression - | [] Decorator of Decorator - | [] JsxOpeningElement of JsxOpeningElement - | [] JsxSelfClosingElement of JsxSelfClosingElement - | [] NewExpression of NewExpression - | [] TaggedTemplateExpression of TaggedTemplateExpression - static member inline op_ErasedCast(x: CallExpression) = CallExpression x - static member inline op_ErasedCast(x: Decorator) = Decorator x - static member inline op_ErasedCast(x: JsxOpeningElement) = JsxOpeningElement x - static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x - static member inline op_ErasedCast(x: NewExpression) = NewExpression x - static member inline op_ErasedCast(x: TaggedTemplateExpression) = TaggedTemplateExpression x + | [] CallExpression of CallExpression + | [] Decorator of Decorator + | [] JsxOpeningElement of JsxOpeningElement + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] NewExpression of NewExpression + | [] TaggedTemplateExpression of TaggedTemplateExpression + // static member inline op_ErasedCast(x: CallExpression) = CallExpression x + // static member inline op_ErasedCast(x: Decorator) = Decorator x + // static member inline op_ErasedCast(x: JsxOpeningElement) = JsxOpeningElement x + // static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x + // static member inline op_ErasedCast(x: NewExpression) = NewExpression x + // static member inline op_ErasedCast(x: TaggedTemplateExpression) = TaggedTemplateExpression x type [] AsExpression = inherit Expression @@ -3051,11 +3561,17 @@ module Ts = abstract ``type``: TypeNode abstract expression: UnaryExpression + type [] SatisfiesExpression = + inherit Expression + abstract kind: SyntaxKind + abstract expression: Expression + abstract ``type``: TypeNode + type [] [] AssertionExpression = - | [] AsExpression of AsExpression - | [] TypeAssertion of TypeAssertion - static member inline op_ErasedCast(x: AsExpression) = AsExpression x - static member inline op_ErasedCast(x: TypeAssertion) = TypeAssertion x + | [] AsExpression of AsExpression + | [] TypeAssertion of TypeAssertion + // static member inline op_ErasedCast(x: AsExpression) = AsExpression x + // static member inline op_ErasedCast(x: TypeAssertion) = TypeAssertion x type [] NonNullExpression = inherit LeftHandSideExpression @@ -3068,6 +3584,7 @@ module Ts = type [] MetaProperty = inherit PrimaryExpression + inherit FlowContainer abstract kind: SyntaxKind abstract keywordToken: SyntaxKind abstract name: Identifier @@ -3080,34 +3597,50 @@ module Ts = abstract closingElement: JsxClosingElement type [] [] JsxOpeningLikeElement = - | [] JsxOpeningElement of JsxOpeningElement - | [] JsxSelfClosingElement of JsxSelfClosingElement - static member inline op_ErasedCast(x: JsxOpeningElement) = JsxOpeningElement x - static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x + | [] JsxOpeningElement of JsxOpeningElement + | [] JsxSelfClosingElement of JsxSelfClosingElement + // static member inline op_ErasedCast(x: JsxOpeningElement) = JsxOpeningElement x + // static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x type [] [] JsxAttributeLike = - | [] JsxAttribute of JsxAttribute - | [] JsxSpreadAttribute of JsxSpreadAttribute - static member inline op_ErasedCast(x: JsxAttribute) = JsxAttribute x - static member inline op_ErasedCast(x: JsxSpreadAttribute) = JsxSpreadAttribute x + | [] JsxAttribute of JsxAttribute + | [] JsxSpreadAttribute of JsxSpreadAttribute + // static member inline op_ErasedCast(x: JsxAttribute) = JsxAttribute x + // static member inline op_ErasedCast(x: JsxSpreadAttribute) = JsxSpreadAttribute x + + type [] [] JsxAttributeName = + | [] Identifier of Identifier + | [] JsxNamespacedName of JsxNamespacedName + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: JsxNamespacedName) = JsxNamespacedName x type [] [] JsxTagNameExpression = - | [] Identifier of Identifier - | [] JsxTagNamePropertyAccess of JsxTagNamePropertyAccess - | [] ThisExpression of ThisExpression - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: JsxTagNamePropertyAccess) = JsxTagNamePropertyAccess x - static member inline op_ErasedCast(x: ThisExpression) = ThisExpression x + | [] Identifier of Identifier + | [] JsxNamespacedName of JsxNamespacedName + | [] JsxTagNamePropertyAccess of JsxTagNamePropertyAccess + | [] ThisExpression of ThisExpression + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: JsxNamespacedName) = JsxNamespacedName x + // static member inline op_ErasedCast(x: JsxTagNamePropertyAccess) = JsxTagNamePropertyAccess x + // static member inline op_ErasedCast(x: ThisExpression) = ThisExpression x type [] JsxTagNamePropertyAccess = inherit PropertyAccessExpression - abstract expression: JsxTagNameExpression + abstract expression: U3 type [] JsxAttributes = - inherit ObjectLiteralExpressionBase + inherit PrimaryExpression + inherit Declaration + abstract properties: JsxAttributeLike[] abstract kind: SyntaxKind abstract parent: JsxOpeningLikeElement + type [] JsxNamespacedName = + inherit Node + abstract kind: SyntaxKind + abstract name: Identifier + abstract ``namespace``: Identifier + type [] JsxOpeningElement = inherit Expression abstract kind: SyntaxKind @@ -3141,23 +3674,23 @@ module Ts = abstract parent: JsxFragment type [] JsxAttribute = - inherit ObjectLiteralElement + inherit Declaration abstract kind: SyntaxKind abstract parent: JsxAttributes - abstract name: Identifier + abstract name: JsxAttributeName abstract initializer: JsxAttributeValue option type [] [] JsxAttributeValue = - | [] JsxElement of JsxElement - | [] JsxExpression of JsxExpression - | [] JsxFragment of JsxFragment - | [] JsxSelfClosingElement of JsxSelfClosingElement - | [] StringLiteral of StringLiteral - static member inline op_ErasedCast(x: JsxElement) = JsxElement x - static member inline op_ErasedCast(x: JsxExpression) = JsxExpression x - static member inline op_ErasedCast(x: JsxFragment) = JsxFragment x - static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x - static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + | [] JsxElement of JsxElement + | [] JsxExpression of JsxExpression + | [] JsxFragment of JsxFragment + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] StringLiteral of StringLiteral + // static member inline op_ErasedCast(x: JsxElement) = JsxElement x + // static member inline op_ErasedCast(x: JsxExpression) = JsxExpression x + // static member inline op_ErasedCast(x: JsxFragment) = JsxFragment x + // static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x + // static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] JsxSpreadAttribute = inherit ObjectLiteralElement @@ -3185,16 +3718,16 @@ module Ts = abstract containsOnlyTriviaWhiteSpaces: bool type [] [] JsxChild = - | [] JsxElement of JsxElement - | [] JsxExpression of JsxExpression - | [] JsxFragment of JsxFragment - | [] JsxSelfClosingElement of JsxSelfClosingElement - | [] JsxText of JsxText - static member inline op_ErasedCast(x: JsxElement) = JsxElement x - static member inline op_ErasedCast(x: JsxExpression) = JsxExpression x - static member inline op_ErasedCast(x: JsxFragment) = JsxFragment x - static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x - static member inline op_ErasedCast(x: JsxText) = JsxText x + | [] JsxElement of JsxElement + | [] JsxExpression of JsxExpression + | [] JsxFragment of JsxFragment + | [] JsxSelfClosingElement of JsxSelfClosingElement + | [] JsxText of JsxText + // static member inline op_ErasedCast(x: JsxElement) = JsxElement x + // static member inline op_ErasedCast(x: JsxExpression) = JsxExpression x + // static member inline op_ErasedCast(x: JsxFragment) = JsxFragment x + // static member inline op_ErasedCast(x: JsxSelfClosingElement) = JsxSelfClosingElement x + // static member inline op_ErasedCast(x: JsxText) = JsxText x type [] Statement = inherit Node @@ -3217,43 +3750,49 @@ module Ts = type [] DebuggerStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind type [] MissingDeclaration = inherit DeclarationStatement + inherit PrimaryExpression abstract kind: SyntaxKind abstract name: Identifier option type [] [] BlockLike = - | [] Block of Block - | [] CaseClause of CaseClause - | [] DefaultClause of DefaultClause - | [] ModuleBlock of ModuleBlock - | [] SourceFile of SourceFile - static member inline op_ErasedCast(x: Block) = Block x - static member inline op_ErasedCast(x: CaseClause) = CaseClause x - static member inline op_ErasedCast(x: DefaultClause) = DefaultClause x - static member inline op_ErasedCast(x: ModuleBlock) = ModuleBlock x - static member inline op_ErasedCast(x: SourceFile) = SourceFile x + | [] Block of Block + | [] CaseClause of CaseClause + | [] DefaultClause of DefaultClause + | [] ModuleBlock of ModuleBlock + | [] SourceFile of SourceFile + // static member inline op_ErasedCast(x: Block) = Block x + // static member inline op_ErasedCast(x: CaseClause) = CaseClause x + // static member inline op_ErasedCast(x: DefaultClause) = DefaultClause x + // static member inline op_ErasedCast(x: ModuleBlock) = ModuleBlock x + // static member inline op_ErasedCast(x: SourceFile) = SourceFile x type [] Block = inherit Statement + inherit LocalsContainer abstract kind: SyntaxKind abstract statements: Statement[] type [] VariableStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract declarationList: VariableDeclarationList type [] ExpressionStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract expression: Expression type [] IfStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract expression: Expression abstract thenStatement: Statement @@ -3265,11 +3804,13 @@ module Ts = type [] DoStatement = inherit IterationStatement + inherit FlowContainer abstract kind: SyntaxKind abstract expression: Expression type [] WhileStatement = inherit IterationStatement + inherit FlowContainer abstract kind: SyntaxKind abstract expression: Expression @@ -3278,25 +3819,31 @@ module Ts = type [] ForStatement = inherit IterationStatement + inherit LocalsContainer + inherit FlowContainer abstract kind: SyntaxKind abstract initializer: ForInitializer option abstract condition: Expression option abstract incrementor: Expression option type [] [] ForInOrOfStatement = - | [] ForInStatement of ForInStatement - | [] ForOfStatement of ForOfStatement - static member inline op_ErasedCast(x: ForInStatement) = ForInStatement x - static member inline op_ErasedCast(x: ForOfStatement) = ForOfStatement x + | [] ForInStatement of ForInStatement + | [] ForOfStatement of ForOfStatement + // static member inline op_ErasedCast(x: ForInStatement) = ForInStatement x + // static member inline op_ErasedCast(x: ForOfStatement) = ForOfStatement x type [] ForInStatement = inherit IterationStatement + inherit LocalsContainer + inherit FlowContainer abstract kind: SyntaxKind abstract initializer: ForInitializer abstract expression: Expression type [] ForOfStatement = inherit IterationStatement + inherit LocalsContainer + inherit FlowContainer abstract kind: SyntaxKind abstract awaitModifier: AwaitKeyword option abstract initializer: ForInitializer @@ -3304,33 +3851,38 @@ module Ts = type [] BreakStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract label: Identifier option type [] ContinueStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract label: Identifier option type [] [] BreakOrContinueStatement = - | [] BreakStatement of BreakStatement - | [] ContinueStatement of ContinueStatement - static member inline op_ErasedCast(x: BreakStatement) = BreakStatement x - static member inline op_ErasedCast(x: ContinueStatement) = ContinueStatement x + | [] BreakStatement of BreakStatement + | [] ContinueStatement of ContinueStatement + // static member inline op_ErasedCast(x: BreakStatement) = BreakStatement x + // static member inline op_ErasedCast(x: ContinueStatement) = ContinueStatement x type [] ReturnStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract expression: Expression option type [] WithStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract expression: Expression abstract statement: Statement type [] SwitchStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract expression: Expression abstract caseBlock: CaseBlock @@ -3338,6 +3890,7 @@ module Ts = type [] CaseBlock = inherit Node + inherit LocalsContainer abstract kind: SyntaxKind abstract parent: SwitchStatement abstract clauses: CaseOrDefaultClause[] @@ -3357,24 +3910,27 @@ module Ts = abstract statements: Statement[] type [] [] CaseOrDefaultClause = - | [] CaseClause of CaseClause - | [] DefaultClause of DefaultClause - static member inline op_ErasedCast(x: CaseClause) = CaseClause x - static member inline op_ErasedCast(x: DefaultClause) = DefaultClause x + | [] CaseClause of CaseClause + | [] DefaultClause of DefaultClause + // static member inline op_ErasedCast(x: CaseClause) = CaseClause x + // static member inline op_ErasedCast(x: DefaultClause) = DefaultClause x type [] LabeledStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract label: Identifier abstract statement: Statement type [] ThrowStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract expression: Expression type [] TryStatement = inherit Statement + inherit FlowContainer abstract kind: SyntaxKind abstract tryBlock: Block abstract catchClause: CatchClause option @@ -3382,106 +3938,107 @@ module Ts = type [] CatchClause = inherit Node + inherit LocalsContainer abstract kind: SyntaxKind abstract parent: TryStatement abstract variableDeclaration: VariableDeclaration option abstract block: Block type [] [] ObjectTypeDeclaration = - | [] ClassDeclaration of ClassDeclaration - | [] ClassExpression of ClassExpression - | [] InterfaceDeclaration of InterfaceDeclaration - | [] TypeLiteralNode of TypeLiteralNode - static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x - static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x - static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x - static member inline op_ErasedCast(x: TypeLiteralNode) = TypeLiteralNode x + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] InterfaceDeclaration of InterfaceDeclaration + | [] TypeLiteralNode of TypeLiteralNode + // static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + // static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + // static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x + // static member inline op_ErasedCast(x: TypeLiteralNode) = TypeLiteralNode x type [] [] DeclarationWithTypeParameters = - | [] ArrowFunction of ArrowFunction - | [] CallSignatureDeclaration of CallSignatureDeclaration - | [] ClassDeclaration of ClassDeclaration - | [] ClassExpression of ClassExpression - | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration - | [] ConstructorDeclaration of ConstructorDeclaration - | [] ConstructorTypeNode of ConstructorTypeNode - | [] FunctionDeclaration of FunctionDeclaration - | [] FunctionExpression of FunctionExpression - | [] FunctionTypeNode of FunctionTypeNode - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] IndexSignatureDeclaration of IndexSignatureDeclaration - | [] InterfaceDeclaration of InterfaceDeclaration - | [] JSDocCallbackTag of JSDocCallbackTag - | [] JSDocFunctionType of JSDocFunctionType - | [] JSDocSignature of JSDocSignature - | [] JSDocTemplateTag of JSDocTemplateTag - | [] JSDocTypedefTag of JSDocTypedefTag - | [] MethodDeclaration of MethodDeclaration - | [] MethodSignature of MethodSignature - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] TypeAliasDeclaration of TypeAliasDeclaration - static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x - static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x - static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x - static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x - static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x - static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x - static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x - static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x - static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x - static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x - static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x - static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x - static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x - static member inline op_ErasedCast(x: JSDocCallbackTag) = JSDocCallbackTag x - static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x - static member inline op_ErasedCast(x: JSDocSignature) = JSDocSignature x - static member inline op_ErasedCast(x: JSDocTemplateTag) = JSDocTemplateTag x - static member inline op_ErasedCast(x: JSDocTypedefTag) = JSDocTypedefTag x - static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x - static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x - static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x - static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x + | [] ArrowFunction of ArrowFunction + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] FunctionTypeNode of FunctionTypeNode + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] InterfaceDeclaration of InterfaceDeclaration + | [] JSDocCallbackTag of JSDocCallbackTag + | [] JSDocFunctionType of JSDocFunctionType + | [] JSDocSignature of JSDocSignature + | [] JSDocTemplateTag of JSDocTemplateTag + | [] JSDocTypedefTag of JSDocTypedefTag + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + // static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + // static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x + // static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + // static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + // static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x + // static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + // static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + // static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + // static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + // static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x + // static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + // static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + // static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x + // static member inline op_ErasedCast(x: JSDocCallbackTag) = JSDocCallbackTag x + // static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x + // static member inline op_ErasedCast(x: JSDocSignature) = JSDocSignature x + // static member inline op_ErasedCast(x: JSDocTemplateTag) = JSDocTemplateTag x + // static member inline op_ErasedCast(x: JSDocTypedefTag) = JSDocTypedefTag x + // static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + // static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + // static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + // static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x type [] [] DeclarationWithTypeParameterChildren = - | [] ArrowFunction of ArrowFunction - | [] CallSignatureDeclaration of CallSignatureDeclaration - | [] ClassDeclaration of ClassDeclaration - | [] ClassExpression of ClassExpression - | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration - | [] ConstructorDeclaration of ConstructorDeclaration - | [] ConstructorTypeNode of ConstructorTypeNode - | [] FunctionDeclaration of FunctionDeclaration - | [] FunctionExpression of FunctionExpression - | [] FunctionTypeNode of FunctionTypeNode - | [] GetAccessorDeclaration of GetAccessorDeclaration - | [] IndexSignatureDeclaration of IndexSignatureDeclaration - | [] InterfaceDeclaration of InterfaceDeclaration - | [] JSDocFunctionType of JSDocFunctionType - | [] JSDocTemplateTag of JSDocTemplateTag - | [] MethodDeclaration of MethodDeclaration - | [] MethodSignature of MethodSignature - | [] SetAccessorDeclaration of SetAccessorDeclaration - | [] TypeAliasDeclaration of TypeAliasDeclaration - static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x - static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x - static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x - static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x - static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x - static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x - static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x - static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x - static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x - static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x - static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x - static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x - static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x - static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x - static member inline op_ErasedCast(x: JSDocTemplateTag) = JSDocTemplateTag x - static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x - static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x - static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x - static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x + | [] ArrowFunction of ArrowFunction + | [] CallSignatureDeclaration of CallSignatureDeclaration + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + | [] ConstructSignatureDeclaration of ConstructSignatureDeclaration + | [] ConstructorDeclaration of ConstructorDeclaration + | [] ConstructorTypeNode of ConstructorTypeNode + | [] FunctionDeclaration of FunctionDeclaration + | [] FunctionExpression of FunctionExpression + | [] FunctionTypeNode of FunctionTypeNode + | [] GetAccessorDeclaration of GetAccessorDeclaration + | [] IndexSignatureDeclaration of IndexSignatureDeclaration + | [] InterfaceDeclaration of InterfaceDeclaration + | [] JSDocFunctionType of JSDocFunctionType + | [] JSDocTemplateTag of JSDocTemplateTag + | [] MethodDeclaration of MethodDeclaration + | [] MethodSignature of MethodSignature + | [] SetAccessorDeclaration of SetAccessorDeclaration + | [] TypeAliasDeclaration of TypeAliasDeclaration + // static member inline op_ErasedCast(x: ArrowFunction) = ArrowFunction x + // static member inline op_ErasedCast(x: CallSignatureDeclaration) = CallSignatureDeclaration x + // static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + // static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + // static member inline op_ErasedCast(x: ConstructSignatureDeclaration) = ConstructSignatureDeclaration x + // static member inline op_ErasedCast(x: ConstructorDeclaration) = ConstructorDeclaration x + // static member inline op_ErasedCast(x: ConstructorTypeNode) = ConstructorTypeNode x + // static member inline op_ErasedCast(x: FunctionDeclaration) = FunctionDeclaration x + // static member inline op_ErasedCast(x: FunctionExpression) = FunctionExpression x + // static member inline op_ErasedCast(x: FunctionTypeNode) = FunctionTypeNode x + // static member inline op_ErasedCast(x: GetAccessorDeclaration) = GetAccessorDeclaration x + // static member inline op_ErasedCast(x: IndexSignatureDeclaration) = IndexSignatureDeclaration x + // static member inline op_ErasedCast(x: InterfaceDeclaration) = InterfaceDeclaration x + // static member inline op_ErasedCast(x: JSDocFunctionType) = JSDocFunctionType x + // static member inline op_ErasedCast(x: JSDocTemplateTag) = JSDocTemplateTag x + // static member inline op_ErasedCast(x: MethodDeclaration) = MethodDeclaration x + // static member inline op_ErasedCast(x: MethodSignature) = MethodSignature x + // static member inline op_ErasedCast(x: SetAccessorDeclaration) = SetAccessorDeclaration x + // static member inline op_ErasedCast(x: TypeAliasDeclaration) = TypeAliasDeclaration x type [] ClassLikeDeclarationBase = inherit NamedDeclaration @@ -3507,10 +4064,10 @@ module Ts = abstract modifiers: ModifierLike[] option type [] [] ClassLikeDeclaration = - | [] ClassDeclaration of ClassDeclaration - | [] ClassExpression of ClassExpression - static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x - static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x + | [] ClassDeclaration of ClassDeclaration + | [] ClassExpression of ClassExpression + // static member inline op_ErasedCast(x: ClassDeclaration) = ClassDeclaration x + // static member inline op_ErasedCast(x: ClassExpression) = ClassExpression x type [] ClassElement = inherit NamedDeclaration @@ -3527,7 +4084,7 @@ module Ts = inherit DeclarationStatement inherit JSDocContainer abstract kind: SyntaxKind - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract name: Identifier abstract typeParameters: TypeParameterDeclaration[] option abstract heritageClauses: HeritageClause[] option @@ -3543,8 +4100,9 @@ module Ts = type [] TypeAliasDeclaration = inherit DeclarationStatement inherit JSDocContainer + inherit LocalsContainer abstract kind: SyntaxKind - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract name: Identifier abstract typeParameters: TypeParameterDeclaration[] option abstract ``type``: TypeNode @@ -3561,38 +4119,39 @@ module Ts = inherit DeclarationStatement inherit JSDocContainer abstract kind: SyntaxKind - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract name: Identifier abstract members: EnumMember[] type [] [] ModuleName = - | [] Identifier of Identifier - | [] StringLiteral of StringLiteral - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + | [] Identifier of Identifier + | [] StringLiteral of StringLiteral + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] [] ModuleBody = - | [] Identifier of Identifier - | [] ModuleBlock of ModuleBlock - | [] ModuleDeclaration of U2 - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: ModuleBlock) = ModuleBlock x - static member inline op_ErasedCast(x: U2) = ModuleDeclaration x + | [] Identifier of Identifier + | [] ModuleBlock of ModuleBlock + | [] ModuleDeclaration of U2 + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: ModuleBlock) = ModuleBlock x + // static member inline op_ErasedCast(x: U2) = ModuleDeclaration x type [] ModuleDeclaration = inherit DeclarationStatement inherit JSDocContainer + inherit LocalsContainer abstract kind: SyntaxKind abstract parent: U2 - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract name: ModuleName abstract body: U2 option type [] [] NamespaceBody = - | [] ModuleBlock of ModuleBlock - | [] NamespaceDeclaration of NamespaceDeclaration - static member inline op_ErasedCast(x: ModuleBlock) = ModuleBlock x - static member inline op_ErasedCast(x: NamespaceDeclaration) = NamespaceDeclaration x + | [] ModuleBlock of ModuleBlock + | [] NamespaceDeclaration of NamespaceDeclaration + // static member inline op_ErasedCast(x: ModuleBlock) = ModuleBlock x + // static member inline op_ErasedCast(x: NamespaceDeclaration) = NamespaceDeclaration x type [] NamespaceDeclaration = inherit ModuleDeclaration @@ -3600,10 +4159,10 @@ module Ts = abstract body: NamespaceBody type [] [] JSDocNamespaceBody = - | [] Identifier of Identifier - | [] JSDocNamespaceDeclaration of JSDocNamespaceDeclaration - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: JSDocNamespaceDeclaration) = JSDocNamespaceDeclaration x + | [] Identifier of Identifier + | [] JSDocNamespaceDeclaration of JSDocNamespaceDeclaration + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: JSDocNamespaceDeclaration) = JSDocNamespaceDeclaration x type [] JSDocNamespaceDeclaration = inherit ModuleDeclaration @@ -3618,12 +4177,12 @@ module Ts = abstract statements: Statement[] type [] [] ModuleReference = - | [] ExternalModuleReference of ExternalModuleReference - | [] Identifier of Identifier - | [] QualifiedName of QualifiedName - static member inline op_ErasedCast(x: ExternalModuleReference) = ExternalModuleReference x - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: QualifiedName) = QualifiedName x + | [] ExternalModuleReference of ExternalModuleReference + | [] Identifier of Identifier + | [] QualifiedName of QualifiedName + // static member inline op_ErasedCast(x: ExternalModuleReference) = ExternalModuleReference x + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: QualifiedName) = QualifiedName x /// One of: /// - import x = require("mod"); @@ -3633,7 +4192,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: U2 - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract name: Identifier abstract isTypeOnly: bool abstract moduleReference: ModuleReference @@ -3648,23 +4207,23 @@ module Ts = inherit Statement abstract kind: SyntaxKind abstract parent: U2 - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract importClause: ImportClause option /// If this is not a StringLiteral it will be a grammar error. abstract moduleSpecifier: Expression abstract assertClause: AssertClause option type [] [] NamedImportBindings = - | [] NamedImports of NamedImports - | [] NamespaceImport of NamespaceImport - static member inline op_ErasedCast(x: NamedImports) = NamedImports x - static member inline op_ErasedCast(x: NamespaceImport) = NamespaceImport x + | [] NamedImports of NamedImports + | [] NamespaceImport of NamespaceImport + // static member inline op_ErasedCast(x: NamedImports) = NamedImports x + // static member inline op_ErasedCast(x: NamespaceImport) = NamespaceImport x type [] [] NamedExportBindings = - | [] NamedExports of NamedExports - | [] NamespaceExport of NamespaceExport - static member inline op_ErasedCast(x: NamedExports) = NamedExports x - static member inline op_ErasedCast(x: NamespaceExport) = NamespaceExport x + | [] NamedExports of NamedExports + | [] NamespaceExport of NamespaceExport + // static member inline op_ErasedCast(x: NamedExports) = NamedExports x + // static member inline op_ErasedCast(x: NamespaceExport) = NamespaceExport x type [] ImportClause = inherit NamedDeclaration @@ -3675,10 +4234,10 @@ module Ts = abstract namedBindings: NamedImportBindings option type [] [] AssertionKey = - | [] Identifier of Identifier - | [] StringLiteral of StringLiteral - static member inline op_ErasedCast(x: Identifier) = Identifier x - static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + | [] Identifier of Identifier + | [] StringLiteral of StringLiteral + // static member inline op_ErasedCast(x: Identifier) = Identifier x + // static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x type [] AssertEntry = inherit Node @@ -3717,7 +4276,7 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: U2 - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract isTypeOnly: bool /// Will not be assigned in the case of export * from "foo"; abstract exportClause: NamedExportBindings option @@ -3738,10 +4297,10 @@ module Ts = abstract elements: ExportSpecifier[] type [] [] NamedImportsOrExports = - | [] NamedExports of NamedExports - | [] NamedImports of NamedImports - static member inline op_ErasedCast(x: NamedExports) = NamedExports x - static member inline op_ErasedCast(x: NamedImports) = NamedImports x + | [] NamedExports of NamedExports + | [] NamedImports of NamedImports + // static member inline op_ErasedCast(x: NamedExports) = NamedExports x + // static member inline op_ErasedCast(x: NamedImports) = NamedImports x type [] ImportSpecifier = inherit NamedDeclaration @@ -3761,26 +4320,36 @@ module Ts = abstract name: Identifier type [] [] ImportOrExportSpecifier = - | [] ExportSpecifier of ExportSpecifier - | [] ImportSpecifier of ImportSpecifier - static member inline op_ErasedCast(x: ExportSpecifier) = ExportSpecifier x - static member inline op_ErasedCast(x: ImportSpecifier) = ImportSpecifier x + | [] ExportSpecifier of ExportSpecifier + | [] ImportSpecifier of ImportSpecifier + // static member inline op_ErasedCast(x: ExportSpecifier) = ExportSpecifier x + // static member inline op_ErasedCast(x: ImportSpecifier) = ImportSpecifier x type [] [] TypeOnlyCompatibleAliasDeclaration = - | [] ExportSpecifier of ExportSpecifier - | [] ImportClause of ImportClause - | [] ImportEqualsDeclaration of ImportEqualsDeclaration - | [] ImportSpecifier of ImportSpecifier - | [] NamespaceImport of NamespaceImport - static member inline op_ErasedCast(x: ExportSpecifier) = ExportSpecifier x - static member inline op_ErasedCast(x: ImportClause) = ImportClause x - static member inline op_ErasedCast(x: ImportEqualsDeclaration) = ImportEqualsDeclaration x - static member inline op_ErasedCast(x: ImportSpecifier) = ImportSpecifier x - static member inline op_ErasedCast(x: NamespaceImport) = NamespaceImport x + | [] ExportDeclaration of ExportDeclaration + | [] ExportSpecifier of ExportSpecifier + | [] ImportClause of ImportClause + | [] ImportEqualsDeclaration of ImportEqualsDeclaration + | [] ImportSpecifier of ImportSpecifier + | [] NamespaceExport of NamespaceExport + | [] NamespaceImport of NamespaceImport + // static member inline op_ErasedCast(x: ExportDeclaration) = ExportDeclaration x + // static member inline op_ErasedCast(x: ExportSpecifier) = ExportSpecifier x + // static member inline op_ErasedCast(x: ImportClause) = ImportClause x + // static member inline op_ErasedCast(x: ImportEqualsDeclaration) = ImportEqualsDeclaration x + // static member inline op_ErasedCast(x: ImportSpecifier) = ImportSpecifier x + // static member inline op_ErasedCast(x: NamespaceExport) = NamespaceExport x + // static member inline op_ErasedCast(x: NamespaceImport) = NamespaceImport x + + type TypeOnlyImportDeclaration = + obj - type TypeOnlyAliasDeclaration = + type TypeOnlyExportDeclaration = obj + type TypeOnlyAliasDeclaration = + U2 + /// /// This is either an export = or an export default declaration. /// Unless isExportEquals is set, this node was parsed as an export default. @@ -3790,19 +4359,25 @@ module Ts = inherit JSDocContainer abstract kind: SyntaxKind abstract parent: SourceFile - abstract modifiers: Modifier[] option + abstract modifiers: ModifierLike[] option abstract isExportEquals: bool option abstract expression: Expression type [] FileReference = inherit TextRange abstract fileName: string with get, set - abstract resolutionMode: obj option with get, set + abstract resolutionMode: ResolutionMode option with get, set type [] CheckJsDirective = inherit TextRange abstract enabled: bool with get, set + /// + /// Original in TypeScript: + /// + /// SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia + /// + /// type CommentKind = SyntaxKind @@ -3867,6 +4442,7 @@ module Ts = type [] JSDocFunctionType = inherit JSDocType inherit SignatureDeclarationBase + inherit LocalsContainer abstract kind: SyntaxKind type [] JSDocVariadicType = @@ -3880,14 +4456,14 @@ module Ts = abstract ``type``: TypeNode type [] [] JSDocTypeReferencingNode = - | [] JSDocNonNullableType of JSDocNonNullableType - | [] JSDocNullableType of JSDocNullableType - | [] JSDocOptionalType of JSDocOptionalType - | [] JSDocVariadicType of JSDocVariadicType - static member inline op_ErasedCast(x: JSDocNonNullableType) = JSDocNonNullableType x - static member inline op_ErasedCast(x: JSDocNullableType) = JSDocNullableType x - static member inline op_ErasedCast(x: JSDocOptionalType) = JSDocOptionalType x - static member inline op_ErasedCast(x: JSDocVariadicType) = JSDocVariadicType x + | [] JSDocNonNullableType of JSDocNonNullableType + | [] JSDocNullableType of JSDocNullableType + | [] JSDocOptionalType of JSDocOptionalType + | [] JSDocVariadicType of JSDocVariadicType + // static member inline op_ErasedCast(x: JSDocNonNullableType) = JSDocNonNullableType x + // static member inline op_ErasedCast(x: JSDocNullableType) = JSDocNullableType x + // static member inline op_ErasedCast(x: JSDocOptionalType) = JSDocOptionalType x + // static member inline op_ErasedCast(x: JSDocVariadicType) = JSDocVariadicType x type [] JSDoc = inherit Node @@ -3921,14 +4497,14 @@ module Ts = abstract text: string with get, set type [] [] JSDocComment = - | [] JSDocLink of JSDocLink - | [] JSDocLinkCode of JSDocLinkCode - | [] JSDocLinkPlain of JSDocLinkPlain - | [] JSDocText of JSDocText - static member inline op_ErasedCast(x: JSDocLink) = JSDocLink x - static member inline op_ErasedCast(x: JSDocLinkCode) = JSDocLinkCode x - static member inline op_ErasedCast(x: JSDocLinkPlain) = JSDocLinkPlain x - static member inline op_ErasedCast(x: JSDocText) = JSDocText x + | [] JSDocLink of JSDocLink + | [] JSDocLinkCode of JSDocLinkCode + | [] JSDocLinkPlain of JSDocLinkPlain + | [] JSDocText of JSDocText + // static member inline op_ErasedCast(x: JSDocLink) = JSDocLink x + // static member inline op_ErasedCast(x: JSDocLinkCode) = JSDocLinkCode x + // static member inline op_ErasedCast(x: JSDocLinkPlain) = JSDocLinkPlain x + // static member inline op_ErasedCast(x: JSDocText) = JSDocText x type [] JSDocText = inherit Node @@ -3988,6 +4564,7 @@ module Ts = type [] JSDocEnumTag = inherit JSDocTag inherit Declaration + inherit LocalsContainer abstract kind: SyntaxKind abstract parent: JSDoc abstract typeExpression: JSDocTypeExpression @@ -4021,6 +4598,7 @@ module Ts = type [] JSDocTypedefTag = inherit JSDocTag inherit NamedDeclaration + inherit LocalsContainer abstract kind: SyntaxKind abstract parent: JSDoc abstract fullName: U2 option @@ -4030,15 +4608,29 @@ module Ts = type [] JSDocCallbackTag = inherit JSDocTag inherit NamedDeclaration + inherit LocalsContainer abstract kind: SyntaxKind abstract parent: JSDoc abstract fullName: U2 option abstract name: Identifier option abstract typeExpression: JSDocSignature + type [] JSDocOverloadTag = + inherit JSDocTag + abstract kind: SyntaxKind + abstract parent: JSDoc + abstract typeExpression: JSDocSignature + + type [] JSDocThrowsTag = + inherit JSDocTag + abstract kind: SyntaxKind + abstract typeExpression: JSDocTypeExpression option + type [] JSDocSignature = inherit JSDocType inherit Declaration + inherit JSDocContainer + inherit LocalsContainer abstract kind: SyntaxKind abstract typeParameters: JSDocTemplateTag[] option abstract parameters: JSDocParameterTag[] @@ -4064,11 +4656,17 @@ module Ts = type [] JSDocTypeLiteral = inherit JSDocType + inherit Declaration abstract kind: SyntaxKind abstract jsDocPropertyTags: JSDocPropertyLikeTag[] option /// If true, then this type literal represents an *array* of its type. abstract isArrayType: bool + type [] JSDocSatisfiesTag = + inherit JSDocTag + abstract kind: SyntaxKind + abstract typeExpression: JSDocTypeExpression + type [] FlowFlags = | Unreachable = 1 | Start = 2 @@ -4138,7 +4736,7 @@ module Ts = U2 type [] IncompleteType = - abstract flags: TypeFlags with get, set + abstract flags: U2 with get, set abstract ``type``: Type with get, set type [] AmdDependency = @@ -4150,8 +4748,18 @@ module Ts = abstract text: string abstract getLineAndCharacterOfPosition: pos: float -> LineAndCharacter + /// + /// Original in TypeScript: + /// + /// ModuleKind.ESNext | ModuleKind.CommonJS | undefined + /// + /// + type ResolutionMode = + ModuleKind + type [] SourceFile = inherit Declaration + inherit LocalsContainer abstract kind: SyntaxKind abstract statements: Statement[] abstract endOfFileToken: Token @@ -4189,7 +4797,7 @@ module Ts = /// of node). If so, this field will be unset and source files will be considered to be /// CommonJS-output-format by the node module transformer and type checker, regardless of extension or context. /// - abstract impliedNodeFormat: ModuleKind option with get, set + abstract impliedNodeFormat: ResolutionMode option with get, set abstract getLineAndCharacterOfPosition: pos: float -> LineAndCharacter abstract getLineEndOfPosition: pos: float -> float abstract getLineStarts: unit -> float[] @@ -4199,9 +4807,9 @@ module Ts = type [] Bundle = inherit Node abstract kind: SyntaxKind - abstract prepends: U2[] abstract sourceFiles: SourceFile[] + [] type [] InputFiles = inherit Node abstract kind: SyntaxKind @@ -4214,6 +4822,7 @@ module Ts = abstract declarationMapPath: string option with get, set abstract declarationMapText: string option with get, set + [] type [] UnparsedSource = inherit Node abstract kind: SyntaxKind @@ -4230,30 +4839,43 @@ module Ts = abstract syntheticReferences: UnparsedSyntheticReference[] option abstract texts: UnparsedSourceText[] + /// type [] [] UnparsedSourceText = - | [] UnparsedTextLike of UnparsedTextLike - | [] UnparsedPrepend of UnparsedPrepend - | [] UnparsedTextLike' of UnparsedTextLike - + | [] UnparsedTextLike of UnparsedTextLike + | [] UnparsedPrepend of UnparsedPrepend + | [] UnparsedTextLike' of UnparsedTextLike + // static member inline op_ErasedCast(x: UnparsedTextLike) = UnparsedTextLike x + // static member inline op_ErasedCast(x: UnparsedPrepend) = UnparsedPrepend x + // static member inline op_ErasedCast(x: UnparsedTextLike) = UnparsedTextLike' x + + /// type [] [] UnparsedNode = - | [] UnparsedTextLike of UnparsedTextLike - | [] UnparsedPrepend of UnparsedPrepend - | [] UnparsedPrologue of UnparsedPrologue - | [] UnparsedSyntheticReference of UnparsedSyntheticReference - | [] UnparsedTextLike' of UnparsedTextLike + | [] UnparsedTextLike of UnparsedTextLike + | [] UnparsedPrepend of UnparsedPrepend + | [] UnparsedPrologue of UnparsedPrologue + | [] UnparsedSyntheticReference of UnparsedSyntheticReference + | [] UnparsedTextLike' of UnparsedTextLike + // static member inline op_ErasedCast(x: UnparsedTextLike) = UnparsedTextLike x + // static member inline op_ErasedCast(x: UnparsedPrepend) = UnparsedPrepend x + // static member inline op_ErasedCast(x: UnparsedPrologue) = UnparsedPrologue x + // static member inline op_ErasedCast(x: UnparsedSyntheticReference) = UnparsedSyntheticReference x + // static member inline op_ErasedCast(x: UnparsedTextLike) = UnparsedTextLike' x + [] type [] UnparsedSection = inherit Node abstract kind: SyntaxKind abstract parent: UnparsedSource abstract data: string option + [] type [] UnparsedPrologue = inherit UnparsedSection abstract kind: SyntaxKind abstract parent: UnparsedSource abstract data: string + [] type [] UnparsedPrepend = inherit UnparsedSection abstract kind: SyntaxKind @@ -4261,11 +4883,13 @@ module Ts = abstract data: string abstract texts: UnparsedTextLike[] + [] type [] UnparsedTextLike = inherit UnparsedSection abstract kind: SyntaxKind abstract parent: UnparsedSource + [] type [] UnparsedSyntheticReference = inherit UnparsedSection abstract kind: SyntaxKind @@ -4286,22 +4910,22 @@ module Ts = abstract operand: NumericLiteral type [] [] JsonObjectExpression = - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] FalseLiteral of FalseLiteral - | [] NullLiteral of NullLiteral - | [] NumericLiteral of NumericLiteral - | [] ObjectLiteralExpression of ObjectLiteralExpression - | [] JsonMinusNumericLiteral of JsonMinusNumericLiteral - | [] StringLiteral of StringLiteral - | [] TrueLiteral of TrueLiteral - static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x - static member inline op_ErasedCast(x: FalseLiteral) = FalseLiteral x - static member inline op_ErasedCast(x: NullLiteral) = NullLiteral x - static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x - static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x - static member inline op_ErasedCast(x: JsonMinusNumericLiteral) = JsonMinusNumericLiteral x - static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x - static member inline op_ErasedCast(x: TrueLiteral) = TrueLiteral x + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] FalseLiteral of FalseLiteral + | [] NullLiteral of NullLiteral + | [] NumericLiteral of NumericLiteral + | [] ObjectLiteralExpression of ObjectLiteralExpression + | [] JsonMinusNumericLiteral of JsonMinusNumericLiteral + | [] StringLiteral of StringLiteral + | [] TrueLiteral of TrueLiteral + // static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + // static member inline op_ErasedCast(x: FalseLiteral) = FalseLiteral x + // static member inline op_ErasedCast(x: NullLiteral) = NullLiteral x + // static member inline op_ErasedCast(x: NumericLiteral) = NumericLiteral x + // static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + // static member inline op_ErasedCast(x: JsonMinusNumericLiteral) = JsonMinusNumericLiteral x + // static member inline op_ErasedCast(x: StringLiteral) = StringLiteral x + // static member inline op_ErasedCast(x: TrueLiteral) = TrueLiteral x type [] JsonObjectExpressionStatement = inherit ExpressionStatement @@ -4422,8 +5046,6 @@ module Ts = | DiagnosticsPresent_OutputsGenerated = 2 | InvalidProject_OutputsSkipped = 3 | ProjectReferenceCycle_OutputsSkipped = 4 - /// Use ProjectReferenceCycle_OutputsSkipped instead. - | ProjectReferenceCycle_OutputsSkupped = 4 type [] EmitResult = abstract emitSkipped: bool with get, set @@ -4433,12 +5055,14 @@ module Ts = type [] TypeChecker = abstract getTypeOfSymbolAtLocation: symbol: Symbol * node: Node -> Type + abstract getTypeOfSymbol: symbol: Symbol -> Type abstract getDeclaredTypeOfSymbol: symbol: Symbol -> Type abstract getPropertiesOfType: ``type``: Type -> Symbol[] abstract getPropertyOfType: ``type``: Type * propertyName: string -> Symbol option abstract getPrivateIdentifierPropertyOfType: leftType: Type * name: string * location: Node -> Symbol option abstract getIndexInfoOfType: ``type``: Type * kind: IndexKind -> IndexInfo option abstract getIndexInfosOfType: ``type``: Type -> IndexInfo[] + abstract getIndexInfosOfIndexSymbol: indexSymbol: Symbol -> IndexInfo[] abstract getSignaturesOfType: ``type``: Type * kind: SignatureKind -> Signature[] abstract getIndexTypeOfType: ``type``: Type * kind: IndexKind -> Type option abstract getBaseTypes: ``type``: InterfaceType -> BaseType[] @@ -4518,6 +5142,51 @@ module Ts = abstract getApparentType: ``type``: Type -> Type abstract getBaseConstraintOfType: ``type``: Type -> Type option abstract getDefaultFromTypeParameter: ``type``: Type -> Type option + /// + /// Gets the intrinsic any type. There are multiple types that act as any used internally in the compiler, + /// so the type returned by this function should not be used in equality checks to determine if another type + /// is any. Instead, use type.flags & TypeFlags.Any. + /// + abstract getAnyType: unit -> Type + abstract getStringType: unit -> Type + abstract getStringLiteralType: value: string -> StringLiteralType + abstract getNumberType: unit -> Type + abstract getNumberLiteralType: value: float -> NumberLiteralType + abstract getBigIntType: unit -> Type + abstract getBooleanType: unit -> Type + abstract getFalseType: unit -> Type + abstract getTrueType: unit -> Type + abstract getVoidType: unit -> Type + /// + /// Gets the intrinsic undefined type. There are multiple types that act as undefined used internally in the compiler + /// depending on compiler options, so the type returned by this function should not be used in equality checks to determine + /// if another type is undefined. Instead, use type.flags & TypeFlags.Undefined. + /// + abstract getUndefinedType: unit -> Type + /// + /// Gets the intrinsic null type. There are multiple types that act as null used internally in the compiler, + /// so the type returned by this function should not be used in equality checks to determine if another type + /// is null. Instead, use type.flags & TypeFlags.Null. + /// + abstract getNullType: unit -> Type + abstract getESSymbolType: unit -> Type + /// + /// Gets the intrinsic never type. There are multiple types that act as never used internally in the compiler, + /// so the type returned by this function should not be used in equality checks to determine if another type + /// is never. Instead, use type.flags & TypeFlags.Never. + /// + abstract getNeverType: unit -> Type + /// + /// True if this type is the Array or ReadonlyArray type from lib.d.ts. + /// This function will _not_ return true if passed a type which + /// extends Array (for example, the TypeScript AST's NodeArray type). + /// + abstract isArrayType: ``type``: Type -> bool + /// True if this type is a tuple type. This function will _not_ return true if + /// passed a type which extends from a tuple. + abstract isTupleType: ``type``: Type -> bool + /// True if this type is assignable to ReadonlyArray<any>. + abstract isArrayLikeType: ``type``: Type -> bool abstract getTypePredicateOfSignature: signature: Signature -> TypePredicate option /// Depending on the operation performed, it may be appropriate to throw away the checker /// if the cancellation token is triggered. Typically, if it is used for error checking @@ -4546,8 +5215,6 @@ module Ts = | OmitThisParameter = 33554432 | AllowThisInObjectLiteral = 32768 | AllowQualifiedNameInPlaceOfIdentifier = 65536 - /// AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. - | AllowQualifedNameInPlaceOfIdentifier = 65536 | AllowAnonymousIdentifier = 131072 | AllowEmptyUnionOrIntersection = 262144 | AllowEmptyTuple = 524288 @@ -4582,8 +5249,6 @@ module Ts = | InElementType = 2097152 | InFirstTypeArgument = 4194304 | InTypeAlias = 8388608 - /// - | WriteOwnNameForAnyLike = 0 | NodeBuilderFlagsMask = 848330091 type [] SymbolFormatFlags = @@ -4636,10 +5301,10 @@ module Ts = | [] AssertsThisTypePredicate of AssertsThisTypePredicate | [] IdentifierTypePredicate of IdentifierTypePredicate | [] ThisTypePredicate of ThisTypePredicate - static member inline op_ErasedCast(x: AssertsIdentifierTypePredicate) = AssertsIdentifierTypePredicate x - static member inline op_ErasedCast(x: AssertsThisTypePredicate) = AssertsThisTypePredicate x - static member inline op_ErasedCast(x: IdentifierTypePredicate) = IdentifierTypePredicate x - static member inline op_ErasedCast(x: ThisTypePredicate) = ThisTypePredicate x + // static member inline op_ErasedCast(x: AssertsIdentifierTypePredicate) = AssertsIdentifierTypePredicate x + // static member inline op_ErasedCast(x: AssertsThisTypePredicate) = AssertsThisTypePredicate x + // static member inline op_ErasedCast(x: IdentifierTypePredicate) = IdentifierTypePredicate x + // static member inline op_ErasedCast(x: ThisTypePredicate) = ThisTypePredicate x type [] SymbolFlags = | None = 0 @@ -4693,6 +5358,7 @@ module Ts = | MethodExcludes = 103359 | GetAccessorExcludes = 46015 | SetAccessorExcludes = 78783 + | AccessorExcludes = 13247 | TypeParameterExcludes = 526824 | TypeAliasExcludes = 788968 | AliasExcludes = 2097152 @@ -4746,18 +5412,17 @@ module Ts = type __String = U2 - /// ReadonlyMap where keys are __Strings. - type [] ReadonlyUnderscoreEscapedMap<'T> = - inherit ReadonlyESMap<__String, 'T> + [ instead.")>] + type ReadonlyUnderscoreEscapedMap<'T> = + ReadonlyMap<__String, 'T> - /// Map where keys are __Strings. - type [] UnderscoreEscapedMap<'T> = - inherit ESMap<__String, 'T> - inherit ReadonlyUnderscoreEscapedMap<'T> + [ instead.")>] + type UnderscoreEscapedMap<'T> = + Map<__String, 'T> /// SymbolTable based on ES6 Map interface. type SymbolTable = - UnderscoreEscapedMap + Map<__String, Symbol> type [] TypeFlags = | Any = 1 @@ -4790,7 +5455,8 @@ module Ts = | TemplateLiteral = 134217728 | StringMapping = 268435456 | Literal = 2944 - | Unit = 109440 + | Unit = 109472 + | Freshable = 2976 | StringOrNumberLiteral = 384 | PossiblyFalsy = 117724 | StringLike = 402653316 @@ -4810,14 +5476,14 @@ module Ts = | Narrowable = 536624127 type [] [] DestructuringPattern = - | [] ArrayBindingPattern of ArrayBindingPattern - | [] ArrayLiteralExpression of ArrayLiteralExpression - | [] ObjectBindingPattern of ObjectBindingPattern - | [] ObjectLiteralExpression of ObjectLiteralExpression - static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x - static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x - static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x - static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x + | [] ArrayBindingPattern of ArrayBindingPattern + | [] ArrayLiteralExpression of ArrayLiteralExpression + | [] ObjectBindingPattern of ObjectBindingPattern + | [] ObjectLiteralExpression of ObjectLiteralExpression + // static member inline op_ErasedCast(x: ArrayBindingPattern) = ArrayBindingPattern x + // static member inline op_ErasedCast(x: ArrayLiteralExpression) = ArrayLiteralExpression x + // static member inline op_ErasedCast(x: ObjectBindingPattern) = ObjectBindingPattern x + // static member inline op_ErasedCast(x: ObjectLiteralExpression) = ObjectLiteralExpression x type [] Type = abstract flags: TypeFlags with get, set @@ -4849,11 +5515,14 @@ module Ts = abstract isClass: unit -> bool abstract isIndexType: unit -> bool - type [] LiteralType = + type [] FreshableType = inherit Type + abstract freshType: FreshableType with get, set + abstract regularType: FreshableType with get, set + + type [] LiteralType = + inherit FreshableType abstract value: U3 with get, set - abstract freshType: LiteralType with get, set - abstract regularType: LiteralType with get, set type [] UniqueESSymbolType = inherit Type @@ -4873,9 +5542,10 @@ module Ts = abstract value: PseudoBigInt with get, set type [] EnumType = - inherit Type + inherit FreshableType type [] ObjectFlags = + | None = 0 | Class = 1 | Interface = 2 | Reference = 4 @@ -4952,8 +5622,11 @@ module Ts = type [] TupleType = inherit GenericType abstract elementFlags: ElementFlags[] with get, set + /// Number of required or variadic elements abstract minLength: float with get, set + /// Number of initial required or optional elements abstract fixedLength: float with get, set + /// True if tuple has any rest or variadic elements abstract hasRestElement: bool with get, set abstract combinedFlags: ElementFlags with get, set abstract readonly: bool with get, set @@ -5009,7 +5682,7 @@ module Ts = abstract isDistributive: bool with get, set abstract inferTypeParameters: TypeParameter[] option with get, set abstract outerTypeParameters: TypeParameter[] option with get, set - abstract instantiations: Map option with get, set + abstract instantiations: Map option with get, set abstract aliasSymbol: Symbol option with get, set abstract aliasTypeArguments: Type[] option with get, set @@ -5035,7 +5708,7 @@ module Ts = inherit InstantiableType abstract objectFlags: ObjectFlags with get, set abstract baseType: Type with get, set - abstract substitute: Type with get, set + abstract ``constraint``: Type with get, set type [] SignatureKind = | Call = 0 @@ -5064,6 +5737,7 @@ module Ts = abstract declaration: IndexSignatureDeclaration option with get, set type [] InferencePriority = + | None = 0 | NakedTypeVariable = 1 | SpeculativeTuple = 2 | SubstituteSource = 4 @@ -5079,10 +5753,6 @@ module Ts = | PriorityImpliesCombination = 416 | Circularity = -1 - [] - type JsFileExtensionInfo = - FileExtensionInfo - type [] FileExtensionInfo = abstract extension: string with get, set abstract isMixedContent: bool with get, set @@ -5136,9 +5806,15 @@ module Ts = type [] ModuleResolutionKind = | Classic = 1 + /// + /// NodeJs was renamed to Node10 to better reflect the version of Node that it targets. + /// Use the new name or consider switching to a modern module resolution target. + /// | NodeJs = 2 + | Node10 = 2 | Node16 = 3 | NodeNext = 99 + | Bundler = 100 type [] ModuleDetectionKind = /// Files with imports, exports and/or import.meta are considered modules @@ -5185,7 +5861,9 @@ module Ts = U8[], string[], MapLike, PluginImport[], ProjectReference[]> option type [] CompilerOptions = + abstract allowImportingTsExtensions: bool option with get, set abstract allowJs: bool option with get, set + abstract allowArbitraryExtensions: bool option with get, set abstract allowSyntheticDefaultImports: bool option with get, set abstract allowUmdGlobalAccess: bool option with get, set abstract allowUnreachableCode: bool option with get, set @@ -5194,6 +5872,7 @@ module Ts = abstract baseUrl: string option with get, set abstract charset: string option with get, set abstract checkJs: bool option with get, set + abstract customConditions: string[] option with get, set abstract declaration: bool option with get, set abstract declarationMap: bool option with get, set abstract emitDeclarationOnly: bool option with get, set @@ -5208,6 +5887,7 @@ module Ts = abstract exactOptionalPropertyTypes: bool option with get, set abstract experimentalDecorators: bool option with get, set abstract forceConsistentCasingInFileNames: bool option with get, set + abstract ignoreDeprecations: string option with get, set abstract importHelpers: bool option with get, set abstract importsNotUsedAsValues: ImportsNotUsedAsValues option with get, set abstract inlineSourceMap: bool option with get, set @@ -5258,6 +5938,8 @@ module Ts = abstract incremental: bool option with get, set abstract tsBuildInfoFile: string option with get, set abstract removeComments: bool option with get, set + abstract resolvePackageJsonExports: bool option with get, set + abstract resolvePackageJsonImports: bool option with get, set abstract rootDir: string option with get, set abstract rootDirs: string[] option with get, set abstract skipLibCheck: bool option with get, set @@ -5279,6 +5961,7 @@ module Ts = abstract types: string[] option with get, set /// Paths used to compute primary types search locations abstract typeRoots: string[] option with get, set + abstract verbatimModuleSyntax: bool option with get, set abstract esModuleInterop: bool option with get, set abstract useDefineForClassFields: bool option with get, set [] abstract Item: option: string -> U2 option with get, set @@ -5293,9 +5976,6 @@ module Ts = [] abstract Item: option: string -> CompilerOptionsValue option with get, set type [] TypeAcquisition = - [] - abstract enableAutoDiscovery: bool option with get, set abstract enable: bool option with get, set abstract ``include``: string[] option with get, set abstract exclude: string[] option with get, set @@ -5422,6 +6102,9 @@ Use typeAcquisition.enable instead.")>] abstract resolvedFileName: string with get, set /// True if resolvedFileName comes from node_modules. abstract isExternalLibraryImport: bool option with get, set + /// True if the original module reference used a .ts extension to refer directly to a .ts file, + /// which should produce an error during checking if emit is enabled. + abstract resolvedUsingTsExtension: bool option with get, set /// /// ResolvedModule with an explicitly provided extension property. @@ -5432,7 +6115,7 @@ Use typeAcquisition.enable instead.")>] inherit ResolvedModule /// Extension of resolvedFileName. This must match what's at the end of resolvedFileName. /// This is optional for backwards-compatibility, but will be added if not provided. - abstract extension: Extension with get, set + abstract extension: string with get, set abstract packageId: PackageId option with get, set /// @@ -5479,7 +6162,6 @@ Use typeAcquisition.enable instead.")>] type [] ResolvedTypeReferenceDirectiveWithFailedLookupLocations = abstract resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective option - abstract failedLookupLocations: string[] type [] CompilerHost = inherit ModuleResolutionHost @@ -5494,12 +6176,13 @@ Use typeAcquisition.enable instead.")>] abstract useCaseSensitiveFileNames: unit -> bool abstract getNewLine: unit -> string abstract readDirectory: rootDir: string * extensions: string[] * excludes: string[] option * includes: string[] * ?depth: float -> string[] - abstract resolveModuleNames: moduleNames: string[] * containingFile: string * reusedNames: string[] option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResolvedModule option[] /// Returns the module resolution cache used by a provided resolveModuleNames implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it abstract getModuleResolutionCache: unit -> ModuleResolutionCache option - /// This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files - abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: U2 * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingFileMode: obj -> ResolvedTypeReferenceDirective option[] + abstract resolveModuleNameLiterals: moduleLiterals: StringLiteralLike[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * containingSourceFile: SourceFile * reusedNames: StringLiteralLike[] option -> ResolvedModuleWithFailedLookupLocations[] + abstract resolveTypeReferenceDirectiveReferences: typeDirectiveReferences: 'T[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * containingSourceFile: SourceFile option * reusedNames: 'T[] option -> ResolvedTypeReferenceDirectiveWithFailedLookupLocations[] abstract getEnvironmentVariable: name: string -> string option + /// If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives + abstract hasInvalidatedResolutions: filePath: Path -> bool abstract createHash: data: string -> string abstract getParsedCommandLine: fileName: string -> ParsedCommandLine option @@ -5516,31 +6199,31 @@ Use typeAcquisition.enable instead.")>] type [] EmitFlags = | None = 0 | SingleLine = 1 - | AdviseOnEmitNode = 2 - | NoSubstitution = 4 - | CapturesThis = 8 - | NoLeadingSourceMap = 16 - | NoTrailingSourceMap = 32 - | NoSourceMap = 48 - | NoNestedSourceMaps = 64 - | NoTokenLeadingSourceMaps = 128 - | NoTokenTrailingSourceMaps = 256 - | NoTokenSourceMaps = 384 - | NoLeadingComments = 512 - | NoTrailingComments = 1024 - | NoComments = 1536 - | NoNestedComments = 2048 - | HelperName = 4096 - | ExportName = 8192 - | LocalName = 16384 - | InternalName = 32768 - | Indented = 65536 - | NoIndentation = 131072 - | AsyncFunctionBody = 262144 - | ReuseTempVariableScope = 524288 - | CustomPrologue = 1048576 - | NoHoisting = 2097152 - | HasEndOfDeclarationMarker = 4194304 + | MultiLine = 2 + | AdviseOnEmitNode = 4 + | NoSubstitution = 8 + | CapturesThis = 16 + | NoLeadingSourceMap = 32 + | NoTrailingSourceMap = 64 + | NoSourceMap = 96 + | NoNestedSourceMaps = 128 + | NoTokenLeadingSourceMaps = 256 + | NoTokenTrailingSourceMaps = 512 + | NoTokenSourceMaps = 768 + | NoLeadingComments = 1024 + | NoTrailingComments = 2048 + | NoComments = 3072 + | NoNestedComments = 4096 + | HelperName = 8192 + | ExportName = 16384 + | LocalName = 32768 + | InternalName = 65536 + | Indented = 131072 + | NoIndentation = 262144 + | AsyncFunctionBody = 524288 + | ReuseTempVariableScope = 1048576 + | CustomPrologue = 2097152 + | NoHoisting = 4194304 | Iterator = 8388608 | NoAsciiEscaping = 16777216 @@ -5563,8 +6246,8 @@ Use typeAcquisition.enable instead.")>] type [] [] EmitHelper = | [] UnscopedEmitHelper of UnscopedEmitHelper | [] ScopedEmitHelper of ScopedEmitHelper - static member inline op_ErasedCast(x: UnscopedEmitHelper) = UnscopedEmitHelper x - static member inline op_ErasedCast(x: ScopedEmitHelper) = ScopedEmitHelper x + // static member inline op_ErasedCast(x: UnscopedEmitHelper) = UnscopedEmitHelper x + // static member inline op_ErasedCast(x: ScopedEmitHelper) = ScopedEmitHelper x type [] EmitHelperUniqueNameCallback = [] abstract Invoke: name: string -> string @@ -5598,11 +6281,11 @@ Use typeAcquisition.enable instead.")>] | Function type [] NodeFactory = - abstract createNodeArray: ?elements: 'T[] * ?hasTrailingComma: bool -> 'T[] + abstract createNodeArray: ?elements: 'T[] * ?hasTrailingComma: bool -> 'T[] abstract createNumericLiteral: value: U2 * ?numericLiteralFlags: TokenFlags -> NumericLiteral abstract createBigIntLiteral: value: U2 -> BigIntLiteral abstract createStringLiteral: text: string * ?isSingleQuote: bool -> StringLiteral - abstract createStringLiteralFromNode: sourceNode: PropertyNameLiteral * ?isSingleQuote: bool -> StringLiteral + abstract createStringLiteralFromNode: sourceNode: U2 * ?isSingleQuote: bool -> StringLiteral abstract createRegularExpressionLiteral: text: string -> RegularExpressionLiteral abstract createIdentifier: text: string -> Identifier /// Create a unique temporary variable. @@ -5629,7 +6312,10 @@ Use typeAcquisition.enable instead.")>] /// Create a unique name generated for a node. abstract getGeneratedNameForNode: node: Node option * ?flags: GeneratedIdentifierFlags -> Identifier abstract createPrivateIdentifier: text: string -> PrivateIdentifier + abstract createUniquePrivateName: ?text: string -> PrivateIdentifier + abstract getGeneratedPrivateNameForNode: node: Node -> PrivateIdentifier abstract createToken: token: SyntaxKind -> SuperExpression + abstract createToken: token: 'TKind -> PunctuationToken<'TKind> abstract createSuper: unit -> SuperExpression abstract createThis: unit -> ThisExpression abstract createNull: unit -> NullLiteral @@ -5655,8 +6341,8 @@ Use typeAcquisition.enable instead.")>] abstract updateMethodSignature: node: MethodSignature * modifiers: Modifier[] option * name: PropertyName * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> MethodSignature abstract createMethodDeclaration: modifiers: ModifierLike[] option * asteriskToken: AsteriskToken option * name: U2 * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration abstract updateMethodDeclaration: node: MethodDeclaration * modifiers: ModifierLike[] option * asteriskToken: AsteriskToken option * name: PropertyName * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration - abstract createConstructorDeclaration: modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration - abstract updateConstructorDeclaration: node: ConstructorDeclaration * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration + abstract createConstructorDeclaration: modifiers: ModifierLike[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration + abstract updateConstructorDeclaration: node: ConstructorDeclaration * modifiers: ModifierLike[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration abstract createGetAccessorDeclaration: modifiers: ModifierLike[] option * name: U2 * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration abstract updateGetAccessorDeclaration: node: GetAccessorDeclaration * modifiers: ModifierLike[] option * name: PropertyName * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration abstract createSetAccessorDeclaration: modifiers: ModifierLike[] option * name: U2 * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration @@ -5665,8 +6351,8 @@ Use typeAcquisition.enable instead.")>] abstract updateCallSignature: node: CallSignatureDeclaration * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> CallSignatureDeclaration abstract createConstructSignature: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> ConstructSignatureDeclaration abstract updateConstructSignature: node: ConstructSignatureDeclaration * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option -> ConstructSignatureDeclaration - abstract createIndexSignature: modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration - abstract updateIndexSignature: node: IndexSignatureDeclaration * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration + abstract createIndexSignature: modifiers: ModifierLike[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration + abstract updateIndexSignature: node: IndexSignatureDeclaration * modifiers: ModifierLike[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration abstract createTemplateLiteralTypeSpan: ``type``: TypeNode * literal: U2 -> TemplateLiteralTypeSpan abstract updateTemplateLiteralTypeSpan: node: TemplateLiteralTypeSpan * ``type``: TypeNode * literal: U2 -> TemplateLiteralTypeSpan abstract createClassStaticBlockDeclaration: body: Block -> ClassStaticBlockDeclaration @@ -5795,13 +6481,15 @@ Use typeAcquisition.enable instead.")>] abstract updateNonNullChain: node: NonNullChain * expression: Expression -> NonNullChain abstract createMetaProperty: keywordToken: obj * name: Identifier -> MetaProperty abstract updateMetaProperty: node: MetaProperty * name: Identifier -> MetaProperty + abstract createSatisfiesExpression: expression: Expression * ``type``: TypeNode -> SatisfiesExpression + abstract updateSatisfiesExpression: node: SatisfiesExpression * expression: Expression * ``type``: TypeNode -> SatisfiesExpression abstract createTemplateSpan: expression: Expression * literal: U2 -> TemplateSpan abstract updateTemplateSpan: node: TemplateSpan * expression: Expression * literal: U2 -> TemplateSpan abstract createSemicolonClassElement: unit -> SemicolonClassElement abstract createBlock: statements: Statement[] * ?multiLine: bool -> Block abstract updateBlock: node: Block * statements: Statement[] -> Block - abstract createVariableStatement: modifiers: Modifier[] option * declarationList: U2 -> VariableStatement - abstract updateVariableStatement: node: VariableStatement * modifiers: Modifier[] option * declarationList: VariableDeclarationList -> VariableStatement + abstract createVariableStatement: modifiers: ModifierLike[] option * declarationList: U2 -> VariableStatement + abstract updateVariableStatement: node: VariableStatement * modifiers: ModifierLike[] option * declarationList: VariableDeclarationList -> VariableStatement abstract createEmptyStatement: unit -> EmptyStatement abstract createExpressionStatement: expression: Expression -> ExpressionStatement abstract updateExpressionStatement: node: ExpressionStatement * expression: Expression -> ExpressionStatement @@ -5842,24 +6530,24 @@ Use typeAcquisition.enable instead.")>] abstract updateFunctionDeclaration: node: FunctionDeclaration * modifiers: ModifierLike[] option * asteriskToken: AsteriskToken option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration abstract createClassDeclaration: modifiers: ModifierLike[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration abstract updateClassDeclaration: node: ClassDeclaration * modifiers: ModifierLike[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration - abstract createInterfaceDeclaration: modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration - abstract updateInterfaceDeclaration: node: InterfaceDeclaration * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration - abstract createTypeAliasDeclaration: modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration - abstract updateTypeAliasDeclaration: node: TypeAliasDeclaration * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration - abstract createEnumDeclaration: modifiers: Modifier[] option * name: U2 * members: EnumMember[] -> EnumDeclaration - abstract updateEnumDeclaration: node: EnumDeclaration * modifiers: Modifier[] option * name: Identifier * members: EnumMember[] -> EnumDeclaration - abstract createModuleDeclaration: modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option * ?flags: NodeFlags -> ModuleDeclaration - abstract updateModuleDeclaration: node: ModuleDeclaration * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option -> ModuleDeclaration + abstract createInterfaceDeclaration: modifiers: ModifierLike[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration + abstract updateInterfaceDeclaration: node: InterfaceDeclaration * modifiers: ModifierLike[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration + abstract createTypeAliasDeclaration: modifiers: ModifierLike[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration + abstract updateTypeAliasDeclaration: node: TypeAliasDeclaration * modifiers: ModifierLike[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration + abstract createEnumDeclaration: modifiers: ModifierLike[] option * name: U2 * members: EnumMember[] -> EnumDeclaration + abstract updateEnumDeclaration: node: EnumDeclaration * modifiers: ModifierLike[] option * name: Identifier * members: EnumMember[] -> EnumDeclaration + abstract createModuleDeclaration: modifiers: ModifierLike[] option * name: ModuleName * body: ModuleBody option * ?flags: NodeFlags -> ModuleDeclaration + abstract updateModuleDeclaration: node: ModuleDeclaration * modifiers: ModifierLike[] option * name: ModuleName * body: ModuleBody option -> ModuleDeclaration abstract createModuleBlock: statements: Statement[] -> ModuleBlock abstract updateModuleBlock: node: ModuleBlock * statements: Statement[] -> ModuleBlock abstract createCaseBlock: clauses: CaseOrDefaultClause[] -> CaseBlock abstract updateCaseBlock: node: CaseBlock * clauses: CaseOrDefaultClause[] -> CaseBlock abstract createNamespaceExportDeclaration: name: U2 -> NamespaceExportDeclaration abstract updateNamespaceExportDeclaration: node: NamespaceExportDeclaration * name: Identifier -> NamespaceExportDeclaration - abstract createImportEqualsDeclaration: modifiers: Modifier[] option * isTypeOnly: bool * name: U2 * moduleReference: ModuleReference -> ImportEqualsDeclaration - abstract updateImportEqualsDeclaration: node: ImportEqualsDeclaration * modifiers: Modifier[] option * isTypeOnly: bool * name: Identifier * moduleReference: ModuleReference -> ImportEqualsDeclaration - abstract createImportDeclaration: modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * ?assertClause: AssertClause -> ImportDeclaration - abstract updateImportDeclaration: node: ImportDeclaration * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * assertClause: AssertClause option -> ImportDeclaration + abstract createImportEqualsDeclaration: modifiers: ModifierLike[] option * isTypeOnly: bool * name: U2 * moduleReference: ModuleReference -> ImportEqualsDeclaration + abstract updateImportEqualsDeclaration: node: ImportEqualsDeclaration * modifiers: ModifierLike[] option * isTypeOnly: bool * name: Identifier * moduleReference: ModuleReference -> ImportEqualsDeclaration + abstract createImportDeclaration: modifiers: ModifierLike[] option * importClause: ImportClause option * moduleSpecifier: Expression * ?assertClause: AssertClause -> ImportDeclaration + abstract updateImportDeclaration: node: ImportDeclaration * modifiers: ModifierLike[] option * importClause: ImportClause option * moduleSpecifier: Expression * assertClause: AssertClause option -> ImportDeclaration abstract createImportClause: isTypeOnly: bool * name: Identifier option * namedBindings: NamedImportBindings option -> ImportClause abstract updateImportClause: node: ImportClause * isTypeOnly: bool * name: Identifier option * namedBindings: NamedImportBindings option -> ImportClause abstract createAssertClause: elements: AssertEntry[] * ?multiLine: bool -> AssertClause @@ -5876,10 +6564,10 @@ Use typeAcquisition.enable instead.")>] abstract updateNamedImports: node: NamedImports * elements: ImportSpecifier[] -> NamedImports abstract createImportSpecifier: isTypeOnly: bool * propertyName: Identifier option * name: Identifier -> ImportSpecifier abstract updateImportSpecifier: node: ImportSpecifier * isTypeOnly: bool * propertyName: Identifier option * name: Identifier -> ImportSpecifier - abstract createExportAssignment: modifiers: Modifier[] option * isExportEquals: bool option * expression: Expression -> ExportAssignment - abstract updateExportAssignment: node: ExportAssignment * modifiers: Modifier[] option * expression: Expression -> ExportAssignment - abstract createExportDeclaration: modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * ?moduleSpecifier: Expression * ?assertClause: AssertClause -> ExportDeclaration - abstract updateExportDeclaration: node: ExportDeclaration * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * moduleSpecifier: Expression option * assertClause: AssertClause option -> ExportDeclaration + abstract createExportAssignment: modifiers: ModifierLike[] option * isExportEquals: bool option * expression: Expression -> ExportAssignment + abstract updateExportAssignment: node: ExportAssignment * modifiers: ModifierLike[] option * expression: Expression -> ExportAssignment + abstract createExportDeclaration: modifiers: ModifierLike[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * ?moduleSpecifier: Expression * ?assertClause: AssertClause -> ExportDeclaration + abstract updateExportDeclaration: node: ExportDeclaration * modifiers: ModifierLike[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * moduleSpecifier: Expression option * assertClause: AssertClause option -> ExportDeclaration abstract createNamedExports: elements: ExportSpecifier[] -> NamedExports abstract updateNamedExports: node: NamedExports * elements: ExportSpecifier[] -> NamedExports abstract createExportSpecifier: isTypeOnly: bool * propertyName: U2 option * name: U2 -> ExportSpecifier @@ -5936,6 +6624,8 @@ Use typeAcquisition.enable instead.")>] abstract updateJSDocEnumTag: node: JSDocEnumTag * tagName: Identifier option * typeExpression: JSDocTypeExpression * comment: U2 option -> JSDocEnumTag abstract createJSDocCallbackTag: tagName: Identifier option * typeExpression: JSDocSignature * ?fullName: U2 * ?comment: U2 -> JSDocCallbackTag abstract updateJSDocCallbackTag: node: JSDocCallbackTag * tagName: Identifier option * typeExpression: JSDocSignature * fullName: U2 option * comment: U2 option -> JSDocCallbackTag + abstract createJSDocOverloadTag: tagName: Identifier option * typeExpression: JSDocSignature * ?comment: U2 -> JSDocOverloadTag + abstract updateJSDocOverloadTag: node: JSDocOverloadTag * tagName: Identifier option * typeExpression: JSDocSignature * comment: U2 option -> JSDocOverloadTag abstract createJSDocAugmentsTag: tagName: Identifier option * className: obj * ?comment: U2 -> JSDocAugmentsTag abstract updateJSDocAugmentsTag: node: JSDocAugmentsTag * tagName: Identifier option * className: obj * comment: U2 option -> JSDocAugmentsTag abstract createJSDocImplementsTag: tagName: Identifier option * className: obj * ?comment: U2 -> JSDocImplementsTag @@ -5954,10 +6644,14 @@ Use typeAcquisition.enable instead.")>] abstract updateJSDocReadonlyTag: node: JSDocReadonlyTag * tagName: Identifier option * comment: U2 option -> JSDocReadonlyTag abstract createJSDocUnknownTag: tagName: Identifier * ?comment: U2 -> JSDocUnknownTag abstract updateJSDocUnknownTag: node: JSDocUnknownTag * tagName: Identifier * comment: U2 option -> JSDocUnknownTag - abstract createJSDocDeprecatedTag: tagName: Identifier * ?comment: U2 -> JSDocDeprecatedTag - abstract updateJSDocDeprecatedTag: node: JSDocDeprecatedTag * tagName: Identifier * ?comment: U2 -> JSDocDeprecatedTag - abstract createJSDocOverrideTag: tagName: Identifier * ?comment: U2 -> JSDocOverrideTag - abstract updateJSDocOverrideTag: node: JSDocOverrideTag * tagName: Identifier * ?comment: U2 -> JSDocOverrideTag + abstract createJSDocDeprecatedTag: tagName: Identifier option * ?comment: U2 -> JSDocDeprecatedTag + abstract updateJSDocDeprecatedTag: node: JSDocDeprecatedTag * tagName: Identifier option * ?comment: U2 -> JSDocDeprecatedTag + abstract createJSDocOverrideTag: tagName: Identifier option * ?comment: U2 -> JSDocOverrideTag + abstract updateJSDocOverrideTag: node: JSDocOverrideTag * tagName: Identifier option * ?comment: U2 -> JSDocOverrideTag + abstract createJSDocThrowsTag: tagName: Identifier * typeExpression: JSDocTypeExpression option * ?comment: U2 -> JSDocThrowsTag + abstract updateJSDocThrowsTag: node: JSDocThrowsTag * tagName: Identifier option * typeExpression: JSDocTypeExpression option * ?comment: U2 -> JSDocThrowsTag + abstract createJSDocSatisfiesTag: tagName: Identifier option * typeExpression: JSDocTypeExpression * ?comment: U2 -> JSDocSatisfiesTag + abstract updateJSDocSatisfiesTag: node: JSDocSatisfiesTag * tagName: Identifier option * typeExpression: JSDocTypeExpression * comment: U2 option -> JSDocSatisfiesTag abstract createJSDocText: text: string -> JSDocText abstract updateJSDocText: node: JSDocText * text: string -> JSDocText abstract createJSDocComment: ?comment: U2 * ?tags: JSDocTag[] -> JSDoc @@ -5976,14 +6670,16 @@ Use typeAcquisition.enable instead.")>] abstract createJsxOpeningFragment: unit -> JsxOpeningFragment abstract createJsxJsxClosingFragment: unit -> JsxClosingFragment abstract updateJsxFragment: node: JsxFragment * openingFragment: JsxOpeningFragment * children: JsxChild[] * closingFragment: JsxClosingFragment -> JsxFragment - abstract createJsxAttribute: name: Identifier * initializer: JsxAttributeValue option -> JsxAttribute - abstract updateJsxAttribute: node: JsxAttribute * name: Identifier * initializer: JsxAttributeValue option -> JsxAttribute + abstract createJsxAttribute: name: JsxAttributeName * initializer: JsxAttributeValue option -> JsxAttribute + abstract updateJsxAttribute: node: JsxAttribute * name: JsxAttributeName * initializer: JsxAttributeValue option -> JsxAttribute abstract createJsxAttributes: properties: JsxAttributeLike[] -> JsxAttributes abstract updateJsxAttributes: node: JsxAttributes * properties: JsxAttributeLike[] -> JsxAttributes abstract createJsxSpreadAttribute: expression: Expression -> JsxSpreadAttribute abstract updateJsxSpreadAttribute: node: JsxSpreadAttribute * expression: Expression -> JsxSpreadAttribute abstract createJsxExpression: dotDotDotToken: DotDotDotToken option * expression: Expression option -> JsxExpression abstract updateJsxExpression: node: JsxExpression * expression: Expression option -> JsxExpression + abstract createJsxNamespacedName: ``namespace``: Identifier * name: Identifier -> JsxNamespacedName + abstract updateJsxNamespacedName: node: JsxNamespacedName * ``namespace``: Identifier * name: Identifier -> JsxNamespacedName abstract createCaseClause: expression: Expression * statements: Statement[] -> CaseClause abstract updateCaseClause: node: CaseClause * expression: Expression * statements: Statement[] -> CaseClause abstract createDefaultClause: statements: Statement[] -> DefaultClause @@ -6007,8 +6703,8 @@ Use typeAcquisition.enable instead.")>] abstract updatePartiallyEmittedExpression: node: PartiallyEmittedExpression * expression: Expression -> PartiallyEmittedExpression abstract createCommaListExpression: elements: Expression[] -> CommaListExpression abstract updateCommaListExpression: node: CommaListExpression * elements: Expression[] -> CommaListExpression - abstract createBundle: sourceFiles: SourceFile[] * ?prepends: U2[] -> Bundle - abstract updateBundle: node: Bundle * sourceFiles: SourceFile[] * ?prepends: U2[] -> Bundle + abstract createBundle: sourceFiles: SourceFile[] -> Bundle + abstract updateBundle: node: Bundle * sourceFiles: SourceFile[] -> Bundle abstract createComma: left: Expression * right: Expression -> BinaryExpression abstract createAssignment: left: U2 * right: Expression -> DestructuringAssignment abstract createAssignment: left: Expression * right: Expression -> AssignmentExpression @@ -6050,94 +6746,6 @@ Use typeAcquisition.enable instead.")>] abstract createExportDefault: expression: Expression -> ExportAssignment abstract createExternalModuleExport: exportName: Identifier -> ExportDeclaration abstract restoreOuterExpressions: outerExpression: Expression option * innerExpression: Expression * ?kinds: OuterExpressionKinds -> Expression - [] - abstract createConstructorTypeNode: typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode - [] - abstract updateConstructorTypeNode: node: ConstructorTypeNode * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> ConstructorTypeNode - [] - abstract createImportTypeNode: argument: TypeNode * ?qualifier: EntityName * ?typeArguments: TypeNode[] * ?isTypeOf: bool -> ImportTypeNode - [] - abstract updateImportTypeNode: node: ImportTypeNode * argument: TypeNode * qualifier: EntityName option * typeArguments: TypeNode[] option * ?isTypeOf: bool -> ImportTypeNode - [] - abstract createTypeParameterDeclaration: name: U2 * ?``constraint``: TypeNode * ?defaultType: TypeNode -> TypeParameterDeclaration - [] - abstract updateTypeParameterDeclaration: node: TypeParameterDeclaration * name: Identifier * ``constraint``: TypeNode option * defaultType: TypeNode option -> TypeParameterDeclaration - [] - abstract createParameterDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * ?questionToken: QuestionToken * ?``type``: TypeNode * ?initializer: Expression -> ParameterDeclaration - [] - abstract updateParameterDeclaration: node: ParameterDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * dotDotDotToken: DotDotDotToken option * name: U2 * questionToken: QuestionToken option * ``type``: TypeNode option * initializer: Expression option -> ParameterDeclaration - [] - abstract createPropertyDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration - [] - abstract updatePropertyDeclaration: node: PropertyDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * questionOrExclamationToken: U2 option * ``type``: TypeNode option * initializer: Expression option -> PropertyDeclaration - [] - abstract createMethodDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: U2 * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration - [] - abstract updateMethodDeclaration: node: MethodDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: PropertyName * questionToken: QuestionToken option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> MethodDeclaration - [] - abstract createConstructorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration - [] - abstract updateConstructorDeclaration: node: ConstructorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * body: Block option -> ConstructorDeclaration - [] - abstract createGetAccessorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration - [] - abstract updateGetAccessorDeclaration: node: GetAccessorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: PropertyName * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> GetAccessorDeclaration - [] - abstract createSetAccessorDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration - [] - abstract updateSetAccessorDeclaration: node: SetAccessorDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: PropertyName * parameters: ParameterDeclaration[] * body: Block option -> SetAccessorDeclaration - [] - abstract createIndexSignature: decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration - [] - abstract updateIndexSignature: node: IndexSignatureDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode -> IndexSignatureDeclaration - [] - abstract createClassStaticBlockDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * body: Block -> ClassStaticBlockDeclaration - [] - abstract updateClassStaticBlockDeclaration: node: ClassStaticBlockDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * body: Block -> ClassStaticBlockDeclaration - [] - abstract createClassExpression: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression - [] - abstract updateClassExpression: node: ClassExpression * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassExpression - [] - abstract createFunctionDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration - [] - abstract updateFunctionDeclaration: node: FunctionDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * asteriskToken: AsteriskToken option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * parameters: ParameterDeclaration[] * ``type``: TypeNode option * body: Block option -> FunctionDeclaration - [] - abstract createClassDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration - [] - abstract updateClassDeclaration: node: ClassDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier option * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: ClassElement[] -> ClassDeclaration - [] - abstract createInterfaceDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration - [] - abstract updateInterfaceDeclaration: node: InterfaceDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * heritageClauses: HeritageClause[] option * members: TypeElement[] -> InterfaceDeclaration - [] - abstract createTypeAliasDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration - [] - abstract updateTypeAliasDeclaration: node: TypeAliasDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * typeParameters: TypeParameterDeclaration[] option * ``type``: TypeNode -> TypeAliasDeclaration - [] - abstract createEnumDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: U2 * members: EnumMember[] -> EnumDeclaration - [] - abstract updateEnumDeclaration: node: EnumDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: Identifier * members: EnumMember[] -> EnumDeclaration - [] - abstract createModuleDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option * ?flags: NodeFlags -> ModuleDeclaration - [] - abstract updateModuleDeclaration: node: ModuleDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * name: ModuleName * body: ModuleBody option -> ModuleDeclaration - [] - abstract createImportEqualsDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * name: U2 * moduleReference: ModuleReference -> ImportEqualsDeclaration - [] - abstract updateImportEqualsDeclaration: node: ImportEqualsDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * name: Identifier * moduleReference: ModuleReference -> ImportEqualsDeclaration - [] - abstract createImportDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * ?assertClause: AssertClause -> ImportDeclaration - [] - abstract updateImportDeclaration: node: ImportDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * importClause: ImportClause option * moduleSpecifier: Expression * assertClause: AssertClause option -> ImportDeclaration - [] - abstract createExportAssignment: decorators: Decorator[] option * modifiers: Modifier[] option * isExportEquals: bool option * expression: Expression -> ExportAssignment - [] - abstract updateExportAssignment: node: ExportAssignment * decorators: Decorator[] option * modifiers: Modifier[] option * expression: Expression -> ExportAssignment - [] - abstract createExportDeclaration: decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * ?moduleSpecifier: Expression * ?assertClause: AssertClause -> ExportDeclaration - [] - abstract updateExportDeclaration: node: ExportDeclaration * decorators: Decorator[] option * modifiers: Modifier[] option * isTypeOnly: bool * exportClause: NamedExportBindings option * moduleSpecifier: Expression option * assertClause: AssertClause option -> ExportDeclaration type [] CoreTransformationContext = abstract factory: NodeFactory @@ -6189,7 +6797,7 @@ Use typeAcquisition.enable instead.")>] /// abstract onEmitNode: hint: EmitHint * node: Node * emitCallback: (EmitHint -> Node -> unit) -> unit - type [] TransformationResult<'T> = + type [] TransformationResult<'T > = /// Gets the transformed source files. abstract transformed: 'T[] with get, set /// Gets diagnostics for the transformation. @@ -6213,7 +6821,7 @@ Use typeAcquisition.enable instead.")>] /// A function that is used to initialize and return a Transformer callback, which in turn /// will be used to transform one or more nodes. /// - type [] TransformerFactory<'T> = + type [] TransformerFactory<'T > = /// /// A function that is used to initialize and return a Transformer callback, which in turn /// will be used to transform one or more nodes. @@ -6221,25 +6829,56 @@ Use typeAcquisition.enable instead.")>] [] abstract Invoke: context: TransformationContext -> Transformer<'T> /// A function that transforms a node. - type [] Transformer<'T> = + type [] Transformer<'T > = /// A function that transforms a node. [] abstract Invoke: node: 'T -> 'T /// A function that accepts and possibly transforms a node. - type [] Visitor = + type Visitor = + Visitor + + /// A function that accepts and possibly transforms a node. + type Visitor<'TIn > = + Visitor<'TIn, 'TIn option> + + /// A function that accepts and possibly transforms a node. + type [] Visitor<'TIn, 'TOut > = /// A function that accepts and possibly transforms a node. - [] abstract Invoke: node: Node -> VisitResult + [] abstract Invoke: node: 'TIn -> VisitResult<'TOut> + /// + /// A function that walks a node using the given visitor, lifting node arrays into single nodes, + /// returning an node which satisfies the test. + /// + /// - If the input node is undefined, then the output is undefined. + /// - If the visitor returns undefined, then the output is undefined. + /// - If the output node is not undefined, then it will satisfy the test function. + /// - In order to obtain a return type that is more specific than Node, a test + /// function _must_ be provided, and that function must be a type predicate. + /// + /// For the canonical implementation of this type, @see {visitNode}. + /// type [] NodeVisitor = - [] abstract Invoke: nodes: 'T * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T - [] abstract Invoke: nodes: 'T option * visitor: Visitor option * ?test: (Node -> bool) * ?lift: (Node[] -> 'T) -> 'T option + [] abstract Invoke: node: 'TIn * visitor: Visitor<'TIn, 'TVisited> * test: (Node -> bool) * ?lift: (Node[] -> Node) -> U2<'TOut, obj> + [] abstract Invoke: node: 'TIn * visitor: Visitor<'TIn, 'TVisited> * ?test: (Node -> bool) * ?lift: (Node[] -> Node) -> U2 + /// + /// A function that walks a node array using the given visitor, returning an array whose contents satisfy the test. + /// + /// - If the input node array is undefined, the output is undefined. + /// - If the visitor can return undefined, the node it visits in the array will be reused. + /// - If the output node array is not undefined, then its contents will satisfy the test. + /// - In order to obtain a return type that is more specific than NodeArray<Node>, a test + /// function _must_ be provided, and that function must be a type predicate. + /// + /// For the canonical implementation of this type, @see {visitNodes}. + /// type [] NodesVisitor = - [] abstract Invoke: nodes: 'T[] * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] - [] abstract Invoke: nodes: 'T[] option * visitor: Visitor option * ?test: (Node -> bool) * ?start: float * ?count: float -> 'T[] option + [] abstract Invoke: nodes: 'TInArray * visitor: Visitor<'TIn, Node option> * test: (Node -> bool) * ?start: float * ?count: float -> U2<'TOut[], obj> + [] abstract Invoke: nodes: 'TInArray * visitor: Visitor<'TIn, Node option> * ?test: (Node -> bool) * ?start: float * ?count: float -> U2 type VisitResult<'T> = - U2<'T, 'T[]> option + U2<'T, Node[]> type [] Printer = /// Print a node and its subtree as-is, without any emit transformations. @@ -6261,7 +6900,7 @@ Use typeAcquisition.enable instead.")>] /// abstract printNode: hint: EmitHint * node: Node * sourceFile: SourceFile -> string /// Prints a list of nodes using the given format flags - abstract printList: format: ListFormat * list: 'T[] * sourceFile: SourceFile -> string + abstract printList: format: ListFormat * list: 'T[] * sourceFile: SourceFile -> string /// Prints a source file as-is, without any emit transformations. abstract printFile: sourceFile: SourceFile -> string /// Prints a bundle of source files as-is, without any emit transformations. @@ -6320,7 +6959,6 @@ Use typeAcquisition.enable instead.")>] abstract noEmitHelpers: bool option with get, set type [] GetEffectiveTypeRootsHost = - abstract directoryExists: directoryName: string -> bool abstract getCurrentDirectory: unit -> string type [] TextSpan = @@ -6436,6 +7074,12 @@ Use typeAcquisition.enable instead.")>] abstract includeInlayEnumMemberValueHints: bool option abstract allowRenameOfImportPath: bool option abstract autoImportFileExcludePatterns: string[] option + abstract organizeImportsIgnoreCase: U2 option + abstract organizeImportsCollation: UserPreferencesOrganizeImportsCollation option + abstract organizeImportsLocale: string option + abstract organizeImportsNumericCollation: bool option + abstract organizeImportsAccentCollation: bool option + abstract organizeImportsCaseFirst: UserPreferencesOrganizeImportsCaseFirst option /// Represents a bigint literal value without requiring bigint support type [] PseudoBigInt = @@ -6453,6 +7097,18 @@ Use typeAcquisition.enable instead.")>] type [] DirectoryWatcherCallback = [] abstract Invoke: fileName: string -> unit + type [] [] BufferEncoding = + | Ascii + | Utf8 + | [] ``utf-8`` + | Utf16le + | Ucs2 + | [] ``ucs-2`` + | Base64 + | Latin1 + | Binary + | Hex + type [] System = abstract args: string[] with get, set abstract newLine: string with get, set @@ -6493,13 +7149,13 @@ Use typeAcquisition.enable instead.")>] abstract close: unit -> unit type [] ErrorCallback = - [] abstract Invoke: message: DiagnosticMessage * length: float -> unit + [] abstract Invoke: message: DiagnosticMessage * length: float * ?arg0: obj -> unit type [] Scanner = - abstract getStartPos: unit -> float abstract getToken: unit -> SyntaxKind - abstract getTextPos: unit -> float - abstract getTokenPos: unit -> float + abstract getTokenFullStart: unit -> float + abstract getTokenStart: unit -> float + abstract getTokenEnd: unit -> float abstract getTokenText: unit -> string abstract getTokenValue: unit -> string abstract hasUnicodeEscape: unit -> bool @@ -6512,7 +7168,6 @@ Use typeAcquisition.enable instead.")>] abstract reScanSlashToken: unit -> SyntaxKind abstract reScanAsteriskEqualsToken: unit -> SyntaxKind abstract reScanTemplateToken: isTaggedTemplate: bool -> SyntaxKind - abstract reScanTemplateHeadOrNoSubstitutionTemplate: unit -> SyntaxKind abstract scanJsxIdentifier: unit -> SyntaxKind abstract scanJsxAttributeValue: unit -> SyntaxKind abstract reScanJsxAttributeValue: unit -> SyntaxKind @@ -6529,7 +7184,7 @@ Use typeAcquisition.enable instead.")>] abstract setOnError: onError: ErrorCallback option -> unit abstract setScriptTarget: scriptTarget: ScriptTarget -> unit abstract setLanguageVariant: variant: LanguageVariant -> unit - abstract setTextPos: textPos: float -> unit + abstract resetTokenState: pos: float -> unit abstract lookAhead: callback: (unit -> 'T) -> 'T abstract scanRange: start: float * length: float * callback: (unit -> 'T) -> 'T abstract tryScan: callback: (unit -> 'T) -> 'T @@ -6544,7 +7199,7 @@ Use typeAcquisition.enable instead.")>] /// and files on disk, but needs to be done with a module resolution cache in scope to be performant. /// This is usually undefined for compilations that do not have moduleResolution values of node16 or nodenext. /// - abstract impliedNodeFormat: ModuleKind option with get, set + abstract impliedNodeFormat: ResolutionMode option with get, set /// /// Controls how module-y-ness is set for the given file. Usually the result of calling /// getSetExternalModuleIndicator on a valid CompilerOptions object. If not present, the default @@ -6572,7 +7227,7 @@ Use typeAcquisition.enable instead.")>] abstract watchOptions: WatchOptions option with get, set abstract typeAcquisition: TypeAcquisition option with get, set /// Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet - abstract extendedConfigPath: string option with get, set + abstract extendedConfigPath: U2 option with get, set type [] ExtendedConfigCacheEntry = abstract extendedResult: TsConfigSourceFile with get, set @@ -6580,25 +7235,39 @@ Use typeAcquisition.enable instead.")>] type [] TypeReferenceDirectiveResolutionCache = inherit PerDirectoryResolutionCache + inherit NonRelativeNameResolutionCache inherit PackageJsonInfoCache type [] ModeAwareCache<'T> = - abstract get: key: string * mode: ModuleKind option -> 'T option - abstract set: key: string * mode: ModuleKind option * value: 'T -> ModeAwareCache<'T> - abstract delete: key: string * mode: ModuleKind option -> ModeAwareCache<'T> - abstract has: key: string * mode: ModuleKind option -> bool - abstract forEach: cb: ('T -> string -> ModuleKind option -> unit) -> unit + abstract get: key: string * mode: ResolutionMode -> 'T option + abstract set: key: string * mode: ResolutionMode * value: 'T -> ModeAwareCache<'T> + abstract delete: key: string * mode: ResolutionMode -> ModeAwareCache<'T> + abstract has: key: string * mode: ResolutionMode -> bool + abstract forEach: cb: ('T -> string -> ResolutionMode -> unit) -> unit abstract size: unit -> float /// Cached resolutions per containing directory. /// This assumes that any module id will have the same resolution for sibling files located in the same folder. type [] PerDirectoryResolutionCache<'T> = + abstract getFromDirectoryCache: name: string * mode: ResolutionMode * directoryName: string * redirectedReference: ResolvedProjectReference option -> 'T option abstract getOrCreateCacheForDirectory: directoryName: string * ?redirectedReference: ResolvedProjectReference -> ModeAwareCache<'T> abstract clear: unit -> unit /// Updates with the current compilerOptions the cache will operate with. /// This updates the redirects map as well if needed so module resolutions are cached if they can across the projects abstract update: options: CompilerOptions -> unit + type [] NonRelativeNameResolutionCache<'T> = + abstract getFromNonRelativeNameCache: nonRelativeName: string * mode: ResolutionMode * directoryName: string * redirectedReference: ResolvedProjectReference option -> 'T option + abstract getOrCreateCacheForNonRelativeName: nonRelativeName: string * mode: ResolutionMode * ?redirectedReference: ResolvedProjectReference -> PerNonRelativeNameCache<'T> + abstract clear: unit -> unit + /// Updates with the current compilerOptions the cache will operate with. + /// This updates the redirects map as well if needed so module resolutions are cached if they can across the projects + abstract update: options: CompilerOptions -> unit + + type [] PerNonRelativeNameCache<'T> = + abstract get: directory: string -> 'T option + abstract set: directory: string * result: 'T -> unit + type [] ModuleResolutionCache = inherit PerDirectoryResolutionCache inherit NonRelativeModuleNameResolutionCache @@ -6608,25 +7277,20 @@ Use typeAcquisition.enable instead.")>] /// Stored map from non-relative module name to a table: directory -> result of module lookup in this directory /// We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive. type [] NonRelativeModuleNameResolutionCache = + inherit NonRelativeNameResolutionCache inherit PackageJsonInfoCache - abstract getOrCreateCacheForModuleName: nonRelativeModuleName: string * mode: ModuleKind option * ?redirectedReference: ResolvedProjectReference -> PerModuleNameCache type [] PackageJsonInfoCache = abstract clear: unit -> unit - type [] PerModuleNameCache = - abstract get: directory: string -> ResolvedModuleWithFailedLookupLocations option - abstract set: directory: string * result: ResolvedModuleWithFailedLookupLocations -> unit + type PerModuleNameCache = + PerNonRelativeNameCache type [] FormatDiagnosticsHost = abstract getCurrentDirectory: unit -> string abstract getCanonicalFileName: fileName: string -> string abstract getNewLine: unit -> string - [] - type [] ResolveProjectReferencePathHost = - abstract fileExists: fileName: string -> bool - type [] EmitOutput = abstract outputFiles: OutputFile[] with get, set abstract emitSkipped: bool with get, set @@ -6640,8 +7304,6 @@ Use typeAcquisition.enable instead.")>] {| result: 'T; affected: U2 |} option type [] BuilderProgramHost = - /// return true if file names are treated with case sensitivity - abstract useCaseSensitiveFileNames: unit -> bool /// If provided this would be used this hash instead of actual file shape text for detecting changes abstract createHash: data: string -> string /// When emit or emitNextAffectedFile are called without writeFile, @@ -6711,7 +7373,7 @@ Use typeAcquisition.enable instead.")>] abstract getCurrentDirectory: unit -> string abstract readFile: fileName: string -> string option - type [] IncrementalProgramOptions<'T> = + type [] IncrementalProgramOptions<'T > = abstract rootNames: string[] with get, set abstract options: CompilerOptions with get, set abstract configFileParsingDiagnostics: Diagnostic[] option with get, set @@ -6723,7 +7385,7 @@ Use typeAcquisition.enable instead.")>] [] abstract Invoke: diagnostic: Diagnostic * newLine: string * options: CompilerOptions * ?errorCount: float -> unit /// Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program - type [] CreateProgram<'T> = + type [] CreateProgram<'T > = /// Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program [] abstract Invoke: rootNames: string[] option * options: CompilerOptions option * ?host: CompilerHost * ?oldProgram: 'T * ?configFileParsingDiagnostics: Diagnostic[] * ?projectReferences: ProjectReference[] -> 'T @@ -6732,15 +7394,15 @@ Use typeAcquisition.enable instead.")>] /// If provided, called with Diagnostic message that informs about change in watch status abstract onWatchStatusChange: diagnostic: Diagnostic * newLine: string * options: CompilerOptions * ?errorCount: float -> unit /// Used to watch changes in source files, missing files needed to update the program or config file - abstract watchFile: path: string * callback: FileWatcherCallback * ?pollingInterval: float * ?options: CompilerOptions -> FileWatcher + abstract watchFile: path: string * callback: FileWatcherCallback * ?pollingInterval: float * ?options: WatchOptions -> FileWatcher /// Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added - abstract watchDirectory: path: string * callback: DirectoryWatcherCallback * ?recursive: bool * ?options: CompilerOptions -> FileWatcher + abstract watchDirectory: path: string * callback: DirectoryWatcherCallback * ?recursive: bool * ?options: WatchOptions -> FileWatcher /// If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together abstract setTimeout: callback: (obj option[] -> unit) * ms: float * [] args: obj option[] -> obj option /// If provided, will be used to reset existing delayed compilation abstract clearTimeout: timeoutId: obj option -> unit - type [] ProgramHost<'T> = + type [] ProgramHost<'T > = /// Used to create the program when need for program creation or recreation detected abstract createProgram: CreateProgram<'T> with get, set abstract useCaseSensitiveFileNames: unit -> bool @@ -6767,14 +7429,14 @@ Use typeAcquisition.enable instead.")>] abstract trace: s: string -> unit /// If provided is used to get the environment variable abstract getEnvironmentVariable: name: string -> string option - /// If provided, used to resolve the module names, otherwise typescript's default module resolution - abstract resolveModuleNames: moduleNames: string[] * containingFile: string * reusedNames: string[] option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResolvedModule option[] - /// If provided, used to resolve type reference directives, otherwise typescript's default resolution - abstract resolveTypeReferenceDirectives: typeReferenceDirectiveNames: U2 * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingFileMode: obj -> ResolvedTypeReferenceDirective option[] + abstract resolveModuleNameLiterals: moduleLiterals: StringLiteralLike[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * containingSourceFile: SourceFile * reusedNames: StringLiteralLike[] option -> ResolvedModuleWithFailedLookupLocations[] + abstract resolveTypeReferenceDirectiveReferences: typeDirectiveReferences: 'T[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * containingSourceFile: SourceFile option * reusedNames: 'T[] option -> ResolvedTypeReferenceDirectiveWithFailedLookupLocations[] + /// If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives + abstract hasInvalidatedResolutions: filePath: Path -> bool /// Returns the module resolution cache used by a provided resolveModuleNames implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it abstract getModuleResolutionCache: unit -> ModuleResolutionCache option - type [] WatchCompilerHost<'T> = + type [] WatchCompilerHost<'T > = inherit ProgramHost<'T> inherit WatchHost /// Instead of using output d.ts file from project reference, use its source file @@ -6785,7 +7447,7 @@ Use typeAcquisition.enable instead.")>] abstract afterProgramCreate: program: 'T -> unit /// Host to create watch with root files and options - type [] WatchCompilerHostOfFilesAndCompilerOptions<'T> = + type [] WatchCompilerHostOfFilesAndCompilerOptions<'T > = inherit WatchCompilerHost<'T> /// root files to use to generate program abstract rootFiles: string[] with get, set @@ -6796,7 +7458,7 @@ Use typeAcquisition.enable instead.")>] abstract projectReferences: ProjectReference[] option with get, set /// Host to create watch with config file - type [] WatchCompilerHostOfConfigFile<'T> = + type [] WatchCompilerHostOfConfigFile<'T > = inherit WatchCompilerHost<'T> inherit ConfigFileDiagnosticsReporter /// Name of the config file to compile @@ -6831,6 +7493,11 @@ Use typeAcquisition.enable instead.")>] abstract verbose: bool option with get, set abstract incremental: bool option with get, set abstract assumeChangesOnlyAffectDirectDependencies: bool option with get, set + abstract declaration: bool option with get, set + abstract declarationMap: bool option with get, set + abstract emitDeclarationOnly: bool option with get, set + abstract sourceMap: bool option with get, set + abstract inlineSourceMap: bool option with get, set abstract traceResolution: bool option with get, set [] abstract Item: option: string -> CompilerOptionsValue option with get, set @@ -6841,7 +7508,7 @@ Use typeAcquisition.enable instead.")>] abstract fileName: string with get, set abstract line: float with get, set - type [] SolutionBuilderHostBase<'T> = + type [] SolutionBuilderHostBase<'T > = inherit ProgramHost<'T> abstract createDirectory: path: string -> unit /// Should provide create directory and writeFile if done of invalidatedProjects is not invoked with @@ -6856,15 +7523,15 @@ Use typeAcquisition.enable instead.")>] abstract reportSolutionBuilderStatus: DiagnosticReporter with get, set abstract afterProgramEmitAndDiagnostics: program: 'T -> unit - type [] SolutionBuilderHost<'T> = + type [] SolutionBuilderHost<'T > = inherit SolutionBuilderHostBase<'T> abstract reportErrorSummary: ReportEmitErrorSummary option with get, set - type [] SolutionBuilderWithWatchHost<'T> = + type [] SolutionBuilderWithWatchHost<'T > = inherit SolutionBuilderHostBase<'T> inherit WatchHost - type [] SolutionBuilder<'T> = + type [] SolutionBuilder<'T > = abstract build: ?project: string * ?cancellationToken: CancellationToken * ?writeFile: WriteFileCallback * ?getCustomTransformers: (string -> CustomTransformers) -> ExitStatus abstract clean: ?project: string -> ExitStatus abstract buildReferences: project: string * ?cancellationToken: CancellationToken * ?writeFile: WriteFileCallback * ?getCustomTransformers: (string -> CustomTransformers) -> ExitStatus @@ -6873,6 +7540,7 @@ Use typeAcquisition.enable instead.")>] type [] InvalidatedProjectKind = | Build = 0 + /// | UpdateBundle = 1 | UpdateOutputFileStamps = 2 @@ -6889,7 +7557,7 @@ Use typeAcquisition.enable instead.")>] abstract kind: InvalidatedProjectKind abstract updateOutputFileStatmps: unit -> unit - type [] BuildInvalidedProject<'T> = + type [] BuildInvalidedProject<'T > = inherit InvalidatedProjectBase abstract kind: InvalidatedProjectKind abstract getBuilderProgram: unit -> 'T option @@ -6905,18 +7573,27 @@ Use typeAcquisition.enable instead.")>] abstract getSemanticDiagnosticsOfNextAffectedFile: ?cancellationToken: CancellationToken * ?ignoreSourceFile: (SourceFile -> bool) -> AffectedFileResult abstract emit: ?targetSourceFile: SourceFile * ?writeFile: WriteFileCallback * ?cancellationToken: CancellationToken * ?emitOnlyDtsFiles: bool * ?customTransformers: CustomTransformers -> EmitResult option - type [] UpdateBundleProject<'T> = + [] + type [] UpdateBundleProject<'T > = inherit InvalidatedProjectBase abstract kind: InvalidatedProjectKind abstract emit: ?writeFile: WriteFileCallback * ?customTransformers: CustomTransformers -> U2> option - type [] [] InvalidatedProject<'T> = + type [] [] InvalidatedProject<'T > = | [] BuildInvalidedProject of BuildInvalidedProject<'T> | [] UpdateBundleProject of UpdateBundleProject<'T> | [] UpdateOutputFileStampsProject of UpdateOutputFileStampsProject - static member inline op_ErasedCast(x: BuildInvalidedProject<'T>) = BuildInvalidedProject x - static member inline op_ErasedCast(x: UpdateBundleProject<'T>) = UpdateBundleProject x - static member inline op_ErasedCast(x: UpdateOutputFileStampsProject) = UpdateOutputFileStampsProject x + // static member inline op_ErasedCast(x: BuildInvalidedProject<'T>) = BuildInvalidedProject x + // static member inline op_ErasedCast(x: UpdateBundleProject<'T>) = UpdateBundleProject x + // static member inline op_ErasedCast(x: UpdateOutputFileStampsProject) = UpdateOutputFileStampsProject x + + module JsTyping = + + type [] TypingResolutionHost = + abstract directoryExists: path: string -> bool + abstract fileExists: fileName: string -> bool + abstract readFile: path: string * ?encoding: string -> string option + abstract readDirectory: rootDir: string * extensions: string[] * excludes: string[] option * includes: string[] option * ?depth: float -> string[] module Server = @@ -6941,8 +7618,11 @@ Use typeAcquisition.enable instead.")>] type EventInitializationFailed = string + type ActionWatchTypingLocations = + string + type [] TypingInstallerResponse = - abstract kind: U7 + abstract kind: U8 type [] TypingInstallerRequestWithProjectName = abstract projectName: string @@ -6952,7 +7632,6 @@ Use typeAcquisition.enable instead.")>] abstract fileNames: string[] abstract projectRootPath: Path abstract compilerOptions: CompilerOptions - abstract watchOptions: WatchOptions option abstract typeAcquisition: TypeAcquisition abstract unresolvedImports: SortedReadonlyArray abstract cachePath: string option @@ -7008,6 +7687,13 @@ Use typeAcquisition.enable instead.")>] abstract kind: EventEndInstallTypes abstract installSuccess: bool + type [] InstallTypingHost = + inherit JsTyping.TypingResolutionHost + abstract useCaseSensitiveFileNames: bool with get, set + abstract writeFile: path: string * content: string -> unit + abstract createDirectory: path: string -> unit + abstract getCurrentDirectory: unit -> string + type [] SetTypings = inherit ProjectResponse abstract typeAcquisition: TypeAcquisition @@ -7016,6 +7702,12 @@ Use typeAcquisition.enable instead.")>] abstract unresolvedImports: SortedReadonlyArray abstract kind: ActionSet + type [] WatchTypingLocations = + inherit ProjectResponse + /// if files is undefined, retain same set of watchers + abstract files: string[] option + abstract kind: ActionWatchTypingLocations + /// Represents an immutable snapshot of a script at a specified time.Once acquired, the /// snapshot is observably immutable. i.e. the same calls with the same parameters will return /// the same values. @@ -7092,9 +7784,9 @@ Use typeAcquisition.enable instead.")>] abstract readFile: path: string * ?encoding: string -> string option abstract fileExists: path: string -> bool abstract getTypeRootsVersion: unit -> float - abstract resolveModuleNames: moduleNames: string[] * containingFile: string * reusedNames: string[] option * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingSourceFile: SourceFile -> ResolvedModule option[] - abstract getResolvedModuleWithFailedLookupLocationsFromCache: modulename: string * containingFile: string * ?resolutionMode: ModuleKind -> ResolvedModuleWithFailedLookupLocations option - abstract resolveTypeReferenceDirectives: typeDirectiveNames: U2 * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * ?containingFileMode: obj -> ResolvedTypeReferenceDirective option[] + abstract getResolvedModuleWithFailedLookupLocationsFromCache: modulename: string * containingFile: string * ?resolutionMode: ResolutionMode -> ResolvedModuleWithFailedLookupLocations option + abstract resolveModuleNameLiterals: moduleLiterals: StringLiteralLike[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * containingSourceFile: SourceFile * reusedNames: StringLiteralLike[] option -> ResolvedModuleWithFailedLookupLocations[] + abstract resolveTypeReferenceDirectiveReferences: typeDirectiveReferences: 'T[] * containingFile: string * redirectedReference: ResolvedProjectReference option * options: CompilerOptions * containingSourceFile: SourceFile option * reusedNames: 'T[] option -> ResolvedTypeReferenceDirectiveWithFailedLookupLocations[] abstract getDirectories: directoryName: string -> string[] /// Gets a set of custom transformers to use during emit. abstract getCustomTransformers: unit -> CustomTransformers option @@ -7154,11 +7846,7 @@ Use typeAcquisition.enable instead.")>] abstract getSuggestionDiagnostics: fileName: string -> DiagnosticWithLocation[] /// Gets global diagnostics related to the program configuration and compiler options. abstract getCompilerOptionsDiagnostics: unit -> Diagnostic[] - [] - abstract getSyntacticClassifications: fileName: string * span: TextSpan -> ClassifiedSpan[] abstract getSyntacticClassifications: fileName: string * span: TextSpan * format: SemanticClassificationFormat -> U2 - [] - abstract getSemanticClassifications: fileName: string * span: TextSpan -> ClassifiedSpan[] abstract getSemanticClassifications: fileName: string * span: TextSpan * format: SemanticClassificationFormat -> U2 /// Encoded as triples of [start, length, ClassificationType]. abstract getEncodedSyntacticClassifications: fileName: string * span: TextSpan -> Classifications @@ -7201,9 +7889,7 @@ Use typeAcquisition.enable instead.")>] abstract getBreakpointStatementAtPosition: fileName: string * position: float -> TextSpan option abstract getSignatureHelpItems: fileName: string * position: float * options: SignatureHelpItemsOptions option -> SignatureHelpItems option abstract getRenameInfo: fileName: string * position: float * preferences: UserPreferences -> RenameInfo - [] - abstract getRenameInfo: fileName: string * position: float * ?options: RenameInfoOptions -> RenameInfo - abstract findRenameLocations: fileName: string * position: float * findInStrings: bool * findInComments: bool * ?providePrefixAndSuffixTextForRename: bool -> RenameLocation[] option + abstract findRenameLocations: fileName: string * position: float * findInStrings: bool * findInComments: bool * preferences: UserPreferences -> RenameLocation[] option abstract getSmartSelectionRange: fileName: string * position: float -> SelectionRange abstract getDefinitionAtPosition: fileName: string * position: float -> DefinitionInfo[] option abstract getDefinitionAndBoundSpan: fileName: string * position: float -> DefinitionInfoAndBoundSpan option @@ -7213,8 +7899,6 @@ Use typeAcquisition.enable instead.")>] abstract findReferences: fileName: string * position: float -> ReferencedSymbol[] option abstract getDocumentHighlights: fileName: string * position: float * filesToSearch: string[] -> DocumentHighlights[] option abstract getFileReferences: fileName: string -> ReferenceEntry[] - [] - abstract getOccurrencesAtPosition: fileName: string * position: float -> ReferenceEntry[] option abstract getNavigateToItems: searchValue: string * ?maxResultCount: float * ?fileName: string * ?excludeDtsFiles: bool -> NavigateToItem[] abstract getNavigationBarItems: fileName: string -> NavigationBarItem[] abstract getNavigationTree: fileName: string -> NavigationTree @@ -7229,13 +7913,14 @@ Use typeAcquisition.enable instead.")>] abstract getFormattingEditsForRange: fileName: string * start: float * ``end``: float * options: U2 -> TextChange[] abstract getFormattingEditsForDocument: fileName: string * options: U2 -> TextChange[] abstract getFormattingEditsAfterKeystroke: fileName: string * position: float * key: string * options: U2 -> TextChange[] - abstract getDocCommentTemplateAtPosition: fileName: string * position: float * ?options: DocCommentTemplateOptions -> TextInsertion option + abstract getDocCommentTemplateAtPosition: fileName: string * position: float * ?options: DocCommentTemplateOptions * ?formatOptions: FormatCodeSettings -> TextInsertion option abstract isValidBraceCompletionAtPosition: fileName: string * position: float * openingBrace: float -> bool /// /// This will return a defined result if the position is after the > of the opening tag, or somewhere in the text, of a JSXElement with no closing tag. /// Editors should call this after > is typed. /// abstract getJsxClosingTagAtPosition: fileName: string * position: float -> JsxClosingTagInfo option + abstract getLinkedEditingRangeAtPosition: fileName: string * position: float -> LinkedEditingInfo option abstract getSpanOfEnclosingComment: fileName: string * position: float * onlyMultiLine: bool -> TextSpan option abstract toLineColumnOffset: fileName: string * position: float -> LineAndCharacter abstract getCodeFixesAtPosition: fileName: string * start: float * ``end``: float * errorCodes: float[] * formatOptions: FormatCodeSettings * preferences: UserPreferences -> CodeFixAction[] @@ -7243,14 +7928,15 @@ Use typeAcquisition.enable instead.")>] abstract applyCodeActionCommand: action: CodeActionCommand * ?formatSettings: FormatCodeSettings -> Promise abstract applyCodeActionCommand: action: CodeActionCommand[] * ?formatSettings: FormatCodeSettings -> Promise abstract applyCodeActionCommand: action: U2 * ?formatSettings: FormatCodeSettings -> Promise> - [] - abstract applyCodeActionCommand: fileName: string * action: CodeActionCommand -> Promise - [] - abstract applyCodeActionCommand: fileName: string * action: CodeActionCommand[] -> Promise - [] - abstract applyCodeActionCommand: fileName: string * action: U2 -> Promise> - abstract getApplicableRefactors: fileName: string * positionOrRange: U2 * preferences: UserPreferences option * ?triggerReason: RefactorTriggerReason * ?kind: string -> ApplicableRefactorInfo[] - abstract getEditsForRefactor: fileName: string * formatOptions: FormatCodeSettings * positionOrRange: U2 * refactorName: string * actionName: string * preferences: UserPreferences option -> RefactorEditInfo option + /// + /// Include refactor actions that require additional arguments to be + /// passed when calling getEditsForRefactor. When true, clients should inspect the isInteractive + /// property of each returned RefactorActionInfo and ensure they are able to collect the appropriate + /// arguments for any interactive action before offering it. + /// + abstract getApplicableRefactors: fileName: string * positionOrRange: U2 * preferences: UserPreferences option * ?triggerReason: RefactorTriggerReason * ?kind: string * ?includeInteractiveActions: bool -> ApplicableRefactorInfo[] + abstract getEditsForRefactor: fileName: string * formatOptions: FormatCodeSettings * positionOrRange: U2 * refactorName: string * actionName: string * preferences: UserPreferences option * ?interactiveRefactorArguments: InteractiveRefactorArguments -> RefactorEditInfo option + abstract getMoveToRefactoringFileSuggestions: fileName: string * positionOrRange: U2 * preferences: UserPreferences option * ?triggerReason: RefactorTriggerReason * ?kind: string -> {| newFileName: string; files: string[] |} abstract organizeImports: args: OrganizeImportsArgs * formatOptions: FormatCodeSettings * preferences: UserPreferences option -> FileTextChanges[] abstract getEditsForFileRename: oldFilePath: string * newFilePath: string * formatOptions: FormatCodeSettings * preferences: UserPreferences option -> FileTextChanges[] abstract getEmitOutput: fileName: string * ?emitOnlyDtsFiles: bool * ?forceDtsEmit: bool -> EmitOutput @@ -7259,6 +7945,7 @@ Use typeAcquisition.enable instead.")>] abstract toggleMultilineComment: fileName: string * textRange: TextRange -> TextChange[] abstract commentSelection: fileName: string * textRange: TextRange -> TextChange[] abstract uncommentSelection: fileName: string * textRange: TextRange -> TextChange[] + abstract getSupportedCodeFixes: ?fileName: string -> string[] abstract dispose: unit -> unit type [] LanguageServiceGetCombinedCodeFixFixId = @@ -7267,23 +7954,32 @@ Use typeAcquisition.enable instead.")>] type [] JsxClosingTagInfo = abstract newText: string + type [] LinkedEditingInfo = + abstract ranges: TextSpan[] + abstract wordPattern: string option with get, set + type [] CombinedCodeFixScope = abstract ``type``: string with get, set abstract fileName: string with get, set + type [] [] OrganizeImportsMode = + | [] All + | [] SortAndCombine + | [] RemoveUnused + type [] OrganizeImportsArgs = inherit CombinedCodeFixScope - abstract skipDestructiveCodeActions: bool option with get, set + abstract mode: OrganizeImportsMode option with get, set type [] [] CompletionsTriggerCharacter = - | [] Dot - | [] BackSlash - | [] SingleQuote - | [] BackQuote - | [] Slash - | [] At - | [] LessThan - | [] Sharp + | [] DOT + | [] QUOTATION + | [] ``'`` + | [] BACKTICK + | [] SLASH + | [] AT + | [] ``<`` + | [] ``#`` | [] Empty type [] CompletionTriggerKind = @@ -7300,15 +7996,18 @@ Use typeAcquisition.enable instead.")>] /// (as opposed to when the user explicitly requested them) this should be set. abstract triggerCharacter: CompletionsTriggerCharacter option with get, set abstract triggerKind: CompletionTriggerKind option with get, set - [] - abstract includeExternalModuleExports: bool option with get, set - [] - abstract includeInsertTextCompletions: bool option with get, set + /// + /// Include a symbol property on each completion entry object. + /// Symbols reference cyclic data structures and sometimes an entire TypeChecker instance, + /// so use caution when serializing or retaining completion entries retrieved with this option. + /// + /// false + abstract includeSymbol: bool option with get, set type [] [] SignatureHelpTriggerCharacter = - | [] Comma - | [] LeftParen - | [] LessThan + | [] ``,`` + | [] ``(`` + | [] ``<`` type SignatureHelpRetriggerCharacter = U2 @@ -7320,9 +8019,9 @@ Use typeAcquisition.enable instead.")>] | [] SignatureHelpCharacterTypedReason of SignatureHelpCharacterTypedReason | [] SignatureHelpInvokedReason of SignatureHelpInvokedReason | [] SignatureHelpRetriggeredReason of SignatureHelpRetriggeredReason - static member inline op_ErasedCast(x: SignatureHelpCharacterTypedReason) = SignatureHelpCharacterTypedReason x - static member inline op_ErasedCast(x: SignatureHelpInvokedReason) = SignatureHelpInvokedReason x - static member inline op_ErasedCast(x: SignatureHelpRetriggeredReason) = SignatureHelpRetriggeredReason x + // static member inline op_ErasedCast(x: SignatureHelpCharacterTypedReason) = SignatureHelpCharacterTypedReason x + // static member inline op_ErasedCast(x: SignatureHelpInvokedReason) = SignatureHelpInvokedReason x + // static member inline op_ErasedCast(x: SignatureHelpRetriggeredReason) = SignatureHelpRetriggeredReason x /// Signals that the user manually requested signature help. /// The language service will unconditionally attempt to provide a result. @@ -7500,6 +8199,11 @@ Use typeAcquisition.enable instead.")>] abstract notApplicableReason: string option with get, set /// The hierarchical dotted name of the refactor action. abstract kind: string option with get, set + /// + /// Indicates that the action requires additional arguments to be passed + /// when calling getEditsForRefactor. + /// + abstract isInteractive: bool option with get, set /// A set of edits to make in response to a refactor action, plus an optional /// location where renaming should be invoked from @@ -7508,6 +8212,7 @@ Use typeAcquisition.enable instead.")>] abstract renameFilename: string option with get, set abstract renameLocation: float option with get, set abstract commands: CodeActionCommand[] option with get, set + abstract notApplicableReason: string option with get, set type [] [] RefactorTriggerReason = | Implicit @@ -7638,6 +8343,7 @@ Use typeAcquisition.enable instead.")>] abstract insertSpaceBeforeTypeAnnotation: bool option abstract indentMultiLineObjectLiteralBeginningOnBlankLine: bool option abstract semicolons: SemicolonPreference option + abstract indentSwitchCase: bool option type [] DefinitionInfo = inherit DocumentSpan @@ -7713,8 +8419,8 @@ Use typeAcquisition.enable instead.")>] type [] [] RenameInfo = | [] RenameInfoFailure of RenameInfoFailure | [] RenameInfoSuccess of RenameInfoSuccess - static member inline op_ErasedCast(x: RenameInfoFailure) = RenameInfoFailure x - static member inline op_ErasedCast(x: RenameInfoSuccess) = RenameInfoSuccess x + // static member inline op_ErasedCast(x: RenameInfoFailure) = RenameInfoFailure x + // static member inline op_ErasedCast(x: RenameInfoSuccess) = RenameInfoSuccess x type [] RenameInfoSuccess = abstract canRename: bool with get, set @@ -7740,6 +8446,9 @@ Use typeAcquisition.enable instead.")>] type [] DocCommentTemplateOptions = abstract generateReturnInDocTemplate: bool option + type [] InteractiveRefactorArguments = + abstract targetFile: string with get, set + type [] SignatureHelpParameter = abstract name: string with get, set abstract documentation: SymbolDisplayPart[] with get, set @@ -7789,7 +8498,7 @@ Use typeAcquisition.enable instead.")>] abstract isGlobalCompletion: bool with get, set abstract isMemberCompletion: bool with get, set /// - /// In the absence of `CompletionEntry["replacementSpan"], the editor may choose whether to use + /// In the absence of CompletionEntry["replacementSpan"], the editor may choose whether to use /// this span or its default one. If CompletionEntry["replacementSpan"] is defined, that span /// must be used to commit that completion entry. /// @@ -7804,6 +8513,7 @@ Use typeAcquisition.enable instead.")>] /// The name of the property or export in the module's symbol table. Differs from the completion name /// in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default. abstract exportName: string with get, set + abstract exportMapKey: string option with get, set abstract moduleSpecifier: string option with get, set /// The file name declaring the export's module symbol, if it was an external module abstract fileName: string option with get, set @@ -7814,7 +8524,6 @@ Use typeAcquisition.enable instead.")>] type [] CompletionEntryDataUnresolved = inherit CompletionEntryDataAutoImport - /// The key in the ExportMapCache where the completion entry's SymbolExportInfo[] is found abstract exportMapKey: string with get, set type [] CompletionEntryDataResolved = @@ -7844,6 +8553,12 @@ Use typeAcquisition.enable instead.")>] abstract isPackageJsonImport: bool option with get, set abstract isImportStatementCompletion: bool option with get, set /// + /// For API purposes. + /// Included for non-string completions only when includeSymbol: true option is passed to getCompletionsAtPosition. + /// + /// Get declaration of completion: symbol.valueDeclaration + abstract symbol: Symbol option with get, set + /// /// A property to be sent back to TS Server in the CompletionDetailsRequest, along with name, /// that allows TS Server to look up the symbol represented by the completion item, disambiguating /// items with the same name. Currently only defined for auto-import completions, but the type is @@ -7865,8 +8580,6 @@ Use typeAcquisition.enable instead.")>] abstract documentation: SymbolDisplayPart[] option with get, set abstract tags: JSDocTagInfo[] option with get, set abstract codeActions: CodeAction[] option with get, set - [] - abstract source: SymbolDisplayPart[] option with get, set abstract sourceDisplay: SymbolDisplayPart[] option with get, set type [] OutliningSpan = @@ -7927,28 +8640,6 @@ Use typeAcquisition.enable instead.")>] abstract classification: TokenClass with get, set type [] Classifier = - /// - /// Gives lexical classifications of tokens on a line without any syntactic context. - /// For instance, a token consisting of the text 'string' can be either an identifier - /// named 'string' or the keyword 'string', however, because this classifier is not aware, - /// it relies on certain heuristics to give acceptable results. For classifications where - /// speed trumps accuracy, this function is preferable; however, for true accuracy, the - /// syntactic classifier is ideal. In fact, in certain editing scenarios, combining the - /// lexical, syntactic, and semantic classifiers may issue the best user experience. - /// - /// The text of a line to classify. - /// The state of the lexical classifier at the end of the previous line. - /// - /// Whether the client is *not* using a syntactic classifier. - /// If there is no syntactic classifier (syntacticClassifierAbsent=true), - /// certain heuristics may be used in its place; however, if there is a - /// syntactic classifier (syntacticClassifierAbsent=false), certain - /// classifications which may be incorrectly categorized will be given - /// back as Identifiers in order to allow the syntactic classifier to - /// subsume the classification. - /// - [] - abstract getClassificationsForLine: text: string * lexState: EndOfLineState * syntacticClassifierAbsent: bool -> ClassificationResult abstract getEncodedLexicalClassifications: text: string * endOfLineState: EndOfLineState * syntacticClassifierAbsent: bool -> Classifications type [] [] ScriptElementKind = @@ -7989,6 +8680,8 @@ Use typeAcquisition.enable instead.")>] /// class X { [public|private]* foo:number; } /// interface Y { foo:number; } | [] MemberVariableElement + /// class X { [public|private]* accessor foo: number; } + | [] MemberAccessorVariableElement /// class X { constructor() { } } /// class X { static { } } | [] ConstructorImplementationElement @@ -8166,8 +8859,6 @@ Use typeAcquisition.enable instead.")>] abstract updateDocument: fileName: string * compilationSettingsOrHost: U2 * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind * ?sourceFileOptions: U2 -> SourceFile abstract updateDocumentWithKey: fileName: string * path: Path * compilationSettingsOrHost: U2 * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind * ?sourceFileOptions: U2 -> SourceFile abstract getKeyForCompilationSettings: settings: CompilerOptions -> DocumentRegistryBucketKey - [] - abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions * ?scriptKind: ScriptKind -> unit /// /// Informs the DocumentRegistry that a file is not needed any longer. /// @@ -8178,10 +8869,8 @@ Use typeAcquisition.enable instead.")>] /// The compilation settings used to acquire the file /// The script kind of the file to be released /// The implied source file format of the file to be released - abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions * scriptKind: ScriptKind * impliedNodeFormat: obj -> unit - [] - abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey * ?scriptKind: ScriptKind -> unit - abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey * scriptKind: ScriptKind * impliedNodeFormat: obj -> unit + abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions * scriptKind: ScriptKind * impliedNodeFormat: ResolutionMode -> unit + abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey * scriptKind: ScriptKind * impliedNodeFormat: ResolutionMode -> unit abstract reportStats: unit -> string type [] DocumentRegistryBucketKey = @@ -8200,10 +8889,6 @@ Use typeAcquisition.enable instead.")>] abstract diagnostics: Diagnostic[] option with get, set abstract sourceMapText: string option with get, set - type [] [] IExportsCreateUnparsedSourceFile = - | Js - | Dts - type [] DiagnosticMessageReportsUnnecessary = interface end @@ -8239,6 +8924,14 @@ Use typeAcquisition.enable instead.")>] | Literals | All + type [] [] UserPreferencesOrganizeImportsCollation = + | Ordinal + | Unicode + + type [] [] UserPreferencesOrganizeImportsCaseFirst = + | Upper + | Lower + type [] [] PerformanceEventKind = | [] UpdateGraph | [] CreatePackageJsonAutoImportProvider diff --git a/lib/Extensions.fs b/lib/Extensions.fs index 29746a58..7d1aa9c7 100644 --- a/lib/Extensions.fs +++ b/lib/Extensions.fs @@ -7,6 +7,11 @@ let inline (|?) (xo: 'a option) (y: 'a) : 'a = Option.defaultValue y xo let impossible fmt = Printf.ksprintf (fun msg -> failwith ("impossible: " + msg)) fmt +/// Repeatedly apply `f` until the same result is obtained. +let rec repeatUntilEquilibrium<'a when 'a: equality> (f: 'a -> 'a) a = + let a' = f a + if (a = a') then a' else repeatUntilEquilibrium f a' + open System module Enum = diff --git a/lib/Parser.fs b/lib/Parser.fs index 1ce95f9b..401f921d 100644 --- a/lib/Parser.fs +++ b/lib/Parser.fs @@ -57,15 +57,15 @@ module private ParserImpl = ctx.logger.errorf "%s at %s\n%s" s (Node.ppLocation node) (Node.ppLine node) ) format - let modifiers (n: Ts.Node) = - if ts.canHaveModifiers(n) then ts.getModifiers(!!n) else None + let modifiers (n: Ts.Node) : Ts.ModifierLike[] option = + if ts.canHaveModifiers(n) then + Some !!(ts.getModifiers(!!n)) + else None - let hasModifier (kind: Ts.SyntaxKind) (modifiers: Ts.ModifiersArray option) = - match modifiers with - | None -> false - | Some mds -> mds |> Array.exists (fun md -> md.kind = kind) + let hasModifier (kind: Ts.SyntaxKind) (modifiers: Ts.ModifierLike[] option) = + modifiers |> Option.exists (Array.exists (fun md -> (!!md : Ts.Token<_>).kind = kind)) - let getAccessibility (modifiersOpt: Ts.ModifiersArray option) : Accessibility option = + let getAccessibility (modifiersOpt: Ts.ModifierLike[] option) : Accessibility option = if modifiersOpt |> hasModifier Kind.PublicKeyword then Some Public else if modifiersOpt |> hasModifier Kind.ProtectedKeyword then @@ -75,7 +75,7 @@ module private ParserImpl = else None - let getExported (modifiersOpt: Ts.ModifiersArray option) : Exported = + let getExported (modifiersOpt: Ts.ModifierLike[] option) : Exported = if modifiersOpt |> hasModifier Kind.DeclareKeyword then Exported.Declared else if modifiersOpt |> hasModifier Kind.ExportKeyword |> not then @@ -85,7 +85,7 @@ module private ParserImpl = else Exported.Yes - let isReadOnly (m: Ts.ModifiersArray option) : bool = + let isReadOnly (m: Ts.ModifierLike[] option) : bool = m |> hasModifier Kind.ReadonlyKeyword let getText (x: 'a) : string = @@ -122,7 +122,7 @@ module private ParserImpl = match ctx.checker.getSymbolAtLocation i with | None -> None | Some s -> - let inline check (superset: Ts.SymbolFlags) (subset: Ts.SymbolFlags) = int (subset &&& superset) > 0 + let check (superset: Ts.SymbolFlags) (subset: Ts.SymbolFlags) = int (subset &&& superset) > 0 let rec go (symbol: Ts.Symbol) = let flags = symbol.getFlags() if flags = Ts.SymbolFlags.Alias then @@ -387,7 +387,7 @@ module private ParserImpl = | Kind.ArrayType -> let t = t :?> Ts.ArrayTypeNode let elem = readTypeNode typrm ctx t.elementType - if t |> modifiers |> isReadOnly then + if isReadOnly (modifiers t) then App (APrim ReadonlyArray, [elem], Node.location t) else App (APrim Array, [elem], Node.location t) @@ -603,7 +603,7 @@ module private ParserImpl = | _ -> () let isOptional = nd.questionToken |> Option.isSome let fl = { name = name; isOptional = isOptional; value = ty } - attr, Field (fl, (if isReadOnly nd.modifiers then ReadOnly else Mutable)) + attr, Field (fl, (if isReadOnly !!nd.modifiers then ReadOnly else Mutable)) | Error expr -> readSymbolIndexer expr (Choice1Of2 ty) fail | Kind.PropertyDeclaration -> let nd = nd :?> Ts.PropertyDeclaration @@ -749,7 +749,7 @@ module private ParserImpl = match getPropertyName em.name with | Ok name -> let value = - let inline fallback () = + let fallback () = match ctx.checker.getConstantValue(!^em) with | None -> None | Some (U2.Case1 str) -> Some (LString str) @@ -867,7 +867,7 @@ module private ParserImpl = let clauses = nes.elements |> Array.map (fun x -> - let inline ident (name: Ts.Identifier) = readIdent ctx name + let ident (name: Ts.Identifier) = readIdent ctx name match x.propertyName with | None -> ES6ReExport {| target = ident x.name; renameAs = None |} | Some propertyName -> ES6ReExport {| target = ident propertyName; renameAs = Some x.name.text |}) @@ -891,7 +891,7 @@ module private ParserImpl = let clauses = nes.elements |> Array.map (fun x -> - let inline ident (name: Ts.Identifier) = readIdent ctx name + let ident (name: Ts.Identifier) = readIdent ctx name match x.propertyName with | None -> ES6Export {| target = ident x.name; renameAs = None |} | Some propertyName -> ES6Export {| target = ident propertyName; renameAs = Some x.name.text |}) @@ -940,7 +940,7 @@ module private ParserImpl = | Kind.StringLiteral -> let comments = readCommentsForNamedDeclaration ctx c let moduleSpecifier = (!!i.moduleSpecifier : Ts.StringLiteral).text - let inline create clauses = + let create clauses = Some (Import { comments = comments; loc = Node.location i; isTypeOnly = c.isTypeOnly; isExported = getExported i.modifiers; clauses = clauses; origText = i.getText() }) match c.name, c.namedBindings with | None, None -> create [ES6WildcardImport moduleSpecifier] diff --git a/package.json b/package.json index aa1386f2..874b6614 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ "@babel/code-frame": "^7.18.6", "browser-or-node": "^2.0.0", "chalk": "^5.0.1", - "typescript": "4.8", - "yargs": "17.5.1" + "typescript": "^5.1.6", + "yargs": "^17.5.1" }, "devDependencies": { "@angular/common": "^16.0.1", @@ -38,11 +38,12 @@ "@types/react-modal": "3.16.0", "@types/semver": "7.5.0", "@types/vscode": "^1.63.1", - "@types/yargs": "17.0.10", + "@types/yargs": "^17.0.10", "cassandra-driver": "^4.6.3", "cdk8s": "^2.2.41", "monaco-editor": "0.40.0", "react-player": "2.12.0", + "ts2fable": "0.8.0-build.723", "webpack": "5.88.0", "webpack-cli": "5.1.0", "webpack-dev-server": "4.15.0" diff --git a/src/Targets/JsOfOCaml/OCamlHelper.fs b/src/Targets/JsOfOCaml/OCamlHelper.fs index fedf3b12..b1f4cfef 100644 --- a/src/Targets/JsOfOCaml/OCamlHelper.fs +++ b/src/Targets/JsOfOCaml/OCamlHelper.fs @@ -429,6 +429,7 @@ let jsBuilder name (fields: {| isOptional: bool; name: string; value: text |} li let name = match Naming.valueName f.name with | "_" -> renamer.Rename "arg" "__" + | s when not (Char.isAlphabet s[0] || s[0] = '_') -> renamer.Rename "arg" $"_{s}" | name -> name let value = if name = f.name then f.value diff --git a/src/Targets/JsOfOCaml/Writer.fs b/src/Targets/JsOfOCaml/Writer.fs index 042a082d..600e2635 100644 --- a/src/Targets/JsOfOCaml/Writer.fs +++ b/src/Targets/JsOfOCaml/Writer.fs @@ -745,6 +745,7 @@ let emitTypeAliasesImpl (baseName: string) flags overrideFunc (ctx: Context) + (loc: Location) (typrms: TypeParam list) (target: text) (lines: {| name: string; tyargs:(TypeParam * text) list; target: text; isOverload: bool |} -> 'a list) = @@ -757,24 +758,34 @@ let emitTypeAliasesImpl for arity in arities |> Set.toSeq |> Seq.sortDescending do if arity <> maxArity then let name = Naming.createTypeNameOfArity arity None baseName + let tyargs' = List.take arity tyargs let typrms' = List.take arity typrms + + let bindings = + createBindings (ctx.currentNamespace @ [name]) loc + (typrms |> List.skip arity) + (typrms |> List.skip arity |> List.map (fun t -> + match t.defaultType with + | None -> impossible "emitTypeAliases" + | Some t -> t + )) + let target = Type.appOpt (str baseName) [ for tyarg in tyargs' do yield tyarg for t in typrms |> List.skip arity do - match t.defaultType with - | None -> impossible "emitTypeAliases" - | Some t -> yield emitType_ ctx t + let t' = repeatUntilEquilibrium (substTypeVar bindings ctx) (TypeVar t.name) + yield emitType_ ctx t' ] yield! lines {| name = name; tyargs = List.zip typrms' tyargs'; target = target; isOverload = true |} ] -let emitTypeAliases flags overrideFunc ctx (typrms: TypeParam list) target = +let emitTypeAliases flags overrideFunc ctx loc (typrms: TypeParam list) target = let emitType = emitTypeImpl flags - emitTypeAliasesImpl "t" flags overrideFunc ctx typrms target ( + emitTypeAliasesImpl "t" flags overrideFunc ctx loc typrms target ( fun x -> [ yield typeAlias x.name (x.tyargs |> List.map snd) x.target |> TypeDef yield! emitMappers ctx emitType x.name (x.tyargs |> List.map fst) @@ -1032,7 +1043,7 @@ let rec emitClass flags overrideFunc (ctx: Context) (current: StructuredText) (c if useTags && innerCtx.options.inheritWithTags.HasProvide then let alias = emitTypeAliasesImpl - "tags" { flags with forceSkipAttributes = true } overrideFunc innerCtx c.typeParams (emitLabels innerCtx labels) + "tags" { flags with forceSkipAttributes = true } overrideFunc innerCtx c.loc c.typeParams (emitLabels innerCtx labels) (fun x -> [typeAlias x.name (x.tyargs |> List.map snd) x.target]) |> concat newline Attr.js_stop_start_implem alias alias |> TypeDef |> Some @@ -1065,7 +1076,7 @@ let rec emitClass flags overrideFunc (ctx: Context) (current: StructuredText) (c | ClassKind.NormalClass x -> GetSelfTyText.class_ { flags with failContravariantTypeVar = true } overrideFunc innerCtx x.orig | ClassKind.ExportDefaultClass x -> GetSelfTyText.class_ { flags with failContravariantTypeVar = true } overrideFunc innerCtx x.orig | ClassKind.AnonymousInterface _ -> str "private Ojs.t" - emitTypeAliases flags overrideFunc innerCtx c.typeParams selfTyText + emitTypeAliases flags overrideFunc innerCtx c.loc c.typeParams selfTyText let castFunctions = [ // add a generic cast function if tag is available @@ -1427,7 +1438,7 @@ let createStructuredText (rootCtx: Context) (stmts: Statement list) : Structured current |> inTrie [e.name] (fun module' -> let ctx = ctx |> Context.ofChildNamespace e.name - let items = emitTypeAliases emitTypeFlags OverrideFunc.noOverride ctx [] (GetSelfTyText.enumCases e e.cases) + let items = emitTypeAliases emitTypeFlags OverrideFunc.noOverride ctx e.loc [] (GetSelfTyText.enumCases e e.cases) let module' = let node = {| StructuredTextNode.empty with items = items; docCommentLines = comments; knownTypes = knownTypes () |} module' |> set node @@ -1435,7 +1446,7 @@ let createStructuredText (rootCtx: Context) (stmts: Statement list) : Structured let ctx = ctx |> Context.ofChildNamespace c.name let comments = List.map emitCommentBody c.comments let items = - emitTypeAliases emitTypeFlags OverrideFunc.noOverride ctx [] (GetSelfTyText.enumCases e [c]) + emitTypeAliases emitTypeFlags OverrideFunc.noOverride ctx e.loc [] (GetSelfTyText.enumCases e [c]) let node = {| StructuredTextNode.empty with items = items; docCommentLines = comments; knownTypes = knownTypes () |} state |> add [c.name] node ) module') @@ -1443,7 +1454,7 @@ let createStructuredText (rootCtx: Context) (stmts: Statement list) : Structured | TypeAlias ta -> let ctx = ctx |> Context.ofChildNamespace ta.name let items = - emitTypeAliases emitTypeFlags OverrideFunc.noOverride ctx ta.typeParams (emitSelfType ctx ta.target) + emitTypeAliases emitTypeFlags OverrideFunc.noOverride ctx ta.loc ta.typeParams (emitSelfType ctx ta.target) let node = {| StructuredTextNode.empty with items = items; docCommentLines = comments; knownTypes = knownTypes () |} current |> inTrie [ta.name] (set node) diff --git a/ts2ocaml.sln b/ts2ocaml.sln index 7ac19560..9419bc26 100644 --- a/ts2ocaml.sln +++ b/ts2ocaml.sln @@ -7,7 +7,7 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ts2ocaml", "src\ts2ocaml.fs EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ts2ml", "lib\ts2ml.fsproj", "{EAC815EE-8CCA-4E25-A82D-F9F2D46D9CC9}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "build", "build.fsproj", "{CF67588E-3D8A-4208-ACAB-F66F7D79E236}" +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "build", "build\build.fsproj", "{CF67588E-3D8A-4208-ACAB-F66F7D79E236}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/yarn.lock b/yarn.lock index 3ba5bcd0..a5d91dc7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -664,10 +664,10 @@ resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== -"@types/yargs@17.0.10": - version "17.0.10" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.10.tgz#591522fce85d8739bca7b8bb90d048e4478d186a" - integrity sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA== +"@types/yargs@^17.0.10": + version "17.0.24" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.24.tgz#b3ef8d50ad4aa6aecf6ddc97c580a00f5aa11902" + integrity sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw== dependencies: "@types/yargs-parser" "*" @@ -1192,15 +1192,6 @@ cli-width@^3.0.0: resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - cliui@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" @@ -3179,6 +3170,13 @@ triple-beam@^1.3.0: resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984" integrity sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg== +ts2fable@0.8.0-build.723: + version "0.8.0-build.723" + resolved "https://registry.yarnpkg.com/ts2fable/-/ts2fable-0.8.0-build.723.tgz#6ac654b11af361d4a5bc17ff9fcdb6ac02b16516" + integrity sha512-tqKWKwGgzDOPY4OWsycxnrAQUta070cG9wEm9lakbKPOBR4UccszxtDrovFR1rNzwjD8Fvk+HQyAQjCiOR/Uyw== + dependencies: + typescript "3.7.4" + tslib@^2.1.0: version "2.6.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3" @@ -3202,10 +3200,15 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -typescript@4.8: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== +typescript@3.7.4: + version "3.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19" + integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw== + +typescript@^5.1.6: + version "5.1.6" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" + integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== universal-user-agent@^6.0.0: version "6.0.0" @@ -3487,24 +3490,11 @@ yaml@2.2.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.2.2.tgz#ec551ef37326e6d42872dad1970300f8eb83a073" integrity sha512-CBKFWExMn46Foo4cldiChEzn7S7SRV+wqiluAb6xmueD/fGyRHIhX8m14vVGgeFWjN540nKCNVj6P21eQjgTuA== -yargs-parser@^21.0.0, yargs-parser@^21.0.1, yargs-parser@^21.1.1: +yargs-parser@^21.0.1, yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@17.5.1: - version "17.5.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.5.1.tgz#e109900cab6fcb7fd44b1d8249166feb0b36e58e" - integrity sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.0.0" - yargs@^17.5.1: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" From 9eb39cb6a6e8f75d457b33e813a74004c5aa131d Mon Sep 17 00:00:00 2001 From: cannorin Date: Fri, 14 Jul 2023 01:23:30 +0900 Subject: [PATCH 17/17] Release 2.0.0-alpha.0 --- .github/workflows/ci.yml | 2 +- .github/workflows/publish.yml | 4 ++-- CHANGELOG.md | 11 +++++++++++ build/BindingUpdater.fs | 2 +- dist_jsoo/dune-project | 2 +- dist_jsoo/ts2ocaml-jsoo-stdlib.opam | 2 +- fake | 4 ++-- fake.cmd | 2 +- package.json | 2 +- 9 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4991c31..0a89c531 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: run: opam install . --deps-only - name: Build and test the project - run: ./fake test + run: bash fake test auto-merge: name: Auto-Merge PRs by Dependabot diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bcf3c3b6..85916da7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,8 +48,8 @@ jobs: - name: Install OCaml Dependencies run: opam install . --deps-only - - name: Build the project - run: ./fake + - name: Build & test & publish the project + run: bash fake all - name: Push js_of_ocaml standard library to jsoo-stdlib if: success() diff --git a/CHANGELOG.md b/CHANGELOG.md index 0843425e..c5ec4494 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.0.0-alpha.0] +- Upgrade TypeScript to v5. +- Added an explicit support of ambient modules. + - Topological sorting inside ambient modules now works as expected (#157). +- Perform various improvements over messages. + - Messages now come with color (warning: yellow, error: red). + - The error location is now shown with a code frame. +- Deprecate the `--safe-arity` option. + - Ts2ocaml now generates minimal arity-safe output by default. +- Perform massive internal refactoring. + ## [1.4.6] - 2023-07-13 - Fix a bug which generated unnecessarily duplicated option type (#315). diff --git a/build/BindingUpdater.fs b/build/BindingUpdater.fs index b0d1aff7..c455ad45 100644 --- a/build/BindingUpdater.fs +++ b/build/BindingUpdater.fs @@ -31,4 +31,4 @@ let typescript () = |> File.writeString false dest let run () = - typescript () \ No newline at end of file + typescript () diff --git a/dist_jsoo/dune-project b/dist_jsoo/dune-project index dd44ba8b..623adbbd 100644 --- a/dist_jsoo/dune-project +++ b/dist_jsoo/dune-project @@ -1,6 +1,6 @@ (lang dune 3.0) (name ts2ocaml-jsoo-stdlib) -(version 1.4.6) +(version 2.0.0-alpha.0) (maintainers "dev@ocsigen.org") (authors diff --git a/dist_jsoo/ts2ocaml-jsoo-stdlib.opam b/dist_jsoo/ts2ocaml-jsoo-stdlib.opam index b2a162b8..f5b6c2cd 100644 --- a/dist_jsoo/ts2ocaml-jsoo-stdlib.opam +++ b/dist_jsoo/ts2ocaml-jsoo-stdlib.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "1.4.6" +version: "2.0.0-alpha.0" synopsis: "Standard library for ts2ocaml generated bindings (js_of_ocaml target)" description: diff --git a/fake b/fake index d1f7bb53..66ad9506 100644 --- a/fake +++ b/fake @@ -6,8 +6,8 @@ set -o pipefail echo "Restoring dotnet tools..." dotnet tool restore -if [ -z "$@"]; then +if [ -z "$@" ]; then FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj else FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj -- -t "$@" -fi \ No newline at end of file +fi diff --git a/fake.cmd b/fake.cmd index f36588f3..140db8b3 100644 --- a/fake.cmd +++ b/fake.cmd @@ -1,4 +1,4 @@ echo Restoring dotnet tools... dotnet tool restore -dotnet run --project ./build/build.fsproj -- -t %* \ No newline at end of file +dotnet run --project ./build/build.fsproj -- -t %* diff --git a/package.json b/package.json index 874b6614..03d81e0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ocsigen/ts2ocaml", - "version": "1.4.6", + "version": "2.0.0-alpha.0", "description": "Generate OCaml bindings from TypeScript definitions via the TypeScript compiler API", "repository": { "type": "git",