UNPKG

@lpc-lang/core

Version:
959 lines 159 kB
import { CreateSourceFileOptions, MapLike, ModuleResolutionCache, Mutable } from "./_namespaces/lpc.js"; export type NodeId = number; export type SymbolId = number; export type Path = string & { __pathBrand: any; }; /** SymbolTable based on ES6 Map interface. */ export type SymbolTable = Map<string, Symbol>; export interface TextRange { pos: number; end: number; } export interface ReadonlyTextRange { readonly pos: number; readonly end: number; } export interface MacroIncludedFileRange { posInOrigin?: number; endInOrigin?: number; originFilename?: string; } /** Base Node */ export interface Node extends ReadonlyTextRange { readonly kind: SyntaxKind; readonly flags: NodeFlags; readonly parent: Node; } export interface EmitNode { flags: EmitFlags; internalFlags: InternalEmitFlags; annotatedNodes?: Node[]; leadingComments?: SynthesizedComment[]; trailingComments?: SynthesizedComment[]; commentRange?: TextRange; constantValue?: string | number; externalHelpersModuleName?: Identifier; externalHelpers?: boolean; helpers?: EmitHelper[]; startsOnNewLine?: boolean; snippetElement?: SnippetElement; typeNode?: TypeNode; classThis?: Identifier; assignedName?: Expression; identifierTypeArguments?: NodeArray<TypeNode | TypeParameterDeclaration>; autoGenerate: AutoGenerateInfo | undefined; } export interface TypeChecker { getTypeOfSymbol(symbol: Symbol): Type; createSymbol(flags: SymbolFlags, name: string, checkFlags?: CheckFlags): TransientSymbol; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getStringType(): Type; signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): string; getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined; /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; getSymbolAtLocation(node: Node): Symbol | undefined; getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getRootSymbols(symbol: Symbol): readonly Symbol[]; evaluate(expr: Expression, location?: Declaration): EvaluatorResult<string | number>; /** * True if this type is assignable to `ReadonlyArray<any>`. */ isArrayLikeType(type: Type): boolean; /** Note that the resulting nodes cannot be checked. */ typeToTypeNode(type: Type, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeNode | undefined; getReturnTypeOfSignature(signature: Signature): Type; resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined; resolveBaseTypesOfClass(type: InterfaceType): Type[]; isArgumentsSymbol(symbol: Symbol): boolean; /** * returns unknownSignature in the case of an error. * returns undefined if the node is not valid. * @param argumentCount Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`. */ getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined; /** * 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. */ getShorthandAssignmentValueSymbol(location: Node | undefined): Symbol | undefined; isUnknownSymbol(symbol: Symbol): boolean; isUndefinedSymbol(symbol: Symbol): boolean; getMergedSymbol(symbol: Symbol): Symbol; getTypeAtLocation(node: Node): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; /** * 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 * and the operation is cancelled, then it should be discarded, otherwise it is safe to keep. */ runWithCancellationToken<T>(token: CancellationToken, cb: (checker: TypeChecker) => T): T; /** Note that the resulting nodes cannot be checked. */ symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): NodeArray<TypeParameterDeclaration> | undefined; getNullableType(type: Type, flags: TypeFlags): Type; getNonNullableType(type: Type): Type; getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined; getBaseConstraintOfType(type: Type): Type | undefined; getDefaultFromTypeParameter(type: Type): Type | undefined; getPropertyOfType(type: Type, propertyName: string): Symbol | undefined; getTypeFromTypeNode(node: TypeNode): Type; getFullyQualifiedName(symbol: Symbol): string; getWidenedType(type: Type): Type; getAugmentedPropertiesOfType(type: Type): Symbol[]; getPropertiesOfType(type: Type): Symbol[]; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined; /** Note that the resulting nodes cannot be checked. */ typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeParameterDeclaration | undefined; /** Note that the resulting nodes cannot be checked. */ symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): ParameterDeclaration | undefined; isOptionalParameter(node: ParameterDeclaration): boolean; } export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string> | MapLike<string[]> | ProjectReference[] | null | undefined; export interface TypeAcquisition { enable?: boolean; include?: string[]; exclude?: string[]; disableFilenameBasedTypeAcquisition?: boolean; [option: string]: CompilerOptionsValue | undefined; } export interface ProjectReference { /** A normalized path on disk */ path: string; /** The path as the user originally wrote it */ originalPath?: string; /** @deprecated */ prepend?: boolean; /** True if it is intended that this reference form a circularity */ circular?: boolean; } /** Either a parsed command line or a parsed tsconfig.json */ export interface ParsedCommandLine { options: CompilerOptions; typeAcquisition?: TypeAcquisition; fileNames: string[]; projectReferences?: readonly ProjectReference[]; watchOptions?: WatchOptions; raw?: any; errors: Diagnostic[]; wildcardDirectories?: MapLike<WatchDirectoryFlags>; compileOnSave?: boolean; } export interface ResolvedProjectReference { commandLine: ParsedCommandLine; sourceFile: SourceFile; references?: readonly (ResolvedProjectReference | undefined)[]; } /** * 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. */ export interface ResolvedModule { /** Path of the file the module was resolved to. */ resolvedFileName: string; /** True if `resolvedFileName` comes from `node_modules`. */ isExternalLibraryImport?: boolean; /** * 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. */ resolvedUsingTsExtension?: boolean; } /** * ResolvedModule with an explicitly provided `extension` property. * Prefer this over `ResolvedModule`. * If changing this, remember to change `moduleResolutionIsEqualTo`. */ export interface ResolvedModuleFull extends 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. */ extension: string; packageId?: PackageId; } export interface ResolvedTypeReferenceDirective { primary: boolean; resolvedFileName: string | undefined; packageId?: PackageId; /** True if `resolvedFileName` comes from `node_modules`. */ isExternalLibraryImport?: boolean; } export interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { readonly resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined; } export interface ResolvedModuleWithFailedLookupLocations { readonly resolvedModule: ResolvedModuleFull | undefined; } export declare const enum SignatureKind { Call = 0, Construct = 1 } export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; export interface Type { flags: TypeFlags; symbol: Symbol; pattern?: DestructuringPattern; aliasSymbol?: Symbol; aliasTypeArguments?: readonly Type[]; } export declare const enum SyntaxKind { Unknown = 0,// fIrst token EndOfFileToken = 1, SingleLineCommentTrivia = 2, MultiLineCommentTrivia = 3, NewLineTrivia = 4, WhitespaceTrivia = 5, ConflictMarkerTrivia = 6, MacroIdentifierTrivia = 7, ShebangTrivia = 8, NonTextFileMarkerTrivia = 9, NumericLiteral = 10, IntLiteral = 11, CharLiteral = 12, FloatLiteral = 13, BytesLiteral = 14, StringArrayLiteral = 15, StringLiteral = 16, OpenBraceToken = 17, BacktickToken = 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, LessThanDotDotToken = 31, GreaterThanToken = 32, LessThanEqualsToken = 33, GreaterThanEqualsToken = 34, EqualsEqualsToken = 35, ExclamationEqualsToken = 36, EqualsEqualsEqualsToken = 37, ExclamationEqualsEqualsToken = 38, EqualsGreaterThanToken = 39, MinusGreaterThanToken = 40, PlusToken = 41, MinusToken = 42, AsteriskToken = 43, AsteriskAsteriskToken = 44, SlashToken = 45, PercentToken = 46, PlusPlusToken = 47, MinusMinusToken = 48, LessThanLessThanToken = 49, GreaterThanGreaterThanToken = 50, GreaterThanGreaterThanGreaterThanToken = 51, AmpersandToken = 52, BarToken = 53, CaretToken = 54, ExclamationToken = 55, DoubleExclamationToken = 56, TildeToken = 57, AmpersandAmpersandToken = 58, BarBarToken = 59, QuestionToken = 60, ColonToken = 61, AtToken = 62, AtAtToken = 63, QuestionQuestionToken = 64, HashToken = 65, OpenParenColonToken = 66,// for inline closures ColonCloseParenToken = 67, OpenParenBracketToken = 68,// for mapping literal OpenParenBraceToken = 69,// for array literal OpenParenAsteriskToken = 70,// (*fn) shortcut for evaluate() ColonColonToken = 71, LambdaToken = 72, DotDotToken = 73, EqualsToken = 74,// first assignment PlusEqualsToken = 75, MinusEqualsToken = 76, AsteriskEqualsToken = 77, AsteriskAsteriskEqualsToken = 78, SlashEqualsToken = 79, PercentEqualsToken = 80, LessThanLessThanEqualsToken = 81, GreaterThanGreaterThanEqualsToken = 82, GreaterThanGreaterThanGreaterThanEqualsToken = 83, AmpersandEqualsToken = 84, BarEqualsToken = 85, BarBarEqualsToken = 86, QuestionQuestionEqualsToken = 87, CaretEqualsToken = 88,// last assignment Identifier = 89, StringizedIdentifier = 90, IntKeyword = 92,// FIrst Keyword, FirstReserved Word FloatKeyword = 93, StringKeyword = 94, LwObjectKeyword = 95, AnyKeyword = 96, ClosureKeyword = 97, StructKeyword = 98, CatchKeyword = 99, MixedKeyword = 100, UnknownKeyword = 101, MappingKeyword = 102, VoidKeyword = 103, BreakKeyword = 104, BytesKeyword = 105, DoKeyword = 106, ElseKeyword = 107, ForKeyword = 108, ForEachKeyword = 109, CaseKeyword = 110, DefaultKeyword = 111, IfKeyword = 112, ReturnKeyword = 113, SwitchKeyword = 114, WhileKeyword = 115, AsyncKeyword = 116, InheritKeyword = 117, ContinueKeyword = 118, PrivateKeyword = 119, ProtectedKeyword = 120, PublicKeyword = 121, StaticKeyword = 122, VisibleKeyword = 123, NoSaveKeyword = 124, NoShadowKeyword = 125, IntrinsicKeyword = 126, NoMaskKeyword = 127, VarArgsKeyword = 128, DeprecatedKeyword = 129,// LastReservedWord ClassKeyword = 130, StatusKeyword = 131, UndefinedKeyword = 132, FalseKeyword = 133,// JSON-only TrueKeyword = 134,// JSON-only NullKeyword = 135,// JSON-only NeverKeyword = 136,// typenode only FunctionKeyword = 137,// can be used as a param name SymbolKeyword = 138,// not reserved in fluffos ObjectKeyword = 139,// can occur in a super expr i.e. object::fn() RefKeyword = 140,// fluff only BufferKeyword = 141,// fluff only IsKeyword = 142,// use for type predicates only FunctionsKeyword = 143,// inherit modifier VirtualKeyword = 144,// inherit modifier InKeyword = 145,// not a reserved word in LD (maybe fluff?) NewKeyword = 146,// LastKeyword and LastToken - everything after this will be processed by the binder QualifiedName = 147,// First Node ComputedPropertyName = 148, TypeParameter = 149, Parameter = 150, IndexSignature = 151, CallSignature = 152, PropertyDeclaration = 153, PropertySignature = 154, MethodDeclaration = 155, InterfaceDeclaration = 156, MethodSignature = 157, UnionType = 158,// First Type Node FunctionType = 159, IntersectionType = 160, RestType = 161, ArrayType = 162, TupleType = 163, TypeLiteral = 164, TypeQuery = 165, ParenthesizedType = 166, TypeReference = 167, TypePredicate = 168, NamedObjectType = 169, ConditionalType = 170,// Last TYpe Node FunctionDeclaration = 171, ClassDeclaration = 172, ExportSpecifier = 173, ExportDeclaration = 174, MissingDeclaration = 175, PropertyAssignment = 176, ShorthandPropertyAssignment = 177, SourceFile = 178, Bundle = 179, IncludeDirective = 180, DefineDirective = 181, UndefDirective = 182, IfDirective = 183, IfDefDirective = 184, IfNDefDirective = 185, ElseDirective = 186, ElseIfDirective = 187, EndIfDirective = 188, PragmaDirective = 189, JSDocTypeExpression = 190,// First JSDoc Node JSDocNameReference = 191, JSDocMemberName = 192,// C#p JSDocAllType = 193,// The * type JSDocUnknownType = 194,// The ? type JSDocNullableType = 195, JSDocNonNullableType = 196, JSDocOptionalType = 197, JSDocFunctionType = 198, JSDocVariadicType = 199, JSDocNamepathType = 200,// https://jsdoc.app/about-namepaths.html JSDoc = 201, /** @deprecated Use SyntaxKind.JSDoc */ JSDocComment = 201, JSDocText = 202, JSDocTypeLiteral = 203, JSDocSignature = 204, JSDocLink = 205, JSDocLinkCode = 206, JSDocLinkPlain = 207, JSDocTag = 208, JSDocAugmentsTag = 209, JSDocImplementsTag = 210, JSDocAuthorTag = 211, JSDocDeprecatedTag = 212, JSDocClassTag = 213, JSDocPublicTag = 214, JSDocPrivateTag = 215, JSDocProtectedTag = 216, JSDocReadonlyTag = 217, JSDocOverrideTag = 218, JSDocCallbackTag = 219, JSDocOverloadTag = 220, JSDocEnumTag = 221, JSDocParameterTag = 222, JSDocReturnTag = 223, JSDocThisTag = 224, JSDocTypeTag = 225, JSDocTemplateTag = 226, JSDocTypedefTag = 227, JSDocSeeTag = 228, JSDocPropertyTag = 229, JSDocVariableTag = 230, JSDocThrowsTag = 231, JSDocSatisfiesTag = 232, JSDocImportTag = 233,// Last JSDoc Node SyntaxList = 234, NotEmittedStatement = 235, PartiallyEmittedExpression = 236, CommaListExpression = 237, Block = 238, VariableDeclaration = 239, VariableDeclarationList = 240, TypeAliasDeclaration = 241, CaseBlock = 242, StructDeclaration = 243,// WAS: ClassDeclaration, VariableStatement = 244,// FirstStatement ForStatement = 245, ForEachStatement = 246, DoWhileStatement = 247, WhileStatement = 248, ExpressionStatement = 249, ReturnStatement = 250, LabeledStatement = 251, BreakStatement = 252, ContinueStatement = 253, InheritDeclaration = 254, IfStatement = 255, EmptyStatement = 256, CatchStatement = 257, SwitchStatement = 258,// LastStatement LiteralType = 259, StructType = 260, InferType = 261, ThisType = 262, IndexedAccessType = 263, NamedTupleMember = 264, TypeOperator = 265, MappedType = 266, ArrayBindingPattern = 267, BindingElement = 268, ConditionalExpression = 269, CatchExpression = 270, BinaryExpression = 271, FunctionExpression = 272, ArrowFunction = 273, CallExpression = 274, CloneObjectExpression = 275, ClassExpression = 276, SyntheticExpression = 277, NewExpression = 278, NewStructExpression = 279, EvaluateExpression = 280, TypeAssertionExpression = 281, ExpressionWithTypeArguments = 282, ElementAccessExpression = 283, RangeExpression = 284, InlineClosureExpression = 285, LambdaIdentifierExpression = 286, LambdaOperatorExpression = 287, PropertyAccessExpression = 288, SuperAccessExpression = 289, PostfixUnaryExpression = 290, ParenthesizedExpression = 291, ArrayLiteralExpression = 292, MappingLiteralExpression = 293, MappingEntryExpression = 294, ObjectLiteralExpression = 295, SpreadElement = 296, ByRefElement = 297, CastExpression = 298, OmittedExpression = 299, PrefixUnaryExpression = 300, CaseClause = 301, HeritageClause = 302, DefaultClause = 303, Count = 304, FirstReservedWord = 92, LastReservedWord = 129, FirstKeyword = 92, LastKeyword = 146, FirstToken = 0, LastToken = 146, FirstStatement = 244, LastStatement = 258, FirstAssignment = 74, LastAssignment = 88, SuperKeyword = 71, FirstTypeNode = 158, LastTypeNode = 170, FirstNode = 147, FirstFutureReservedWord = 92, LastFutureReservedWord = 146, FirstJSDocNode = 190, LastJSDocNode = 233, FirstLiteralToken = 11, LastLiteralToken = 16, FirstJSDocTagNode = 190, LastJSDocTagNode = 233, FirstTriviaToken = 2, LastTriviaToken = 8, FirstBinaryOperator = 29, LastBinaryOperator = 88, FirstPunctuation = 17, LastPunctuation = 73 } export declare const enum TypeFlags { Any = 1, Unknown = 2, String = 4, Number = 8, Boolean = 16, Enum = 32,// Numeric computed enum member value Float = 64, StringLiteral = 128, IntLiteral = 256, BooleanLiteral = 512, EnumLiteral = 1024,// Always combined with StringLiteral, NumberLiteral, or Union FloatLiteral = 2048, Bytes = 4096, BytesLiteral = 8192,// unique symbol Void = 16384, Undefined = 32768, Null = 65536, Never = 131072,// Never type TypeParameter = 262144,// Type parameter Object = 524288,// Object type Union = 1048576,// Union (T | U) Intersection = 2097152,// Intersection (T & U) Index = 4194304,// keyof T IndexedAccess = 8388608,// T[K] Conditional = 16777216,// T extends U ? X : Y Substitution = 33554432,// Type parameter substitution NonPrimitive = 67108864,// intrinsic object type TemplateLiteral = 134217728,// Template literal type StringMapping = 268435456,// Used by union/intersection type construction LpcDocVariable = -2147483648, Literal = 2944, Unit = 101280, Freshable = 2976, StringOrNumberLiteral = 384, PossiblyFalsy = 121820, StringLike = 402653316, NumberLike = 2344, BooleanLike = 528, EnumLike = 1056, VoidLike = 49152, BytesLike = 12288, UnionOrIntersection = 3145728, StructuredType = 3670016, TypeVariable = 8650752, InstantiableNonPrimitive = 58982400, InstantiablePrimitive = 406847488, Instantiable = 465829888, StructuredOrInstantiable = 469499904, Narrowable = 536624063 } export declare const enum TypeFormatFlags { None = 0, NoTruncation = 1,// Don't truncate typeToString result WriteArrayAsGenericType = 2,// Write Array<T> instead T[] GenerateNamesForShadowedTypeParams = 4,// When a type parameter T is shadowing another T, generate a name for it so it can still be referenced UseStructuralFallback = 8,// When an alias cannot be named by its symbol, rather than report an error, fallback to a structural printout if possible WriteTypeArgumentsOfSignature = 32,// Write the type arguments instead of type parameters of the signature UseFullyQualifiedType = 64,// Write out the fully qualified type name (eg. Module.Type, instead of Type) SuppressAnyReturnType = 256,// If the return type is any-like, don't offer a return type. MultilineObjectLiterals = 1024,// Always print object literals across multiple lines (only used to map into node builder flags) WriteClassExpressionAsTypeLiteral = 2048,// Write a type literal instead of (Anonymous class) UseTypeOfFunction = 4096,// Write typeof instead of function type literal OmitParameterModifiers = 8192,// Omit modifiers on parameters UseAliasDefinedOutsideCurrentScope = 16384,// For a `type T = ... ` defined in a different file, write `T` instead of its value, even though `T` can't be accessed in the current scope. UseSingleQuotesForStringLiteralType = 268435456,// Use single quotes for string literal type NoTypeReduction = 536870912,// Don't call getReducedType OmitThisParameter = 33554432, AllowUniqueESSymbolType = 1048576,// This is bit 20 to align with the same bit in `NodeBuilderFlags` AddUndefined = 131072,// Add undefined to types of initialized, non-optional parameters WriteArrowStyleSignature = 262144,// Write arrow style signature InArrayType = 524288,// Writing an array element type InElementType = 2097152,// Writing an array or union element type InFirstTypeArgument = 4194304,// Writing first type argument of the instantiated type InTypeAlias = 8388608,// Writing type in type alias declaration NodeBuilderFlagsMask = 848330095 } export declare const enum NodeFlags { None = 0, Variable = 1,// Variable declaration ExternalFile = 4,// Included from an external file Synthesized = 16,// Node was synthesized during transformation IncludeContext = 32,// Node was parsed from an include file MacroContext = 64,// Node was parsed as a result of a macro expansion ExportContext = 128,// Export context (initialized by binding) HasImplicitReturn = 512,// If function implicitly returns on one of codepaths (initialized by binding) HasExplicitReturn = 1024,// If function has explicit reachable return on one of codepaths (initialized by binding) HasAsyncFunctions = 4096,// If the file has async (i.e. LD coroutine) functions (initialized by binding) DisallowInContext = 8192,// If node was parsed in a context where 'in-expressions' are not allowed YieldContext = 16384,// If node was parsed in the 'yield' context created when parsing a generator DisallowTypes = 32768,// If node was parsed in a context where types are not allowed AwaitContext = 65536,// If node was parsed in the 'await' context created when parsing an async function DisallowCommaContext = 131072,// If node was parsed in a context where comma expr are not allow ThisNodeHasError = 262144,// If the parser encountered an error when parsing the code that created this node DisallowConditionalTypesContext = 524288, ThisNodeOrAnySubNodesHasError = 1048576,// If this node or any of its children had an error HasAggregatedChildData = 2097152,// If we've computed data from children and cached it in this node OptionalChain = 4194304,// not used DisallowPipeContext = 8388608,// If node was parsed in a context where '|' operators are not allowed CatchContext = 16777216,// If node was parsed in the 'catch' context created when parsing a catch clause JSDoc = 33554432,// If has '@deprecated' JSDoc tag ReachabilityCheckFlags = 1536, ReachabilityAndEmitFlags = 1536, ContextFlags = 67887200, BlockScoped = 1,// Indicates whether the identifier is part of a JSDoc namespace IncludeOrMacro = 96 } export declare const enum EmitFlags { None = 0, SingleLine = 1,// The contents of this node should be emitted on a single line. MultiLine = 2, AdviseOnEmitNode = 4,// The printer should invoke the onEmitNode callback when printing this node. NoSubstitution = 8,// Disables further substitution of an expression. CapturesThis = 16,// The function captures a lexical `this` NoLeadingSourceMap = 32,// Do not emit a leading source map location for this node. NoTrailingSourceMap = 64,// Do not emit a trailing source map location for this node. NoSourceMap = 96,// Do not emit a source map location for this node. NoNestedSourceMaps = 128,// Do not emit source map locations for children of this node. NoTokenLeadingSourceMaps = 256,// Do not emit leading source map location for token nodes. NoTokenTrailingSourceMaps = 512,// Do not emit trailing source map location for token nodes. NoTokenSourceMaps = 768,// Do not emit source map locations for tokens of this node. NoLeadingComments = 1024,// Do not emit leading comments for this node. NoTrailingComments = 2048,// Do not emit trailing comments for this node. NoComments = 3072,// Do not emit comments for this node. NoNestedComments = 4096, HelperName = 8192,// The Identifier refers to an *unscoped* emit helper (one that is emitted at the top of the file) ExportName = 16384,// Ensure an export prefix is added for an identifier that points to an exported declaration with a local name (see SymbolFlags.ExportHasLocal). LocalName = 32768,// Ensure an export prefix is not added for an identifier that points to an exported declaration. InternalName = 65536,// The name is internal to an ES5 class body function. Indented = 131072,// Adds an explicit extra indentation level for class and function bodies when printing (used to match old emitter). NoIndentation = 262144,// Do not indent the node. AsyncFunctionBody = 524288, ReuseTempVariableScope = 1048576,// Reuse the existing temp variable scope during emit. CustomPrologue = 2097152,// Treat the statement as if it were a prologue directive (NOTE: Prologue directives are *not* transformed). NoHoisting = 4194304,// Do not hoist this declaration in --module system Iterator = 8388608,// The expression to a `yield*` should be treated as an Iterator when down-leveling, not an Iterable. NoAsciiEscaping = 16777216 } export declare const enum ModifierFlags { None = 0, Public = 1,// Property/Method Private = 2,// Property/Method Protected = 4,// Property/Method NoMask = 32,// NoShadow = 64,// NoSave = 128,// Static = 256,// Property/Method VarArgs = 512, Visible = 1024, Export = 2048,// Declarations Ambient = 4096, Readonly = 8192, In = 16384,// Contravariance modifier Out = 32768,// Covariance modifier Deprecated = 65536, HasComputedJSDocModifiers = 268435456,// Indicates the computed modifier flags include modifiers from JSDoc. HasComputedFlags = 536870912,// Modifier flags have been computed AccessibilityModifier = 7, ParameterPropertyModifier = 167, NonPublicAccessibilityModifier = 6, All = 67559, Modifier = 67559 } export declare const enum ElementFlags { Required = 1,// T Optional = 2,// T? Rest = 4,// ...T[] Variadic = 8,// ...T Fixed = 3, Variable = 12, NonRequired = 14, NonRest = 11 } export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.IntKeyword | SyntaxKind.FloatKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.BytesKeyword | SyntaxKind.MappingKeyword | SyntaxKind.StatusKeyword | SyntaxKind.LwObjectKeyword | SyntaxKind.ClosureKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.BufferKeyword | SyntaxKind.MixedKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.NeverKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type TypeNodeSyntaxKind = KeywordTypeSyntaxKind | SyntaxKind.TupleType | SyntaxKind.InferType | SyntaxKind.UnionType | SyntaxKind.NamedTupleMember | SyntaxKind.IndexedAccessType | SyntaxKind.StructType | SyntaxKind.ArrayType | SyntaxKind.LiteralType | SyntaxKind.ThisType | SyntaxKind.TypePredicate | SyntaxKind.MappedType | SyntaxKind.TypeLiteral | SyntaxKind.ParenthesizedType | SyntaxKind.TypeReference | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.FunctionType | SyntaxKind.ConditionalType | SyntaxKind.IntersectionType | SyntaxKind.NamedObjectType | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocNamepathType | SyntaxKind.JSDocSignature | SyntaxKind.JSDocTypeLiteral; export type PropertyName = Identifier | StringLiteral | IntLiteral | ComputedPropertyName | ParenthesizedExpression; export type MemberName = Identifier; export type DeclarationName = PropertyName | StringLiteral | Expression | ElementAccessExpression | BindingPattern | EntityNameExpression; export interface Symbol { flags: SymbolFlags; name: string; declarations?: Declaration[]; valueDeclaration?: Declaration; members?: SymbolTable; exports?: SymbolTable; inherits?: Map<string, Type>; globalExports?: SymbolTable; } export interface TrueLiteral extends PrimaryExpression { readonly kind: SyntaxKind.TrueKeyword; } export interface FalseLiteral extends PrimaryExpression { readonly kind: SyntaxKind.FalseKeyword; } export interface NodeFactory { createSourceFile(statements: readonly Statement[], endOfFileToken: EndOfFileToken, flags: NodeFlags): SourceFile; createNodeArray<T extends Node>(elements?: readonly T[], hasTrailingComma?: boolean): NodeArray<T>; createIntLiteral(value: string | number, numericLiteralFlags?: TokenFlags): IntLiteral; createFloatLiteral(value: string | number, numericLiteralFlags?: TokenFlags): FloatLiteral; createStringLiteral(text: string): StringLiteral; createBytesLiteral(text: string): BytesLiteral; createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; createTrue(): TrueLiteral; createFalse(): FalseLiteral; createToken(token: SyntaxKind.EndOfFileToken): EndOfFileToken; createToken(token: SyntaxKind.Unknown): Token<SyntaxKind.Unknown>; createIdentifier(text: string): Identifier; createLiteralLikeNode(kind: LiteralToken["kind"], text: string): LiteralToken; createEmptyStatement(): EmptyStatement; createModifier<T extends ModifierSyntaxKind>(kind: T): ModifierToken<T>; createModifiersFromModifierFlags(flags: ModifierFlags): Modifier[] | undefined; createQualifiedName(left: EntityName, right: string | Identifier): QualifiedName; createComputedPropertyName(expression: Expression): ComputedPropertyName; updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName; createIndexSignature(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; createTypeParameterDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, constraint?: TypeNode, defaultType?: TypeNode): TypeParameterDeclaration; updateTypeParameterDeclaration(node: TypeParameterDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration; createMethodSignature(modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): MethodSignature; createCallSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; createFunctionTypeNode(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): FunctionTypeNode; createBindingElement(dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression): BindingElement; updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined): BindingElement; createIncludeDirective(content: StringLiteral[], localFirst: boolean): IncludeDirective; createPragmaDirective(expression: NodeArray<Identifier>): PragmaDirective; createDefineDirective(name: string | Identifier | TypeNode, args: NodeArray<ParameterDeclaration>, range: TextRange): DefineDirective; createUndefDirective(name: string | Identifier): UndefDirective; createTypePredicateNode(assertsModifier: undefined, parameterName: Identifier | ThisTypeNode | string, type: TypeNode | undefined): TypePredicateNode; updateTypePredicateNode(node: TypePredicateNode, assertsModifier: undefined, parameterName: Identifier | ThisTypeNode, type: TypeNode | undefined): TypePredicateNode; createKeywordTypeNode<TKind extends KeywordTypeSyntaxKind>(kind: TKind): KeywordTypeNode<TKind>; createTypeReferenceNode(typeName: string | EntityName, typeArguments?: readonly TypeNode[]): TypeReferenceNode; updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray<TypeNode> | undefined): TypeReferenceNode; createUnionTypeNode(types: readonly TypeNode[]): UnionTypeNode; createIntersectionTypeNode(types: readonly TypeNode[]): IntersectionTypeNode; createArrayTypeNode(elementType: TypeNode): ArrayTypeNode; createNamedObjectTypeNode(name: StringLiteral | BinaryExpression | ParenthesizedExpression, objectKeyword: TypeNode): NamedObjectTypeNode; createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; createLiteralTypeNode(literal: LiteralTypeNode["literal"]): LiteralTypeNode; createTypeLiteralNode(members: readonly TypeElement[] | undefined): TypeLiteralNode; createStructTypeNode(name: Identifier, keyword: StructKeywordSyntaxKind): StructTypeNode; createPropertySignature(modifiers: readonly Modifier[] | undefined, name: PropertyName | string, type: TypeNode | undefined): PropertySignature; createStructDeclarationNode(modifiers: readonly Modifier[] | undefined, name: Identifier, heritageName: Identifier | undefined, type: TypeNode): StructDeclaration; createBlock(statements: readonly Statement[], multiLine?: boolean): Block; createVariableStatement(modifiers: readonly Modifier[] | undefined, type: TypeNode | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]): VariableStatement; createVariableDeclarationList(declarations: readonly VariableDeclaration[], flags?: NodeFlags): VariableDeclarationList; createVariableDeclaration(name: string | BindingName, refToken?: RefToken, type?: TypeNode | undefined, initializer?: Expression | undefined): VariableDeclaration; createFunctionDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; createExpressionStatement(expression: Expression): ExpressionStatement; createReturnStatement(expression?: Expression): ReturnStatement; createBreakStatement(label?: string | Identifier): BreakStatement; createContinueStatement(label?: string | Identifier): ContinueStatement; createInheritDeclaration(importClause: InheritClauseNodeType, modifiers: readonly Modifier[] | undefined): InheritDeclaration; createIfStatement(expression: Expression, thenStatement: Statement, elseStatement?: Statement): IfStatement; createSwitchStatement(expression: Expression, preBlock: NodeArray<Statement>, caseBlock: CaseBlock): SwitchStatement; createCaseBlock(clauses: readonly CaseOrDefaultClause[]): CaseBlock; createDefaultClause(statements: readonly Statement[]): DefaultClause; createCaseClause(expression: Expression, statements: readonly Statement[]): CaseClause; createForStatement(initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement; createForEachStatement(initializer: ForInitializer | undefined, range: Expression | undefined, statement: Statement): ForEachStatement; createDoWhileStatement(statement: Statement, expression: Expression): DoWhileStatement; createWhileStatement(statement: Statement, expression: Expression): WhileStatement; createParameterDeclaration(modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, ampToken?: AmpersandToken | RefToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration; createCatchStatement(expression: Expression | undefined, block: Block, modifier?: Identifier, modifierExpression?: Expression): CatchStatement; createExpressionWithTypeArguments(expression: Expression, typeArguments: readonly TypeNode[] | undefined): ExpressionWithTypeArguments; createCatchExpression(expression: Expression, modifier?: Identifier, modifierExpression?: Expression, block?: Block): CatchExpression; createEvaluateExpression(expression: Expression, argumentsArray: readonly Expression[] | undefined): EvaluateExpression; createNewExpression(expression: Expression | TypeNode | undefined, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly NewExpressionArgument[] | undefined): NewExpression; createSpreadElement(expression: Expression): SpreadElement; createByRefElement(ampToken: AmpersandToken | RefToken, expr: Expression): ByRefElement; createFunctionExpression(modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, parameters: readonly ParameterDeclaration[] | undefined, type: TypeNode | undefined, body: Block): FunctionExpression; createOmittedExpression(): OmittedExpression; createParenthesizedExpression(expression: Expression): ParenthesizedExpression; createConditionalExpression(condition: Expression, questionToken: QuestionToken | undefined, whenTrue: Expression, colonToken: ColonToken | undefined, whenFalse: Expression): ConditionalExpression; createBinaryExpression(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression): BinaryExpression; createCallExpression(expression: Expression, argumentsArray: readonly Expression[] | undefined): CallExpression; createInlineClosure(body: ConciseBody | NodeArray<Expression>): InlineClosureExpression; createSuperAccessExpression(name: MemberName, namespace?: string | StringLiteral | Identifier): SuperAccessExpression; createPropertyAccessExpression(expression: Expression, name: string | Identifier | Expression, propertyAccessToken?: PropertyAccessToken): PropertyAccessExpression; createPrefixUnaryExpression(operator: PrefixUnaryOperator, operand: Expression): PrefixUnaryExpression; createPostfixUnaryExpression(operand: Expression, operator: PostfixUnaryOperator): PostfixUnaryExpression; createElementAccessExpression(expression: Expression, index: number | Expression): ElementAccessExpression; createArrayLiteralExpression(elements?: readonly Expression[], multiLine?: boolean, trailingComma?: boolean): any; createObjectLiteralExpression(properties?: readonly ObjectLiteralElementLike[], multiLine?: boolean): ObjectLiteralExpression; createMappingLiteralExpression(initializer?: Expression, elements?: readonly Expression[], multiLine?: boolean, trailingComma?: boolean): MappingLiteralExpression; createMappingEntryExpression(name: Expression, elements: readonly Expression[]): MappingEntryExpression; convertToAssignmentExpression(node: Mutable<VariableDeclaration>): BinaryExpression; createLambdaOperatorExpression(op: LambdaOperatorToken): LambdaOperatorExpression; createLambdaIdentifierExpression(name: Expression): LambdaIdentifierExpression; createCastExpression(expression: Expression, type: TypeNode): Expression; createCloneObjectExpression(expression: Expression, argumentsArray: readonly Expression[] | undefined): CloneObjectExpression; createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion; createNewStructExpression(type: StructTypeNode, argumentsArray: readonly (Expression | ObjectLiteralElementLike)[] | undefined): NewStructExpression; createRangeExpression(left: Expression, right: Expression): RangeExpression; createJSDocText(text: string): JSDocText; createJSDocComment(comment?: string | NodeArray<JSDocComment> | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, defaultExpression: Expression | undefined, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray<JSDocComment>): JSDocParameterTag; createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocReturnTag; createJSDocOptionalType(type: TypeNode): JSDocOptionalType; createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocTypeTag; createJSDocTypeExpression(type: TypeNode): JSDocTypeExpression; createJSDocNameReference(name: EntityName | JSDocMemberName): JSDocNameReference; createJSDocLink(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLink; createJSDocLinkCode(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode; createJSDocLinkPlain(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain; createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocClassTag; createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocPublicTag; createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocPrivateTag; createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocProtectedTag; createJSDocDeprecatedTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocDeprecatedTag; createJSDocOverrideTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocOverrideTag; createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocUnknownTag; createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray<JSDocComment>): JSDocPropertyTag; createJSDocVariableTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray<JSDocComment>): JSDocVariableTag; createJSDocTypeLiteral(propertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | NodeArray<JSDocComment>): JSDocSeeTag; createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocAuthorTag; createJSDocThrowsTag(tagName: Identifier, typeExpression: JSDocTypeExpression | undefined, comment?: string | NodeArray<JSDocComment>): JSDocThrowsTag; createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray<JSDocComment>): JSDocImplementsTag; createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocTypedefTag; createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray<JSDocComment>): JSDocAugmentsTag; createJSDocSatisfiesTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocSatisfiesTag; createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocThisTag; createJSDocVariadicType(type: TypeNode): JSDocVariadicType; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocCallbackTag; createJSDocOverloadTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, comment?: string | NodeArray<JSDocComment>): JSDocOverloadTag; createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray<JSDocComment>): JSDocTemplateTag; createPropertyAssignment(name: string | PropertyName, initializer: Expression): PropertyAssignment; } export interface CompilerOptions { skipLibCheck?: boolean; skipDefaultLibCheck?: boolean; allowArbitraryExtensions?: boolean; traceResolution?: boolean; allowUnreachableCode?: boolean; noUncheckedIndexedAccess?: boolean; noFallthroughCasesInSwitch?: boolean; noCheck?: boolean; noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitReturns?: boolean; strictObjectTypes?: boolean; newLine?: NewLineKind; configFile?: LpcConfigSourceFile; sefunFile?: string; masterFile?: string; playerFile?: string; configDefines?: MapLike<string>; forceConsistentCasingInFileNames?: boolean; noResolve?: boolean; noLib?: boolean; maxNodeModuleJsDepth?: number; getCompilationSettings?: any; configFilePath?: string; driverType?: LanguageVariant; rootDir?: string; rootDirs?: string[]; outDir?: string; declarationDir?: string; outFile?: string; paths?: MapLike<string[]>; lib?: string[]; preserveSymlinks?: boolean; disableSourceOfProjectReferenceRedirect?: boolean; disableReferencedProjectLoad?: boolean; module?: ModuleKind; target?: ScriptTarget; exactOptionalPropertyTypes?: boolean; diagnostics?: boolean; libIncludeDirs?: string[]; globalIncludeFiles?: string[]; resolvedGlobalIncludeFiles?: string[]; [option: string]: CompilerOptionsValue | LpcConfigSourceFile | undefined; } export declare const enum OuterExpressionKinds { Parentheses = 1, /** @deprecated not supported in lpc */ TypeAssertions = 2, /** @deprecated not supported in lpc */ NonNullAssertions = 4, PartiallyEmittedExpressions = 8, Assertions = 6, All = 15, ExcludeJSDocTypeAssertion = 16 } /** DIAGNOSTICS */ export interface DiagnosticMessage { key: string; category: DiagnosticCategory; code: number; message: string; reportsUnnecessary?: {}; reportsDeprecated?: {}; } export declare enum DiagnosticCategory { Warning = 0, Error = 1, Suggestion = 2, Message = 3 } export interface DiagnosticRelatedInformation { category: DiagnosticCategory; code: number; file: SourceFileBase | undefined; start: number | undefined; length: number | undefined; messageText: string | DiagnosticMessageChain; } export interface DiagnosticWithLocation extends Diagnostic { file: SourceFileBase; start: number; length: number; } /** * A linked list of formatted diagnostic messages to be used as part of a multiline message. * It is built from the bottom up, leaving the head to be the "main" diagnostic. * While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage, * the difference is that messa