diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 4e45a1b6a7a88..1a3a25406ee18 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -342,7 +342,7 @@ const enumDefs = [ /** * @param {string} block * @param {EnumDef} def - * @returns {{ name: string, value: string }[]} + * @returns {EnumMember[]} */ function parseGoConstBlock(block, def) { const prefix = def.goPrefix; @@ -417,9 +417,16 @@ function parseGoStringValue(goValue, replacements) { return JSON.stringify(result); } +/** + * @typedef {{ + * name: string; + * value: string; + * }} EnumMember + */ + /** * @param {EnumDef} def - * @returns {{ name: string, value: string }[]} + * @returns {EnumMember[]} */ function parseGoEnum(def) { const source = fs.readFileSync(def.goFile, "utf-8"); @@ -436,8 +443,8 @@ function parseGoEnum(def) { /** * Topologically sort enum members so composite members appear after * all members they reference (Go allows forward references, TS does not). - * @param {{ name: string, value: string }[]} members - * @returns {{ name: string, value: string }[]} + * @param {EnumMember[]} members + * @returns {EnumMember[]} */ function topoSortMembers(members) { const nameSet = new Set(members.map(m => m.name)); @@ -453,7 +460,7 @@ function topoSortMembers(members) { deps.set(m.name, refs); } - const sorted = /** @type {{ name: string, value: string }[]} */ ([]); + const sorted = /** @type {EnumMember[]} */ ([]); const visited = new Set(); const visiting = new Set(); @@ -467,7 +474,7 @@ function topoSortMembers(members) { } visiting.delete(name); visited.add(name); - sorted.push(/** @type {{ name: string, value: string }} */ (members.find(m => m.name === name))); + sorted.push(/** @type {EnumMember} */ (members.find(m => m.name === name))); } for (const m of members) { @@ -478,7 +485,7 @@ function topoSortMembers(members) { /** * @param {EnumDef} def - * @param {{ name: string, value: string }[]} members + * @param {EnumMember[]} members * @returns {string} */ function renderEnumTS(def, members) { @@ -488,6 +495,126 @@ function renderEnumTS(def, members) { return `${header}export enum ${def.name} {\n${lines.join("\n")}\n}\n`; } +const enumValuesGeneratedGoPath = "tsc/internal/api/enum_values_generated.go"; + +/** + * @typedef {{ + * def: EnumDef + * code: string, + * fileNames: string[] + * members: EnumMember[] + * }} GeneratedEnum + */ + +/** + * Ask the Go compiler what it actually thinks each numeric member's value is, so that + * generated TS values can be checked against Go's own arithmetic rather than trusting that + * copying operator-by-operator text from Go into JS preserves precedence/semantics. + * + * Writes tsc/internal/api/enum_values_generated.go, a standalone program that imports every + * package referenced by enumDefs and references each member by its original Go identifier + * (not by re-deriving it from the parsed TS text), so Go itself — not this script — computes + * the ground-truth value, then prints them as JSON. `internal/api` is used as the host package + * because it already imports (nearly) every package enums are sourced from. + * + * @param {GeneratedEnum[]} generatedEnums + * @returns {Promise>>} enum def name -> (memberName -> Go value) + */ +async function computeGoGroundTruth(generatedEnums) { + /** @type {Map} */ + const packagesByDir = new Map(); + /** + * @param {EnumDef} def + * @returns {string} + */ + function getPackageName(def) { + const dir = path.dirname(def.goFile); + const importPath = `github.com/microsoft/TypeScript/tsc/${dir.replace(/^tsc[\\/]/, "")}`.replace(/\\/g, "/"); + let info = packagesByDir.get(dir); + if (info === undefined) { + info = { importPath, pkgName: path.basename(dir) }; + packagesByDir.set(dir, info); + } + return info.pkgName; + } + + /** @type {string[]} */ + const entries = []; + for (const { def, members } of generatedEnums) { + if (def.stringEnum) continue; + const pkgName = getPackageName(def); + + /** @type {string[]} */ + const memberEntries = members.map(m => { + return `\t\t\t${JSON.stringify(m.name)}: toInt32(${pkgName}.${def.goPrefix}${m.name}),`; + }); + entries.push( + `\t\t${JSON.stringify(def.name)}: {\n${memberEntries.join("\n")}\n\t\t},`, + ); + } + + const importLines = [...packagesByDir.values()] + .sort((a, b) => a.importPath.localeCompare(b.importPath)) + .map(({ pkgName, importPath }) => `\t${pkgName} "${importPath}"`); + + const goSource = `//go:build ignore + +// Code generated by Herebyfile.mjs generate:enums. DO NOT EDIT. +// Running this program prints the real Go-evaluated value of every generated enum member as +// JSON, so generate:enums can validate that the TypeScript it emits agrees with Go's own +// arithmetic (catching, e.g., operator-precedence mistakes introduced by copying Go expression +// text into TypeScript verbatim). + +package main + +import ( +\t"encoding/json" +\t"os" + +${importLines.join("\n")} +) + +func main() { +\tvalues := map[string]map[string]int32{ +${entries.join("\n")} +\t} +\tif err := json.NewEncoder(os.Stdout).Encode(values); err != nil { +\t\tpanic(err) +\t} +} + +// A generic function call (unlike a constant conversion) forces Go to evaluate the conversion at +// runtime, truncating uint32-backed flags with a leading bitwise-not the same way JS's 32-bit +// bitwise operators would, instead of rejecting "constant overflows int32" at compile time. +func toInt32[T ~int8 | ~int16 | ~int32 | ~int | ~uint8 | ~uint16 | ~uint32](v T) int32 { +\treturn int32(v) +} + +`; + + fs.writeFileSync(enumValuesGeneratedGoPath, goSource); + await $`dprint fmt ${enumValuesGeneratedGoPath}`; + + const { stdout } = await $pipe`go run ${enumValuesGeneratedGoPath}`; + /** @type {Record>} */ + const parsed = JSON.parse(stdout); + return parsed; +} + +/** + * Evaluate the generated IIFE in a sandbox and return each member's actual runtime value, so + * validation checks what TS really computes rather than re-deriving it from the source text. + * @param {string} enumSource + * @param {string} enumName + * @returns {Promise>} + */ +async function evaluateEnumMembers(enumSource, enumName) { + const enumModule = await import(`data:text/javascript;charset=utf-8,${encodeURIComponent(enumSource)}`); + /** @type {Record} */ + const enumObj = enumModule[enumName]; + return enumObj; +} + async function runGenerateEnums() { const ts = /** @type {typeof import("typescript")} */ (await import("typescript")); @@ -497,22 +624,28 @@ async function runGenerateEnums() { * @returns {string} */ function transpile(enumSource, enumName) { - const result = ts.transpileModule(enumSource, { + return ts.transpileModule(enumSource, { compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ESNext, }, - }); - return result.outputText.replace( + }).outputText; + } + /** + * @param {string} enumSource + * @param {string} enumName + * @returns {string} + */ + function convertEnumToTs(enumSource, enumName) { + return enumSource.replace( `export var ${enumName};`, `export var ${enumName}: any;`, ); } console.log("Generating enums from Go source..."); - /** @type {string[]} */ - const generatedFiles = []; - + /** @type {Array} */ + const generatedEnums = []; for (const def of enumDefs) { const members = parseGoEnum(def); const camelName = def.name.charAt(0).toLowerCase() + def.name.slice(1); @@ -523,18 +656,51 @@ async function runGenerateEnums() { const enumTS = renderEnumTS(def, members); const enumPath = path.join(def.outDir, `${camelName}.enum.ts`); fs.writeFileSync(enumPath, enumTS); - generatedFiles.push(enumPath); // Generate .ts (IIFE — used at runtime) - const iifeSource = transpile(enumTS, def.name); + const enumJsCode = transpile(enumTS, def.name); + const iifeSource = convertEnumToTs(enumJsCode, def.name); const iifePath = path.join(def.outDir, `${camelName}.ts`); fs.writeFileSync(iifePath, iifeSource); - generatedFiles.push(iifePath); + generatedEnums.push({ + code: enumJsCode, + def, + members, + fileNames: [enumPath, iifePath], + }); console.log(` ${def.name}: ${members.length} members → ${camelName}.enum.ts, ${camelName}.ts`); } - await $`dprint fmt ${generatedFiles}`; + console.log("Getting values from go"); + const goValuesByEnum = await computeGoGroundTruth(generatedEnums); + /** @type {string[]} */ + const mismatches = []; + for (const { def, members, code } of generatedEnums) { + if (def.stringEnum) continue; + const goValues = goValuesByEnum[def.name]; + assert(goValues, `Enum ${def.name} was not outputted from GO`); + const tsValues = await evaluateEnumMembers(code, def.name); + for (const m of members) { + const goValue = goValues[m.name]; + const tsValue = tsValues[m.name]; + if (tsValue !== goValue) { + mismatches.push( + `${def.name}.${m.name}: Go says ${goValue}, but generated TS (\`${m.value}\`) evaluates to ${tsValue}`, + ); + } + } + } + + if (mismatches.length > 0) { + throw new Error( + `Generated enum values disagree with Go (likely an operator precedence or transcription bug in generate:enums):\n` + + mismatches.map(m => ` - ${m}`).join("\n"), + ); + } + console.log("All generated values match Go."); + + await $`dprint fmt ${generatedEnums.flatMap(e => e.fileNames)}`; console.log("Done."); } diff --git a/packages/typescript/src/enums/symbolFlags.enum.ts b/packages/typescript/src/enums/symbolFlags.enum.ts index 96401cdd4a4e4..6350084ced171 100644 --- a/packages/typescript/src/enums/symbolFlags.enum.ts +++ b/packages/typescript/src/enums/symbolFlags.enum.ts @@ -33,7 +33,7 @@ export enum SymbolFlags { ConstEnumOnlyModule = 1 << 28, ReplaceableByMethod = 1 << 29, GlobalLookup = 1 << 30, - All = 1 << 30 - 1, + All = (1 << 30) - 1, Enum = RegularEnum | ConstEnum, Variable = FunctionScopedVariable | BlockScopedVariable, Value = Variable | Property | EnumMember | ObjectLiteral | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor, diff --git a/packages/typescript/src/enums/symbolFlags.ts b/packages/typescript/src/enums/symbolFlags.ts index 85e3c29ee08d2..a962554b6d51b 100644 --- a/packages/typescript/src/enums/symbolFlags.ts +++ b/packages/typescript/src/enums/symbolFlags.ts @@ -33,7 +33,7 @@ export var SymbolFlags: any; SymbolFlags[SymbolFlags["ConstEnumOnlyModule"] = 268435456] = "ConstEnumOnlyModule"; SymbolFlags[SymbolFlags["ReplaceableByMethod"] = 536870912] = "ReplaceableByMethod"; SymbolFlags[SymbolFlags["GlobalLookup"] = 1073741824] = "GlobalLookup"; - SymbolFlags[SymbolFlags["All"] = 536870912] = "All"; + SymbolFlags[SymbolFlags["All"] = 1073741823] = "All"; SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum"; SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable"; SymbolFlags[SymbolFlags["Value"] = 111551] = "Value"; diff --git a/packages/typescript/test/async/api.test.ts b/packages/typescript/test/async/api.test.ts index 24ae9c84f1eb8..ae60f8b5cc645 100644 --- a/packages/typescript/test/async/api.test.ts +++ b/packages/typescript/test/async/api.test.ts @@ -4353,6 +4353,27 @@ function f() { await api.close(); } }); + + // Regression test: `<<` binds tighter than `-` in Go but looser in JS, so SymbolFlagsAll's + // `(1<<30) - 1` needs those parens or the generated enum silently becomes `1 << 29`. + test("SymbolFlags.All includes both value and type meanings", async () => { + const api = spawnAPI(scopeFiles); + try { + const snapshot = await api.updateSnapshot({ openProject: "/tsconfig.json" }); + const project = snapshot.getProject("/tsconfig.json")!; + const pos = scopeFiles["/src/main.ts"].indexOf("return innerValue"); + const symbols = await project.checker.getSymbolsInScope( + { document: "/src/main.ts", position: pos }, + SymbolFlags.All, + ); + const names = symbols.map(s => s.name); + assert.ok(names.includes("innerValue"), "should include local value symbol"); + assert.ok(names.includes("OuterType"), "should include type symbol declared in file"); + } + finally { + await api.close(); + } + }); }); describe("Symbol - getDocumentationComment and getJsDocTags", () => { diff --git a/packages/typescript/test/sync/api.test.ts b/packages/typescript/test/sync/api.test.ts index 93fe5eae5255f..2f1ad33ec0e2c 100644 --- a/packages/typescript/test/sync/api.test.ts +++ b/packages/typescript/test/sync/api.test.ts @@ -4361,6 +4361,27 @@ function f() { api.close(); } }); + + // Regression test: `<<` binds tighter than `-` in Go but looser in JS, so SymbolFlagsAll's + // `(1<<30) - 1` needs those parens or the generated enum silently becomes `1 << 29`. + test("SymbolFlags.All includes both value and type meanings", () => { + const api = spawnAPI(scopeFiles); + try { + const snapshot = api.updateSnapshot({ openProject: "/tsconfig.json" }); + const project = snapshot.getProject("/tsconfig.json")!; + const pos = scopeFiles["/src/main.ts"].indexOf("return innerValue"); + const symbols = project.checker.getSymbolsInScope( + { document: "/src/main.ts", position: pos }, + SymbolFlags.All, + ); + const names = symbols.map(s => s.name); + assert.ok(names.includes("innerValue"), "should include local value symbol"); + assert.ok(names.includes("OuterType"), "should include type symbol declared in file"); + } + finally { + api.close(); + } + }); }); describe("Symbol - getDocumentationComment and getJsDocTags", () => { diff --git a/tsc/internal/api/enum_values_generated.go b/tsc/internal/api/enum_values_generated.go new file mode 100644 index 0000000000000..8bb9d6ee6ddfb --- /dev/null +++ b/tsc/internal/api/enum_values_generated.go @@ -0,0 +1,977 @@ +//go:build ignore + +// Code generated by Herebyfile.mjs generate:enums. DO NOT EDIT. +// Running this program prints the real Go-evaluated value of every generated enum member as +// JSON, so generate:enums can validate that the TypeScript it emits agrees with Go's own +// arithmetic (catching, e.g., operator-precedence mistakes introduced by copying Go expression +// text into TypeScript verbatim). + +package main + +import ( + "encoding/json" + "os" + + ast "github.com/microsoft/TypeScript/tsc/internal/ast" + checker "github.com/microsoft/TypeScript/tsc/internal/checker" + compiler "github.com/microsoft/TypeScript/tsc/internal/compiler" + core "github.com/microsoft/TypeScript/tsc/internal/core" + diagnostics "github.com/microsoft/TypeScript/tsc/internal/diagnostics" + lsproto "github.com/microsoft/TypeScript/tsc/internal/lsp/lsproto" + nodebuilder "github.com/microsoft/TypeScript/tsc/internal/nodebuilder" + spanmap "github.com/microsoft/TypeScript/tsc/internal/spanmap" +) + +func main() { + values := map[string]map[string]int32{ + "SymbolFlags": { + "None": toInt32(ast.SymbolFlagsNone), + "FunctionScopedVariable": toInt32(ast.SymbolFlagsFunctionScopedVariable), + "BlockScopedVariable": toInt32(ast.SymbolFlagsBlockScopedVariable), + "Property": toInt32(ast.SymbolFlagsProperty), + "EnumMember": toInt32(ast.SymbolFlagsEnumMember), + "Function": toInt32(ast.SymbolFlagsFunction), + "Class": toInt32(ast.SymbolFlagsClass), + "Interface": toInt32(ast.SymbolFlagsInterface), + "ConstEnum": toInt32(ast.SymbolFlagsConstEnum), + "RegularEnum": toInt32(ast.SymbolFlagsRegularEnum), + "ValueModule": toInt32(ast.SymbolFlagsValueModule), + "NamespaceModule": toInt32(ast.SymbolFlagsNamespaceModule), + "TypeLiteral": toInt32(ast.SymbolFlagsTypeLiteral), + "ObjectLiteral": toInt32(ast.SymbolFlagsObjectLiteral), + "Method": toInt32(ast.SymbolFlagsMethod), + "Constructor": toInt32(ast.SymbolFlagsConstructor), + "GetAccessor": toInt32(ast.SymbolFlagsGetAccessor), + "SetAccessor": toInt32(ast.SymbolFlagsSetAccessor), + "Signature": toInt32(ast.SymbolFlagsSignature), + "TypeParameter": toInt32(ast.SymbolFlagsTypeParameter), + "TypeAlias": toInt32(ast.SymbolFlagsTypeAlias), + "ExportValue": toInt32(ast.SymbolFlagsExportValue), + "Alias": toInt32(ast.SymbolFlagsAlias), + "Prototype": toInt32(ast.SymbolFlagsPrototype), + "ExportStar": toInt32(ast.SymbolFlagsExportStar), + "Optional": toInt32(ast.SymbolFlagsOptional), + "Transient": toInt32(ast.SymbolFlagsTransient), + "Assignment": toInt32(ast.SymbolFlagsAssignment), + "ModuleExports": toInt32(ast.SymbolFlagsModuleExports), + "ConstEnumOnlyModule": toInt32(ast.SymbolFlagsConstEnumOnlyModule), + "ReplaceableByMethod": toInt32(ast.SymbolFlagsReplaceableByMethod), + "GlobalLookup": toInt32(ast.SymbolFlagsGlobalLookup), + "All": toInt32(ast.SymbolFlagsAll), + "Enum": toInt32(ast.SymbolFlagsEnum), + "Variable": toInt32(ast.SymbolFlagsVariable), + "Value": toInt32(ast.SymbolFlagsValue), + "Type": toInt32(ast.SymbolFlagsType), + "Namespace": toInt32(ast.SymbolFlagsNamespace), + "Module": toInt32(ast.SymbolFlagsModule), + "Accessor": toInt32(ast.SymbolFlagsAccessor), + "FunctionScopedVariableExcludes": toInt32(ast.SymbolFlagsFunctionScopedVariableExcludes), + "BlockScopedVariableExcludes": toInt32(ast.SymbolFlagsBlockScopedVariableExcludes), + "ParameterExcludes": toInt32(ast.SymbolFlagsParameterExcludes), + "PropertyExcludes": toInt32(ast.SymbolFlagsPropertyExcludes), + "EnumMemberExcludes": toInt32(ast.SymbolFlagsEnumMemberExcludes), + "FunctionExcludes": toInt32(ast.SymbolFlagsFunctionExcludes), + "ClassExcludes": toInt32(ast.SymbolFlagsClassExcludes), + "InterfaceExcludes": toInt32(ast.SymbolFlagsInterfaceExcludes), + "RegularEnumExcludes": toInt32(ast.SymbolFlagsRegularEnumExcludes), + "ConstEnumExcludes": toInt32(ast.SymbolFlagsConstEnumExcludes), + "ValueModuleExcludes": toInt32(ast.SymbolFlagsValueModuleExcludes), + "NamespaceModuleExcludes": toInt32(ast.SymbolFlagsNamespaceModuleExcludes), + "MethodExcludes": toInt32(ast.SymbolFlagsMethodExcludes), + "GetAccessorExcludes": toInt32(ast.SymbolFlagsGetAccessorExcludes), + "SetAccessorExcludes": toInt32(ast.SymbolFlagsSetAccessorExcludes), + "AccessorExcludes": toInt32(ast.SymbolFlagsAccessorExcludes), + "TypeParameterExcludes": toInt32(ast.SymbolFlagsTypeParameterExcludes), + "TypeAliasExcludes": toInt32(ast.SymbolFlagsTypeAliasExcludes), + "AliasExcludes": toInt32(ast.SymbolFlagsAliasExcludes), + "ModuleMember": toInt32(ast.SymbolFlagsModuleMember), + "ExportHasLocal": toInt32(ast.SymbolFlagsExportHasLocal), + "BlockScoped": toInt32(ast.SymbolFlagsBlockScoped), + "PropertyOrAccessor": toInt32(ast.SymbolFlagsPropertyOrAccessor), + "ClassMember": toInt32(ast.SymbolFlagsClassMember), + "ExportSupportsDefaultModifier": toInt32(ast.SymbolFlagsExportSupportsDefaultModifier), + "ExportDoesNotSupportDefaultModifier": toInt32(ast.SymbolFlagsExportDoesNotSupportDefaultModifier), + "LateBindingContainer": toInt32(ast.SymbolFlagsLateBindingContainer), + }, + "CheckFlags": { + "None": toInt32(ast.CheckFlagsNone), + "Instantiated": toInt32(ast.CheckFlagsInstantiated), + "SyntheticProperty": toInt32(ast.CheckFlagsSyntheticProperty), + "SyntheticMethod": toInt32(ast.CheckFlagsSyntheticMethod), + "Readonly": toInt32(ast.CheckFlagsReadonly), + "ReadPartial": toInt32(ast.CheckFlagsReadPartial), + "WritePartial": toInt32(ast.CheckFlagsWritePartial), + "HasNonUniformType": toInt32(ast.CheckFlagsHasNonUniformType), + "HasLiteralType": toInt32(ast.CheckFlagsHasLiteralType), + "ContainsPublic": toInt32(ast.CheckFlagsContainsPublic), + "ContainsProtected": toInt32(ast.CheckFlagsContainsProtected), + "ContainsPrivate": toInt32(ast.CheckFlagsContainsPrivate), + "ContainsStatic": toInt32(ast.CheckFlagsContainsStatic), + "Late": toInt32(ast.CheckFlagsLate), + "ReverseMapped": toInt32(ast.CheckFlagsReverseMapped), + "OptionalParameter": toInt32(ast.CheckFlagsOptionalParameter), + "RestParameter": toInt32(ast.CheckFlagsRestParameter), + "DeferredType": toInt32(ast.CheckFlagsDeferredType), + "HasNeverType": toInt32(ast.CheckFlagsHasNeverType), + "Mapped": toInt32(ast.CheckFlagsMapped), + "StripOptional": toInt32(ast.CheckFlagsStripOptional), + "Unresolved": toInt32(ast.CheckFlagsUnresolved), + "IsDiscriminantComputed": toInt32(ast.CheckFlagsIsDiscriminantComputed), + "IsDiscriminant": toInt32(ast.CheckFlagsIsDiscriminant), + "IndexSymbol": toInt32(ast.CheckFlagsIndexSymbol), + "Synthetic": toInt32(ast.CheckFlagsSynthetic), + "NonUniformAndLiteral": toInt32(ast.CheckFlagsNonUniformAndLiteral), + "Partial": toInt32(ast.CheckFlagsPartial), + }, + "TypeFlags": { + "None": toInt32(checker.TypeFlagsNone), + "Any": toInt32(checker.TypeFlagsAny), + "Unknown": toInt32(checker.TypeFlagsUnknown), + "Undefined": toInt32(checker.TypeFlagsUndefined), + "Null": toInt32(checker.TypeFlagsNull), + "Void": toInt32(checker.TypeFlagsVoid), + "String": toInt32(checker.TypeFlagsString), + "Number": toInt32(checker.TypeFlagsNumber), + "BigInt": toInt32(checker.TypeFlagsBigInt), + "Boolean": toInt32(checker.TypeFlagsBoolean), + "ESSymbol": toInt32(checker.TypeFlagsESSymbol), + "StringLiteral": toInt32(checker.TypeFlagsStringLiteral), + "NumberLiteral": toInt32(checker.TypeFlagsNumberLiteral), + "BigIntLiteral": toInt32(checker.TypeFlagsBigIntLiteral), + "BooleanLiteral": toInt32(checker.TypeFlagsBooleanLiteral), + "UniqueESSymbol": toInt32(checker.TypeFlagsUniqueESSymbol), + "EnumLiteral": toInt32(checker.TypeFlagsEnumLiteral), + "Enum": toInt32(checker.TypeFlagsEnum), + "NonPrimitive": toInt32(checker.TypeFlagsNonPrimitive), + "Never": toInt32(checker.TypeFlagsNever), + "TypeParameter": toInt32(checker.TypeFlagsTypeParameter), + "Object": toInt32(checker.TypeFlagsObject), + "Index": toInt32(checker.TypeFlagsIndex), + "TemplateLiteral": toInt32(checker.TypeFlagsTemplateLiteral), + "StringMapping": toInt32(checker.TypeFlagsStringMapping), + "Substitution": toInt32(checker.TypeFlagsSubstitution), + "IndexedAccess": toInt32(checker.TypeFlagsIndexedAccess), + "Conditional": toInt32(checker.TypeFlagsConditional), + "Union": toInt32(checker.TypeFlagsUnion), + "Intersection": toInt32(checker.TypeFlagsIntersection), + "Reserved1": toInt32(checker.TypeFlagsReserved1), + "Reserved2": toInt32(checker.TypeFlagsReserved2), + "Reserved3": toInt32(checker.TypeFlagsReserved3), + "AnyOrUnknown": toInt32(checker.TypeFlagsAnyOrUnknown), + "Nullable": toInt32(checker.TypeFlagsNullable), + "Literal": toInt32(checker.TypeFlagsLiteral), + "Unit": toInt32(checker.TypeFlagsUnit), + "Freshable": toInt32(checker.TypeFlagsFreshable), + "StringOrNumberLiteral": toInt32(checker.TypeFlagsStringOrNumberLiteral), + "StringOrNumberLiteralOrUnique": toInt32(checker.TypeFlagsStringOrNumberLiteralOrUnique), + "DefinitelyFalsy": toInt32(checker.TypeFlagsDefinitelyFalsy), + "PossiblyFalsy": toInt32(checker.TypeFlagsPossiblyFalsy), + "Intrinsic": toInt32(checker.TypeFlagsIntrinsic), + "StringLike": toInt32(checker.TypeFlagsStringLike), + "NumberLike": toInt32(checker.TypeFlagsNumberLike), + "BigIntLike": toInt32(checker.TypeFlagsBigIntLike), + "BooleanLike": toInt32(checker.TypeFlagsBooleanLike), + "EnumLike": toInt32(checker.TypeFlagsEnumLike), + "ESSymbolLike": toInt32(checker.TypeFlagsESSymbolLike), + "VoidLike": toInt32(checker.TypeFlagsVoidLike), + "Primitive": toInt32(checker.TypeFlagsPrimitive), + "DefinitelyNonNullable": toInt32(checker.TypeFlagsDefinitelyNonNullable), + "DisjointDomains": toInt32(checker.TypeFlagsDisjointDomains), + "UnionOrIntersection": toInt32(checker.TypeFlagsUnionOrIntersection), + "StructuredType": toInt32(checker.TypeFlagsStructuredType), + "TypeVariable": toInt32(checker.TypeFlagsTypeVariable), + "InstantiableNonPrimitive": toInt32(checker.TypeFlagsInstantiableNonPrimitive), + "InstantiablePrimitive": toInt32(checker.TypeFlagsInstantiablePrimitive), + "Instantiable": toInt32(checker.TypeFlagsInstantiable), + "StructuredOrInstantiable": toInt32(checker.TypeFlagsStructuredOrInstantiable), + "ObjectFlagsType": toInt32(checker.TypeFlagsObjectFlagsType), + "Simplifiable": toInt32(checker.TypeFlagsSimplifiable), + "Singleton": toInt32(checker.TypeFlagsSingleton), + "Narrowable": toInt32(checker.TypeFlagsNarrowable), + "IncludesMask": toInt32(checker.TypeFlagsIncludesMask), + "IncludesMissingType": toInt32(checker.TypeFlagsIncludesMissingType), + "IncludesNonWideningType": toInt32(checker.TypeFlagsIncludesNonWideningType), + "IncludesWildcard": toInt32(checker.TypeFlagsIncludesWildcard), + "IncludesEmptyObject": toInt32(checker.TypeFlagsIncludesEmptyObject), + "IncludesInstantiable": toInt32(checker.TypeFlagsIncludesInstantiable), + "IncludesConstrainedTypeVariable": toInt32(checker.TypeFlagsIncludesConstrainedTypeVariable), + "IncludesError": toInt32(checker.TypeFlagsIncludesError), + "NotPrimitiveUnion": toInt32(checker.TypeFlagsNotPrimitiveUnion), + }, + "ObjectFlags": { + "None": toInt32(checker.ObjectFlagsNone), + "Class": toInt32(checker.ObjectFlagsClass), + "Interface": toInt32(checker.ObjectFlagsInterface), + "Reference": toInt32(checker.ObjectFlagsReference), + "Tuple": toInt32(checker.ObjectFlagsTuple), + "Anonymous": toInt32(checker.ObjectFlagsAnonymous), + "Mapped": toInt32(checker.ObjectFlagsMapped), + "Instantiated": toInt32(checker.ObjectFlagsInstantiated), + "ObjectLiteral": toInt32(checker.ObjectFlagsObjectLiteral), + "EvolvingArray": toInt32(checker.ObjectFlagsEvolvingArray), + "ObjectLiteralPatternWithComputedProperties": toInt32(checker.ObjectFlagsObjectLiteralPatternWithComputedProperties), + "ReverseMapped": toInt32(checker.ObjectFlagsReverseMapped), + "JsxAttributes": toInt32(checker.ObjectFlagsJsxAttributes), + "JSLiteral": toInt32(checker.ObjectFlagsJSLiteral), + "FreshLiteral": toInt32(checker.ObjectFlagsFreshLiteral), + "ArrayLiteral": toInt32(checker.ObjectFlagsArrayLiteral), + "PrimitiveUnion": toInt32(checker.ObjectFlagsPrimitiveUnion), + "ContainsWideningType": toInt32(checker.ObjectFlagsContainsWideningType), + "ContainsObjectOrArrayLiteral": toInt32(checker.ObjectFlagsContainsObjectOrArrayLiteral), + "NonInferrableType": toInt32(checker.ObjectFlagsNonInferrableType), + "CouldContainTypeVariablesComputed": toInt32(checker.ObjectFlagsCouldContainTypeVariablesComputed), + "CouldContainTypeVariables": toInt32(checker.ObjectFlagsCouldContainTypeVariables), + "MembersResolved": toInt32(checker.ObjectFlagsMembersResolved), + "ClassOrInterface": toInt32(checker.ObjectFlagsClassOrInterface), + "RequiresWidening": toInt32(checker.ObjectFlagsRequiresWidening), + "PropagatingFlags": toInt32(checker.ObjectFlagsPropagatingFlags), + "InstantiatedMapped": toInt32(checker.ObjectFlagsInstantiatedMapped), + "InstantiationExpressionType": toInt32(checker.ObjectFlagsInstantiationExpressionType), + "SingleSignatureType": toInt32(checker.ObjectFlagsSingleSignatureType), + "ObjectTypeKindMask": toInt32(checker.ObjectFlagsObjectTypeKindMask), + "ContainsSpread": toInt32(checker.ObjectFlagsContainsSpread), + "ObjectRestType": toInt32(checker.ObjectFlagsObjectRestType), + "IsClassInstanceClone": toInt32(checker.ObjectFlagsIsClassInstanceClone), + "IdenticalBaseTypeCalculated": toInt32(checker.ObjectFlagsIdenticalBaseTypeCalculated), + "IdenticalBaseTypeExists": toInt32(checker.ObjectFlagsIdenticalBaseTypeExists), + "UnresolvedMembers": toInt32(checker.ObjectFlagsUnresolvedMembers), + "FromTypeNode": toInt32(checker.ObjectFlagsFromTypeNode), + "IsGenericTypeComputed": toInt32(checker.ObjectFlagsIsGenericTypeComputed), + "IsGenericObjectType": toInt32(checker.ObjectFlagsIsGenericObjectType), + "IsGenericIndexType": toInt32(checker.ObjectFlagsIsGenericIndexType), + "IsGenericType": toInt32(checker.ObjectFlagsIsGenericType), + "ContainsIntersections": toInt32(checker.ObjectFlagsContainsIntersections), + "IsUnknownLikeUnionComputed": toInt32(checker.ObjectFlagsIsUnknownLikeUnionComputed), + "IsUnknownLikeUnion": toInt32(checker.ObjectFlagsIsUnknownLikeUnion), + "IsUniformEnumComputed": toInt32(checker.ObjectFlagsIsUniformEnumComputed), + "IsUniformEnum": toInt32(checker.ObjectFlagsIsUniformEnum), + "IsNeverIntersectionComputed": toInt32(checker.ObjectFlagsIsNeverIntersectionComputed), + "IsNeverIntersection": toInt32(checker.ObjectFlagsIsNeverIntersection), + "IsConstrainedTypeVariable": toInt32(checker.ObjectFlagsIsConstrainedTypeVariable), + }, + "SignatureFlags": { + "None": toInt32(checker.SignatureFlagsNone), + "HasRestParameter": toInt32(checker.SignatureFlagsHasRestParameter), + "HasLiteralTypes": toInt32(checker.SignatureFlagsHasLiteralTypes), + "Construct": toInt32(checker.SignatureFlagsConstruct), + "Abstract": toInt32(checker.SignatureFlagsAbstract), + "IsInnerCallChain": toInt32(checker.SignatureFlagsIsInnerCallChain), + "IsOuterCallChain": toInt32(checker.SignatureFlagsIsOuterCallChain), + "IsUntypedSignatureInJSFile": toInt32(checker.SignatureFlagsIsUntypedSignatureInJSFile), + "IsNonInferrable": toInt32(checker.SignatureFlagsIsNonInferrable), + "IsSignatureCandidateForOverloadFailure": toInt32(checker.SignatureFlagsIsSignatureCandidateForOverloadFailure), + "PropagatingFlags": toInt32(checker.SignatureFlagsPropagatingFlags), + "CallChainFlags": toInt32(checker.SignatureFlagsCallChainFlags), + }, + "SignatureKind": { + "Call": toInt32(checker.SignatureKindCall), + "Construct": toInt32(checker.SignatureKindConstruct), + }, + "ElementFlags": { + "None": toInt32(checker.ElementFlagsNone), + "Required": toInt32(checker.ElementFlagsRequired), + "Optional": toInt32(checker.ElementFlagsOptional), + "Rest": toInt32(checker.ElementFlagsRest), + "Variadic": toInt32(checker.ElementFlagsVariadic), + "Fixed": toInt32(checker.ElementFlagsFixed), + "Variable": toInt32(checker.ElementFlagsVariable), + "NonRequired": toInt32(checker.ElementFlagsNonRequired), + "NonRest": toInt32(checker.ElementFlagsNonRest), + }, + "TypePredicateKind": { + "This": toInt32(checker.TypePredicateKindThis), + "Identifier": toInt32(checker.TypePredicateKindIdentifier), + "AssertsThis": toInt32(checker.TypePredicateKindAssertsThis), + "AssertsIdentifier": toInt32(checker.TypePredicateKindAssertsIdentifier), + }, + "DiagnosticCategory": { + "Warning": toInt32(diagnostics.CategoryWarning), + "Error": toInt32(diagnostics.CategoryError), + "Suggestion": toInt32(diagnostics.CategorySuggestion), + "Message": toInt32(diagnostics.CategoryMessage), + }, + "SyntaxKind": { + "Unknown": toInt32(ast.KindUnknown), + "EndOfFile": toInt32(ast.KindEndOfFile), + "SingleLineCommentTrivia": toInt32(ast.KindSingleLineCommentTrivia), + "MultiLineCommentTrivia": toInt32(ast.KindMultiLineCommentTrivia), + "NewLineTrivia": toInt32(ast.KindNewLineTrivia), + "WhitespaceTrivia": toInt32(ast.KindWhitespaceTrivia), + "ConflictMarkerTrivia": toInt32(ast.KindConflictMarkerTrivia), + "NonTextFileMarkerTrivia": toInt32(ast.KindNonTextFileMarkerTrivia), + "NumericLiteral": toInt32(ast.KindNumericLiteral), + "BigIntLiteral": toInt32(ast.KindBigIntLiteral), + "StringLiteral": toInt32(ast.KindStringLiteral), + "JsxText": toInt32(ast.KindJsxText), + "JsxTextAllWhiteSpaces": toInt32(ast.KindJsxTextAllWhiteSpaces), + "RegularExpressionLiteral": toInt32(ast.KindRegularExpressionLiteral), + "NoSubstitutionTemplateLiteral": toInt32(ast.KindNoSubstitutionTemplateLiteral), + "TemplateHead": toInt32(ast.KindTemplateHead), + "TemplateMiddle": toInt32(ast.KindTemplateMiddle), + "TemplateTail": toInt32(ast.KindTemplateTail), + "OpenBraceToken": toInt32(ast.KindOpenBraceToken), + "CloseBraceToken": toInt32(ast.KindCloseBraceToken), + "OpenParenToken": toInt32(ast.KindOpenParenToken), + "CloseParenToken": toInt32(ast.KindCloseParenToken), + "OpenBracketToken": toInt32(ast.KindOpenBracketToken), + "CloseBracketToken": toInt32(ast.KindCloseBracketToken), + "DotToken": toInt32(ast.KindDotToken), + "DotDotDotToken": toInt32(ast.KindDotDotDotToken), + "SemicolonToken": toInt32(ast.KindSemicolonToken), + "CommaToken": toInt32(ast.KindCommaToken), + "QuestionDotToken": toInt32(ast.KindQuestionDotToken), + "LessThanToken": toInt32(ast.KindLessThanToken), + "LessThanSlashToken": toInt32(ast.KindLessThanSlashToken), + "GreaterThanToken": toInt32(ast.KindGreaterThanToken), + "LessThanEqualsToken": toInt32(ast.KindLessThanEqualsToken), + "GreaterThanEqualsToken": toInt32(ast.KindGreaterThanEqualsToken), + "EqualsEqualsToken": toInt32(ast.KindEqualsEqualsToken), + "ExclamationEqualsToken": toInt32(ast.KindExclamationEqualsToken), + "EqualsEqualsEqualsToken": toInt32(ast.KindEqualsEqualsEqualsToken), + "ExclamationEqualsEqualsToken": toInt32(ast.KindExclamationEqualsEqualsToken), + "EqualsGreaterThanToken": toInt32(ast.KindEqualsGreaterThanToken), + "PlusToken": toInt32(ast.KindPlusToken), + "MinusToken": toInt32(ast.KindMinusToken), + "AsteriskToken": toInt32(ast.KindAsteriskToken), + "AsteriskAsteriskToken": toInt32(ast.KindAsteriskAsteriskToken), + "SlashToken": toInt32(ast.KindSlashToken), + "PercentToken": toInt32(ast.KindPercentToken), + "PlusPlusToken": toInt32(ast.KindPlusPlusToken), + "MinusMinusToken": toInt32(ast.KindMinusMinusToken), + "LessThanLessThanToken": toInt32(ast.KindLessThanLessThanToken), + "GreaterThanGreaterThanToken": toInt32(ast.KindGreaterThanGreaterThanToken), + "GreaterThanGreaterThanGreaterThanToken": toInt32(ast.KindGreaterThanGreaterThanGreaterThanToken), + "AmpersandToken": toInt32(ast.KindAmpersandToken), + "BarToken": toInt32(ast.KindBarToken), + "CaretToken": toInt32(ast.KindCaretToken), + "ExclamationToken": toInt32(ast.KindExclamationToken), + "TildeToken": toInt32(ast.KindTildeToken), + "AmpersandAmpersandToken": toInt32(ast.KindAmpersandAmpersandToken), + "BarBarToken": toInt32(ast.KindBarBarToken), + "QuestionToken": toInt32(ast.KindQuestionToken), + "ColonToken": toInt32(ast.KindColonToken), + "AtToken": toInt32(ast.KindAtToken), + "QuestionQuestionToken": toInt32(ast.KindQuestionQuestionToken), + "BacktickToken": toInt32(ast.KindBacktickToken), + "HashToken": toInt32(ast.KindHashToken), + "EqualsToken": toInt32(ast.KindEqualsToken), + "PlusEqualsToken": toInt32(ast.KindPlusEqualsToken), + "MinusEqualsToken": toInt32(ast.KindMinusEqualsToken), + "AsteriskEqualsToken": toInt32(ast.KindAsteriskEqualsToken), + "AsteriskAsteriskEqualsToken": toInt32(ast.KindAsteriskAsteriskEqualsToken), + "SlashEqualsToken": toInt32(ast.KindSlashEqualsToken), + "PercentEqualsToken": toInt32(ast.KindPercentEqualsToken), + "LessThanLessThanEqualsToken": toInt32(ast.KindLessThanLessThanEqualsToken), + "GreaterThanGreaterThanEqualsToken": toInt32(ast.KindGreaterThanGreaterThanEqualsToken), + "GreaterThanGreaterThanGreaterThanEqualsToken": toInt32(ast.KindGreaterThanGreaterThanGreaterThanEqualsToken), + "AmpersandEqualsToken": toInt32(ast.KindAmpersandEqualsToken), + "BarEqualsToken": toInt32(ast.KindBarEqualsToken), + "BarBarEqualsToken": toInt32(ast.KindBarBarEqualsToken), + "AmpersandAmpersandEqualsToken": toInt32(ast.KindAmpersandAmpersandEqualsToken), + "QuestionQuestionEqualsToken": toInt32(ast.KindQuestionQuestionEqualsToken), + "CaretEqualsToken": toInt32(ast.KindCaretEqualsToken), + "Identifier": toInt32(ast.KindIdentifier), + "PrivateIdentifier": toInt32(ast.KindPrivateIdentifier), + "JSDocCommentTextToken": toInt32(ast.KindJSDocCommentTextToken), + "BreakKeyword": toInt32(ast.KindBreakKeyword), + "CaseKeyword": toInt32(ast.KindCaseKeyword), + "CatchKeyword": toInt32(ast.KindCatchKeyword), + "ClassKeyword": toInt32(ast.KindClassKeyword), + "ConstKeyword": toInt32(ast.KindConstKeyword), + "ContinueKeyword": toInt32(ast.KindContinueKeyword), + "DebuggerKeyword": toInt32(ast.KindDebuggerKeyword), + "DefaultKeyword": toInt32(ast.KindDefaultKeyword), + "DeleteKeyword": toInt32(ast.KindDeleteKeyword), + "DoKeyword": toInt32(ast.KindDoKeyword), + "ElseKeyword": toInt32(ast.KindElseKeyword), + "EnumKeyword": toInt32(ast.KindEnumKeyword), + "ExportKeyword": toInt32(ast.KindExportKeyword), + "ExtendsKeyword": toInt32(ast.KindExtendsKeyword), + "FalseKeyword": toInt32(ast.KindFalseKeyword), + "FinallyKeyword": toInt32(ast.KindFinallyKeyword), + "ForKeyword": toInt32(ast.KindForKeyword), + "FunctionKeyword": toInt32(ast.KindFunctionKeyword), + "IfKeyword": toInt32(ast.KindIfKeyword), + "ImportKeyword": toInt32(ast.KindImportKeyword), + "InKeyword": toInt32(ast.KindInKeyword), + "InstanceOfKeyword": toInt32(ast.KindInstanceOfKeyword), + "NewKeyword": toInt32(ast.KindNewKeyword), + "NullKeyword": toInt32(ast.KindNullKeyword), + "ReturnKeyword": toInt32(ast.KindReturnKeyword), + "SuperKeyword": toInt32(ast.KindSuperKeyword), + "SwitchKeyword": toInt32(ast.KindSwitchKeyword), + "ThisKeyword": toInt32(ast.KindThisKeyword), + "ThrowKeyword": toInt32(ast.KindThrowKeyword), + "TrueKeyword": toInt32(ast.KindTrueKeyword), + "TryKeyword": toInt32(ast.KindTryKeyword), + "TypeOfKeyword": toInt32(ast.KindTypeOfKeyword), + "VarKeyword": toInt32(ast.KindVarKeyword), + "VoidKeyword": toInt32(ast.KindVoidKeyword), + "WhileKeyword": toInt32(ast.KindWhileKeyword), + "WithKeyword": toInt32(ast.KindWithKeyword), + "ImplementsKeyword": toInt32(ast.KindImplementsKeyword), + "InterfaceKeyword": toInt32(ast.KindInterfaceKeyword), + "LetKeyword": toInt32(ast.KindLetKeyword), + "PackageKeyword": toInt32(ast.KindPackageKeyword), + "PrivateKeyword": toInt32(ast.KindPrivateKeyword), + "ProtectedKeyword": toInt32(ast.KindProtectedKeyword), + "PublicKeyword": toInt32(ast.KindPublicKeyword), + "StaticKeyword": toInt32(ast.KindStaticKeyword), + "YieldKeyword": toInt32(ast.KindYieldKeyword), + "AbstractKeyword": toInt32(ast.KindAbstractKeyword), + "AccessorKeyword": toInt32(ast.KindAccessorKeyword), + "AsKeyword": toInt32(ast.KindAsKeyword), + "AssertsKeyword": toInt32(ast.KindAssertsKeyword), + "AssertKeyword": toInt32(ast.KindAssertKeyword), + "AnyKeyword": toInt32(ast.KindAnyKeyword), + "AsyncKeyword": toInt32(ast.KindAsyncKeyword), + "AwaitKeyword": toInt32(ast.KindAwaitKeyword), + "BooleanKeyword": toInt32(ast.KindBooleanKeyword), + "ConstructorKeyword": toInt32(ast.KindConstructorKeyword), + "DeclareKeyword": toInt32(ast.KindDeclareKeyword), + "GetKeyword": toInt32(ast.KindGetKeyword), + "ImmediateKeyword": toInt32(ast.KindImmediateKeyword), + "InferKeyword": toInt32(ast.KindInferKeyword), + "IntrinsicKeyword": toInt32(ast.KindIntrinsicKeyword), + "IsKeyword": toInt32(ast.KindIsKeyword), + "KeyOfKeyword": toInt32(ast.KindKeyOfKeyword), + "ModuleKeyword": toInt32(ast.KindModuleKeyword), + "NamespaceKeyword": toInt32(ast.KindNamespaceKeyword), + "NeverKeyword": toInt32(ast.KindNeverKeyword), + "OutKeyword": toInt32(ast.KindOutKeyword), + "ReadonlyKeyword": toInt32(ast.KindReadonlyKeyword), + "RequireKeyword": toInt32(ast.KindRequireKeyword), + "NumberKeyword": toInt32(ast.KindNumberKeyword), + "ObjectKeyword": toInt32(ast.KindObjectKeyword), + "SatisfiesKeyword": toInt32(ast.KindSatisfiesKeyword), + "SetKeyword": toInt32(ast.KindSetKeyword), + "StringKeyword": toInt32(ast.KindStringKeyword), + "SymbolKeyword": toInt32(ast.KindSymbolKeyword), + "TypeKeyword": toInt32(ast.KindTypeKeyword), + "UndefinedKeyword": toInt32(ast.KindUndefinedKeyword), + "UniqueKeyword": toInt32(ast.KindUniqueKeyword), + "UnknownKeyword": toInt32(ast.KindUnknownKeyword), + "UsingKeyword": toInt32(ast.KindUsingKeyword), + "FromKeyword": toInt32(ast.KindFromKeyword), + "GlobalKeyword": toInt32(ast.KindGlobalKeyword), + "BigIntKeyword": toInt32(ast.KindBigIntKeyword), + "OverrideKeyword": toInt32(ast.KindOverrideKeyword), + "OfKeyword": toInt32(ast.KindOfKeyword), + "DeferKeyword": toInt32(ast.KindDeferKeyword), + "QualifiedName": toInt32(ast.KindQualifiedName), + "ComputedPropertyName": toInt32(ast.KindComputedPropertyName), + "TypeParameter": toInt32(ast.KindTypeParameter), + "Parameter": toInt32(ast.KindParameter), + "Decorator": toInt32(ast.KindDecorator), + "PropertySignature": toInt32(ast.KindPropertySignature), + "PropertyDeclaration": toInt32(ast.KindPropertyDeclaration), + "MethodSignature": toInt32(ast.KindMethodSignature), + "MethodDeclaration": toInt32(ast.KindMethodDeclaration), + "ClassStaticBlockDeclaration": toInt32(ast.KindClassStaticBlockDeclaration), + "Constructor": toInt32(ast.KindConstructor), + "GetAccessor": toInt32(ast.KindGetAccessor), + "SetAccessor": toInt32(ast.KindSetAccessor), + "CallSignature": toInt32(ast.KindCallSignature), + "ConstructSignature": toInt32(ast.KindConstructSignature), + "IndexSignature": toInt32(ast.KindIndexSignature), + "TypePredicate": toInt32(ast.KindTypePredicate), + "TypeReference": toInt32(ast.KindTypeReference), + "FunctionType": toInt32(ast.KindFunctionType), + "ConstructorType": toInt32(ast.KindConstructorType), + "TypeQuery": toInt32(ast.KindTypeQuery), + "TypeLiteral": toInt32(ast.KindTypeLiteral), + "ArrayType": toInt32(ast.KindArrayType), + "TupleType": toInt32(ast.KindTupleType), + "OptionalType": toInt32(ast.KindOptionalType), + "RestType": toInt32(ast.KindRestType), + "UnionType": toInt32(ast.KindUnionType), + "IntersectionType": toInt32(ast.KindIntersectionType), + "ConditionalType": toInt32(ast.KindConditionalType), + "InferType": toInt32(ast.KindInferType), + "ParenthesizedType": toInt32(ast.KindParenthesizedType), + "ThisType": toInt32(ast.KindThisType), + "TypeOperator": toInt32(ast.KindTypeOperator), + "IndexedAccessType": toInt32(ast.KindIndexedAccessType), + "MappedType": toInt32(ast.KindMappedType), + "LiteralType": toInt32(ast.KindLiteralType), + "NamedTupleMember": toInt32(ast.KindNamedTupleMember), + "TemplateLiteralType": toInt32(ast.KindTemplateLiteralType), + "TemplateLiteralTypeSpan": toInt32(ast.KindTemplateLiteralTypeSpan), + "ImportType": toInt32(ast.KindImportType), + "ObjectBindingPattern": toInt32(ast.KindObjectBindingPattern), + "ArrayBindingPattern": toInt32(ast.KindArrayBindingPattern), + "BindingElement": toInt32(ast.KindBindingElement), + "ArrayLiteralExpression": toInt32(ast.KindArrayLiteralExpression), + "ObjectLiteralExpression": toInt32(ast.KindObjectLiteralExpression), + "PropertyAccessExpression": toInt32(ast.KindPropertyAccessExpression), + "ElementAccessExpression": toInt32(ast.KindElementAccessExpression), + "CallExpression": toInt32(ast.KindCallExpression), + "NewExpression": toInt32(ast.KindNewExpression), + "TaggedTemplateExpression": toInt32(ast.KindTaggedTemplateExpression), + "TypeAssertionExpression": toInt32(ast.KindTypeAssertionExpression), + "ParenthesizedExpression": toInt32(ast.KindParenthesizedExpression), + "FunctionExpression": toInt32(ast.KindFunctionExpression), + "ArrowFunction": toInt32(ast.KindArrowFunction), + "DeleteExpression": toInt32(ast.KindDeleteExpression), + "TypeOfExpression": toInt32(ast.KindTypeOfExpression), + "VoidExpression": toInt32(ast.KindVoidExpression), + "AwaitExpression": toInt32(ast.KindAwaitExpression), + "PrefixUnaryExpression": toInt32(ast.KindPrefixUnaryExpression), + "PostfixUnaryExpression": toInt32(ast.KindPostfixUnaryExpression), + "BinaryExpression": toInt32(ast.KindBinaryExpression), + "ConditionalExpression": toInt32(ast.KindConditionalExpression), + "TemplateExpression": toInt32(ast.KindTemplateExpression), + "YieldExpression": toInt32(ast.KindYieldExpression), + "SpreadElement": toInt32(ast.KindSpreadElement), + "ClassExpression": toInt32(ast.KindClassExpression), + "OmittedExpression": toInt32(ast.KindOmittedExpression), + "ExpressionWithTypeArguments": toInt32(ast.KindExpressionWithTypeArguments), + "AsExpression": toInt32(ast.KindAsExpression), + "NonNullExpression": toInt32(ast.KindNonNullExpression), + "MetaProperty": toInt32(ast.KindMetaProperty), + "SyntheticExpression": toInt32(ast.KindSyntheticExpression), + "SatisfiesExpression": toInt32(ast.KindSatisfiesExpression), + "TemplateSpan": toInt32(ast.KindTemplateSpan), + "SemicolonClassElement": toInt32(ast.KindSemicolonClassElement), + "Block": toInt32(ast.KindBlock), + "EmptyStatement": toInt32(ast.KindEmptyStatement), + "VariableStatement": toInt32(ast.KindVariableStatement), + "ExpressionStatement": toInt32(ast.KindExpressionStatement), + "IfStatement": toInt32(ast.KindIfStatement), + "DoStatement": toInt32(ast.KindDoStatement), + "WhileStatement": toInt32(ast.KindWhileStatement), + "ForStatement": toInt32(ast.KindForStatement), + "ForInStatement": toInt32(ast.KindForInStatement), + "ForOfStatement": toInt32(ast.KindForOfStatement), + "ContinueStatement": toInt32(ast.KindContinueStatement), + "BreakStatement": toInt32(ast.KindBreakStatement), + "ReturnStatement": toInt32(ast.KindReturnStatement), + "WithStatement": toInt32(ast.KindWithStatement), + "SwitchStatement": toInt32(ast.KindSwitchStatement), + "LabeledStatement": toInt32(ast.KindLabeledStatement), + "ThrowStatement": toInt32(ast.KindThrowStatement), + "TryStatement": toInt32(ast.KindTryStatement), + "DebuggerStatement": toInt32(ast.KindDebuggerStatement), + "VariableDeclaration": toInt32(ast.KindVariableDeclaration), + "VariableDeclarationList": toInt32(ast.KindVariableDeclarationList), + "FunctionDeclaration": toInt32(ast.KindFunctionDeclaration), + "ClassDeclaration": toInt32(ast.KindClassDeclaration), + "InterfaceDeclaration": toInt32(ast.KindInterfaceDeclaration), + "TypeAliasDeclaration": toInt32(ast.KindTypeAliasDeclaration), + "EnumDeclaration": toInt32(ast.KindEnumDeclaration), + "ModuleDeclaration": toInt32(ast.KindModuleDeclaration), + "ModuleBlock": toInt32(ast.KindModuleBlock), + "CaseBlock": toInt32(ast.KindCaseBlock), + "NamespaceExportDeclaration": toInt32(ast.KindNamespaceExportDeclaration), + "ImportEqualsDeclaration": toInt32(ast.KindImportEqualsDeclaration), + "ImportDeclaration": toInt32(ast.KindImportDeclaration), + "ImportClause": toInt32(ast.KindImportClause), + "NamespaceImport": toInt32(ast.KindNamespaceImport), + "NamedImports": toInt32(ast.KindNamedImports), + "ImportSpecifier": toInt32(ast.KindImportSpecifier), + "ExportAssignment": toInt32(ast.KindExportAssignment), + "ExportDeclaration": toInt32(ast.KindExportDeclaration), + "NamedExports": toInt32(ast.KindNamedExports), + "NamespaceExport": toInt32(ast.KindNamespaceExport), + "ExportSpecifier": toInt32(ast.KindExportSpecifier), + "MissingDeclaration": toInt32(ast.KindMissingDeclaration), + "ExternalModuleReference": toInt32(ast.KindExternalModuleReference), + "JsxElement": toInt32(ast.KindJsxElement), + "JsxSelfClosingElement": toInt32(ast.KindJsxSelfClosingElement), + "JsxOpeningElement": toInt32(ast.KindJsxOpeningElement), + "JsxClosingElement": toInt32(ast.KindJsxClosingElement), + "JsxFragment": toInt32(ast.KindJsxFragment), + "JsxOpeningFragment": toInt32(ast.KindJsxOpeningFragment), + "JsxClosingFragment": toInt32(ast.KindJsxClosingFragment), + "JsxAttribute": toInt32(ast.KindJsxAttribute), + "JsxAttributes": toInt32(ast.KindJsxAttributes), + "JsxSpreadAttribute": toInt32(ast.KindJsxSpreadAttribute), + "JsxExpression": toInt32(ast.KindJsxExpression), + "JsxNamespacedName": toInt32(ast.KindJsxNamespacedName), + "CaseClause": toInt32(ast.KindCaseClause), + "DefaultClause": toInt32(ast.KindDefaultClause), + "HeritageClause": toInt32(ast.KindHeritageClause), + "CatchClause": toInt32(ast.KindCatchClause), + "ImportAttributes": toInt32(ast.KindImportAttributes), + "ImportAttribute": toInt32(ast.KindImportAttribute), + "PropertyAssignment": toInt32(ast.KindPropertyAssignment), + "ShorthandPropertyAssignment": toInt32(ast.KindShorthandPropertyAssignment), + "SpreadAssignment": toInt32(ast.KindSpreadAssignment), + "EnumMember": toInt32(ast.KindEnumMember), + "SourceFile": toInt32(ast.KindSourceFile), + "JSDocTypeExpression": toInt32(ast.KindJSDocTypeExpression), + "JSDocNameReference": toInt32(ast.KindJSDocNameReference), + "JSDocAllType": toInt32(ast.KindJSDocAllType), + "JSDocNullableType": toInt32(ast.KindJSDocNullableType), + "JSDocNonNullableType": toInt32(ast.KindJSDocNonNullableType), + "JSDocOptionalType": toInt32(ast.KindJSDocOptionalType), + "JSDocVariadicType": toInt32(ast.KindJSDocVariadicType), + "JSDoc": toInt32(ast.KindJSDoc), + "JSDocText": toInt32(ast.KindJSDocText), + "JSDocTypeLiteral": toInt32(ast.KindJSDocTypeLiteral), + "JSDocSignature": toInt32(ast.KindJSDocSignature), + "JSDocLink": toInt32(ast.KindJSDocLink), + "JSDocLinkCode": toInt32(ast.KindJSDocLinkCode), + "JSDocLinkPlain": toInt32(ast.KindJSDocLinkPlain), + "JSDocUnknownTag": toInt32(ast.KindJSDocUnknownTag), + "JSDocAugmentsTag": toInt32(ast.KindJSDocAugmentsTag), + "JSDocImplementsTag": toInt32(ast.KindJSDocImplementsTag), + "JSDocDeprecatedTag": toInt32(ast.KindJSDocDeprecatedTag), + "JSDocPublicTag": toInt32(ast.KindJSDocPublicTag), + "JSDocPrivateTag": toInt32(ast.KindJSDocPrivateTag), + "JSDocProtectedTag": toInt32(ast.KindJSDocProtectedTag), + "JSDocReadonlyTag": toInt32(ast.KindJSDocReadonlyTag), + "JSDocOverrideTag": toInt32(ast.KindJSDocOverrideTag), + "JSDocCallbackTag": toInt32(ast.KindJSDocCallbackTag), + "JSDocOverloadTag": toInt32(ast.KindJSDocOverloadTag), + "JSDocParameterTag": toInt32(ast.KindJSDocParameterTag), + "JSDocReturnTag": toInt32(ast.KindJSDocReturnTag), + "JSDocThisTag": toInt32(ast.KindJSDocThisTag), + "JSDocTypeTag": toInt32(ast.KindJSDocTypeTag), + "JSDocTemplateTag": toInt32(ast.KindJSDocTemplateTag), + "JSDocTypedefTag": toInt32(ast.KindJSDocTypedefTag), + "JSDocSeeTag": toInt32(ast.KindJSDocSeeTag), + "JSDocPropertyTag": toInt32(ast.KindJSDocPropertyTag), + "JSDocThrowsTag": toInt32(ast.KindJSDocThrowsTag), + "JSDocSatisfiesTag": toInt32(ast.KindJSDocSatisfiesTag), + "JSDocImportTag": toInt32(ast.KindJSDocImportTag), + "SyntaxList": toInt32(ast.KindSyntaxList), + "JSTypeAliasDeclaration": toInt32(ast.KindJSTypeAliasDeclaration), + "JSImportDeclaration": toInt32(ast.KindJSImportDeclaration), + "NotEmittedStatement": toInt32(ast.KindNotEmittedStatement), + "PartiallyEmittedExpression": toInt32(ast.KindPartiallyEmittedExpression), + "SyntheticReferenceExpression": toInt32(ast.KindSyntheticReferenceExpression), + "NotEmittedTypeElement": toInt32(ast.KindNotEmittedTypeElement), + "Count": toInt32(ast.KindCount), + "FirstAssignment": toInt32(ast.KindFirstAssignment), + "LastAssignment": toInt32(ast.KindLastAssignment), + "FirstCompoundAssignment": toInt32(ast.KindFirstCompoundAssignment), + "LastCompoundAssignment": toInt32(ast.KindLastCompoundAssignment), + "FirstReservedWord": toInt32(ast.KindFirstReservedWord), + "LastReservedWord": toInt32(ast.KindLastReservedWord), + "FirstKeyword": toInt32(ast.KindFirstKeyword), + "LastKeyword": toInt32(ast.KindLastKeyword), + "FirstFutureReservedWord": toInt32(ast.KindFirstFutureReservedWord), + "LastFutureReservedWord": toInt32(ast.KindLastFutureReservedWord), + "FirstTypeNode": toInt32(ast.KindFirstTypeNode), + "LastTypeNode": toInt32(ast.KindLastTypeNode), + "FirstPunctuation": toInt32(ast.KindFirstPunctuation), + "LastPunctuation": toInt32(ast.KindLastPunctuation), + "FirstToken": toInt32(ast.KindFirstToken), + "LastToken": toInt32(ast.KindLastToken), + "FirstLiteralToken": toInt32(ast.KindFirstLiteralToken), + "LastLiteralToken": toInt32(ast.KindLastLiteralToken), + "FirstTemplateToken": toInt32(ast.KindFirstTemplateToken), + "LastTemplateToken": toInt32(ast.KindLastTemplateToken), + "FirstBinaryOperator": toInt32(ast.KindFirstBinaryOperator), + "LastBinaryOperator": toInt32(ast.KindLastBinaryOperator), + "FirstStatement": toInt32(ast.KindFirstStatement), + "LastStatement": toInt32(ast.KindLastStatement), + "FirstNode": toInt32(ast.KindFirstNode), + "FirstJSDocNode": toInt32(ast.KindFirstJSDocNode), + "LastJSDocNode": toInt32(ast.KindLastJSDocNode), + "FirstJSDocTagNode": toInt32(ast.KindFirstJSDocTagNode), + "LastJSDocTagNode": toInt32(ast.KindLastJSDocTagNode), + "FirstContextualKeyword": toInt32(ast.KindFirstContextualKeyword), + "LastContextualKeyword": toInt32(ast.KindLastContextualKeyword), + "LastUnaryOperator": toInt32(ast.KindLastUnaryOperator), + "FirstTriviaToken": toInt32(ast.KindFirstTriviaToken), + "LastTriviaToken": toInt32(ast.KindLastTriviaToken), + }, + "NodeFlags": { + "None": toInt32(ast.NodeFlagsNone), + "Let": toInt32(ast.NodeFlagsLet), + "Const": toInt32(ast.NodeFlagsConst), + "Using": toInt32(ast.NodeFlagsUsing), + "Reparsed": toInt32(ast.NodeFlagsReparsed), + "Synthesized": toInt32(ast.NodeFlagsSynthesized), + "OptionalChain": toInt32(ast.NodeFlagsOptionalChain), + "ExportContext": toInt32(ast.NodeFlagsExportContext), + "ContainsThis": toInt32(ast.NodeFlagsContainsThis), + "HasImplicitReturn": toInt32(ast.NodeFlagsHasImplicitReturn), + "HasExplicitReturn": toInt32(ast.NodeFlagsHasExplicitReturn), + "DisallowInContext": toInt32(ast.NodeFlagsDisallowInContext), + "YieldContext": toInt32(ast.NodeFlagsYieldContext), + "DecoratorContext": toInt32(ast.NodeFlagsDecoratorContext), + "AwaitContext": toInt32(ast.NodeFlagsAwaitContext), + "DisallowConditionalTypesContext": toInt32(ast.NodeFlagsDisallowConditionalTypesContext), + "ThisNodeHasError": toInt32(ast.NodeFlagsThisNodeHasError), + "JavaScriptFile": toInt32(ast.NodeFlagsJavaScriptFile), + "ThisNodeOrAnySubNodesHasError": toInt32(ast.NodeFlagsThisNodeOrAnySubNodesHasError), + "HasAsyncFunctions": toInt32(ast.NodeFlagsHasAsyncFunctions), + "PossiblyContainsDynamicImport": toInt32(ast.NodeFlagsPossiblyContainsDynamicImport), + "PossiblyContainsImportMeta": toInt32(ast.NodeFlagsPossiblyContainsImportMeta), + "HasJSDoc": toInt32(ast.NodeFlagsHasJSDoc), + "JSDoc": toInt32(ast.NodeFlagsJSDoc), + "Ambient": toInt32(ast.NodeFlagsAmbient), + "InWithStatement": toInt32(ast.NodeFlagsInWithStatement), + "JsonFile": toInt32(ast.NodeFlagsJsonFile), + "PossiblyContainsDeprecatedTag": toInt32(ast.NodeFlagsPossiblyContainsDeprecatedTag), + "Unreachable": toInt32(ast.NodeFlagsUnreachable), + "ReparserTransformedLiteral": toInt32(ast.NodeFlagsReparserTransformedLiteral), + "BlockScoped": toInt32(ast.NodeFlagsBlockScoped), + "Constant": toInt32(ast.NodeFlagsConstant), + "AwaitUsing": toInt32(ast.NodeFlagsAwaitUsing), + "ReachabilityCheckFlags": toInt32(ast.NodeFlagsReachabilityCheckFlags), + "ReachabilityAndEmitFlags": toInt32(ast.NodeFlagsReachabilityAndEmitFlags), + "ContextFlags": toInt32(ast.NodeFlagsContextFlags), + "TypeExcludesFlags": toInt32(ast.NodeFlagsTypeExcludesFlags), + "PermanentlySetIncrementalFlags": toInt32(ast.NodeFlagsPermanentlySetIncrementalFlags), + "IdentifierHasExtendedUnicodeEscape": toInt32(ast.NodeFlagsIdentifierHasExtendedUnicodeEscape), + "IdentifierIsInJSDocNamespace": toInt32(ast.NodeFlagsIdentifierIsInJSDocNamespace), + "NestedNamespace": toInt32(ast.NodeFlagsNestedNamespace), + }, + "OuterExpressionKinds": { + "Parentheses": toInt32(ast.OEKParentheses), + "TypeAssertions": toInt32(ast.OEKTypeAssertions), + "NonNullAssertions": toInt32(ast.OEKNonNullAssertions), + "PartiallyEmittedExpressions": toInt32(ast.OEKPartiallyEmittedExpressions), + "ExpressionsWithTypeArguments": toInt32(ast.OEKExpressionsWithTypeArguments), + "Satisfies": toInt32(ast.OEKSatisfies), + "ExcludeJSDocTypeAssertion": toInt32(ast.OEKExcludeJSDocTypeAssertion), + "Assignments": toInt32(ast.OEKAssignments), + "Comma": toInt32(ast.OEKComma), + "Assertions": toInt32(ast.OEKAssertions), + "All": toInt32(ast.OEKAll), + "AllExceptAssertionsOrExpressionsWithTypeArguments": toInt32(ast.OEKAllExceptAssertionsOrExpressionsWithTypeArguments), + "ExpressionTypePassthrough": toInt32(ast.OEKExpressionTypePassthrough), + }, + "ModifierFlags": { + "None": toInt32(ast.ModifierFlagsNone), + "Public": toInt32(ast.ModifierFlagsPublic), + "Private": toInt32(ast.ModifierFlagsPrivate), + "Protected": toInt32(ast.ModifierFlagsProtected), + "Readonly": toInt32(ast.ModifierFlagsReadonly), + "Override": toInt32(ast.ModifierFlagsOverride), + "Export": toInt32(ast.ModifierFlagsExport), + "Abstract": toInt32(ast.ModifierFlagsAbstract), + "Ambient": toInt32(ast.ModifierFlagsAmbient), + "Static": toInt32(ast.ModifierFlagsStatic), + "Accessor": toInt32(ast.ModifierFlagsAccessor), + "Async": toInt32(ast.ModifierFlagsAsync), + "Default": toInt32(ast.ModifierFlagsDefault), + "Const": toInt32(ast.ModifierFlagsConst), + "In": toInt32(ast.ModifierFlagsIn), + "Out": toInt32(ast.ModifierFlagsOut), + "Decorator": toInt32(ast.ModifierFlagsDecorator), + "Deprecated": toInt32(ast.ModifierFlagsDeprecated), + "JSDocPublic": toInt32(ast.ModifierFlagsJSDocPublic), + "JSDocPrivate": toInt32(ast.ModifierFlagsJSDocPrivate), + "JSDocProtected": toInt32(ast.ModifierFlagsJSDocProtected), + "JSDocReadonly": toInt32(ast.ModifierFlagsJSDocReadonly), + "JSDocOverride": toInt32(ast.ModifierFlagsJSDocOverride), + "HasComputedJSDocModifiers": toInt32(ast.ModifierFlagsHasComputedJSDocModifiers), + "HasComputedFlags": toInt32(ast.ModifierFlagsHasComputedFlags), + "SyntacticOrJSDocModifiers": toInt32(ast.ModifierFlagsSyntacticOrJSDocModifiers), + "SyntacticOnlyModifiers": toInt32(ast.ModifierFlagsSyntacticOnlyModifiers), + "SyntacticModifiers": toInt32(ast.ModifierFlagsSyntacticModifiers), + "JSDocCacheOnlyModifiers": toInt32(ast.ModifierFlagsJSDocCacheOnlyModifiers), + "JSDocOnlyModifiers": toInt32(ast.ModifierFlagsJSDocOnlyModifiers), + "NonCacheOnlyModifiers": toInt32(ast.ModifierFlagsNonCacheOnlyModifiers), + "AccessibilityModifier": toInt32(ast.ModifierFlagsAccessibilityModifier), + "ParameterPropertyModifier": toInt32(ast.ModifierFlagsParameterPropertyModifier), + "NonPublicAccessibilityModifier": toInt32(ast.ModifierFlagsNonPublicAccessibilityModifier), + "TypeScriptModifier": toInt32(ast.ModifierFlagsTypeScriptModifier), + "ExportDefault": toInt32(ast.ModifierFlagsExportDefault), + "All": toInt32(ast.ModifierFlagsAll), + "Modifier": toInt32(ast.ModifierFlagsModifier), + "JavaScript": toInt32(ast.ModifierFlagsJavaScript), + }, + "ModuleKind": { + "None": toInt32(core.ModuleKindNone), + "CommonJS": toInt32(core.ModuleKindCommonJS), + "AMD": toInt32(core.ModuleKindAMD), + "UMD": toInt32(core.ModuleKindUMD), + "System": toInt32(core.ModuleKindSystem), + "ES2015": toInt32(core.ModuleKindES2015), + "ES2020": toInt32(core.ModuleKindES2020), + "ES2022": toInt32(core.ModuleKindES2022), + "ESNext": toInt32(core.ModuleKindESNext), + "Node16": toInt32(core.ModuleKindNode16), + "Node18": toInt32(core.ModuleKindNode18), + "Node20": toInt32(core.ModuleKindNode20), + "NodeNext": toInt32(core.ModuleKindNodeNext), + "Preserve": toInt32(core.ModuleKindPreserve), + }, + "ModuleResolutionKind": { + "Unknown": toInt32(core.ModuleResolutionKindUnknown), + "Classic": toInt32(core.ModuleResolutionKindClassic), + "Node10": toInt32(core.ModuleResolutionKindNode10), + "Node16": toInt32(core.ModuleResolutionKindNode16), + "NodeNext": toInt32(core.ModuleResolutionKindNodeNext), + "Bundler": toInt32(core.ModuleResolutionKindBundler), + }, + "ModuleDetectionKind": { + "None": toInt32(core.ModuleDetectionKindNone), + "Auto": toInt32(core.ModuleDetectionKindAuto), + "Legacy": toInt32(core.ModuleDetectionKindLegacy), + "Force": toInt32(core.ModuleDetectionKindForce), + }, + "NewLineKind": { + "None": toInt32(core.NewLineKindNone), + "CRLF": toInt32(core.NewLineKindCRLF), + "LF": toInt32(core.NewLineKindLF), + }, + "JsxEmit": { + "None": toInt32(core.JsxEmitNone), + "Preserve": toInt32(core.JsxEmitPreserve), + "ReactNative": toInt32(core.JsxEmitReactNative), + "React": toInt32(core.JsxEmitReact), + "ReactJSX": toInt32(core.JsxEmitReactJSX), + "ReactJSXDev": toInt32(core.JsxEmitReactJSXDev), + }, + "ScriptKind": { + "Unknown": toInt32(core.ScriptKindUnknown), + "JS": toInt32(core.ScriptKindJS), + "JSX": toInt32(core.ScriptKindJSX), + "TS": toInt32(core.ScriptKindTS), + "TSX": toInt32(core.ScriptKindTSX), + "JSON": toInt32(core.ScriptKindJSON), + }, + "TokenFlags": { + "None": toInt32(ast.TokenFlagsNone), + "PrecedingLineBreak": toInt32(ast.TokenFlagsPrecedingLineBreak), + "PrecedingJSDocComment": toInt32(ast.TokenFlagsPrecedingJSDocComment), + "Unterminated": toInt32(ast.TokenFlagsUnterminated), + "ExtendedUnicodeEscape": toInt32(ast.TokenFlagsExtendedUnicodeEscape), + "Scientific": toInt32(ast.TokenFlagsScientific), + "Octal": toInt32(ast.TokenFlagsOctal), + "HexSpecifier": toInt32(ast.TokenFlagsHexSpecifier), + "BinarySpecifier": toInt32(ast.TokenFlagsBinarySpecifier), + "OctalSpecifier": toInt32(ast.TokenFlagsOctalSpecifier), + "ContainsSeparator": toInt32(ast.TokenFlagsContainsSeparator), + "UnicodeEscape": toInt32(ast.TokenFlagsUnicodeEscape), + "ContainsInvalidEscape": toInt32(ast.TokenFlagsContainsInvalidEscape), + "HexEscape": toInt32(ast.TokenFlagsHexEscape), + "ContainsLeadingZero": toInt32(ast.TokenFlagsContainsLeadingZero), + "ContainsInvalidSeparator": toInt32(ast.TokenFlagsContainsInvalidSeparator), + "PrecedingJSDocLeadingAsterisks": toInt32(ast.TokenFlagsPrecedingJSDocLeadingAsterisks), + "SingleQuote": toInt32(ast.TokenFlagsSingleQuote), + "PrecedingJSDocWithDeprecated": toInt32(ast.TokenFlagsPrecedingJSDocWithDeprecated), + "PrecedingJSDocWithSeeOrLink": toInt32(ast.TokenFlagsPrecedingJSDocWithSeeOrLink), + "BinaryOrOctalSpecifier": toInt32(ast.TokenFlagsBinaryOrOctalSpecifier), + "WithSpecifier": toInt32(ast.TokenFlagsWithSpecifier), + "StringLiteralFlags": toInt32(ast.TokenFlagsStringLiteralFlags), + "NumericLiteralFlags": toInt32(ast.TokenFlagsNumericLiteralFlags), + "TemplateLiteralLikeFlags": toInt32(ast.TokenFlagsTemplateLiteralLikeFlags), + "RegularExpressionLiteralFlags": toInt32(ast.TokenFlagsRegularExpressionLiteralFlags), + "IsInvalid": toInt32(ast.TokenFlagsIsInvalid), + }, + "DiagnosticDirectivePolicy": { + "Ignore": toInt32(ast.MappedDiagnosticDirectivePolicyIgnore), + "Expect": toInt32(ast.MappedDiagnosticDirectivePolicyExpect), + }, + "SpanMapKind": { + "Verbatim": toInt32(spanmap.KindVerbatim), + "Atom": toInt32(spanmap.KindAtom), + "Alias": toInt32(spanmap.KindAlias), + }, + "SpanMapFidelity": { + "Exact": toInt32(spanmap.FidelityExact), + "Atom": toInt32(spanmap.FidelityAtom), + "Approximate": toInt32(spanmap.FidelityApproximate), + "None": toInt32(spanmap.FidelityNone), + }, + "SpanMapFeature": { + "Hover": toInt32(spanmap.FeatureHover), + "SignatureHelp": toInt32(spanmap.FeatureSignatureHelp), + "Completion": toInt32(spanmap.FeatureCompletion), + "Definition": toInt32(spanmap.FeatureDefinition), + "TypeDefinition": toInt32(spanmap.FeatureTypeDefinition), + "Implementation": toInt32(spanmap.FeatureImplementation), + "References": toInt32(spanmap.FeatureReferences), + "DocumentHighlights": toInt32(spanmap.FeatureDocumentHighlights), + "Rename": toInt32(spanmap.FeatureRename), + "CallHierarchy": toInt32(spanmap.FeatureCallHierarchy), + "CodeActions": toInt32(spanmap.FeatureCodeActions), + "Formatting": toInt32(spanmap.FeatureFormatting), + "InlayHints": toInt32(spanmap.FeatureInlayHints), + "SemanticTokens": toInt32(spanmap.FeatureSemanticTokens), + "FoldingRanges": toInt32(spanmap.FeatureFoldingRanges), + "SelectionRanges": toInt32(spanmap.FeatureSelectionRanges), + "LinkedEditing": toInt32(spanmap.FeatureLinkedEditing), + "AutoInsert": toInt32(spanmap.FeatureAutoInsert), + "DocumentSymbols": toInt32(spanmap.FeatureDocumentSymbols), + "CodeLens": toInt32(spanmap.FeatureCodeLens), + "None": toInt32(spanmap.FeatureNone), + "All": toInt32(spanmap.FeatureAll), + }, + "NodeBuilderFlags": { + "None": toInt32(nodebuilder.FlagsNone), + "NoTruncation": toInt32(nodebuilder.FlagsNoTruncation), + "WriteArrayAsGenericType": toInt32(nodebuilder.FlagsWriteArrayAsGenericType), + "GenerateNamesForShadowedTypeParams": toInt32(nodebuilder.FlagsGenerateNamesForShadowedTypeParams), + "UseStructuralFallback": toInt32(nodebuilder.FlagsUseStructuralFallback), + "ForbidIndexedAccessSymbolReferences": toInt32(nodebuilder.FlagsForbidIndexedAccessSymbolReferences), + "WriteTypeArgumentsOfSignature": toInt32(nodebuilder.FlagsWriteTypeArgumentsOfSignature), + "UseFullyQualifiedType": toInt32(nodebuilder.FlagsUseFullyQualifiedType), + "UseOnlyExternalAliasing": toInt32(nodebuilder.FlagsUseOnlyExternalAliasing), + "SuppressAnyReturnType": toInt32(nodebuilder.FlagsSuppressAnyReturnType), + "WriteTypeParametersInQualifiedName": toInt32(nodebuilder.FlagsWriteTypeParametersInQualifiedName), + "MultilineObjectLiterals": toInt32(nodebuilder.FlagsMultilineObjectLiterals), + "WriteClassExpressionAsTypeLiteral": toInt32(nodebuilder.FlagsWriteClassExpressionAsTypeLiteral), + "UseTypeOfFunction": toInt32(nodebuilder.FlagsUseTypeOfFunction), + "OmitParameterModifiers": toInt32(nodebuilder.FlagsOmitParameterModifiers), + "UseAliasDefinedOutsideCurrentScope": toInt32(nodebuilder.FlagsUseAliasDefinedOutsideCurrentScope), + "UseSingleQuotesForStringLiteralType": toInt32(nodebuilder.FlagsUseSingleQuotesForStringLiteralType), + "NoTypeReduction": toInt32(nodebuilder.FlagsNoTypeReduction), + "UseInstantiationExpressions": toInt32(nodebuilder.FlagsUseInstantiationExpressions), + "OmitThisParameter": toInt32(nodebuilder.FlagsOmitThisParameter), + "WriteCallStyleSignature": toInt32(nodebuilder.FlagsWriteCallStyleSignature), + "AllowThisInObjectLiteral": toInt32(nodebuilder.FlagsAllowThisInObjectLiteral), + "AllowQualifiedNameInPlaceOfIdentifier": toInt32(nodebuilder.FlagsAllowQualifiedNameInPlaceOfIdentifier), + "AllowAnonymousIdentifier": toInt32(nodebuilder.FlagsAllowAnonymousIdentifier), + "AllowEmptyUnionOrIntersection": toInt32(nodebuilder.FlagsAllowEmptyUnionOrIntersection), + "AllowEmptyTuple": toInt32(nodebuilder.FlagsAllowEmptyTuple), + "AllowUniqueESSymbolType": toInt32(nodebuilder.FlagsAllowUniqueESSymbolType), + "AllowEmptyIndexInfoType": toInt32(nodebuilder.FlagsAllowEmptyIndexInfoType), + "AllowNodeModulesRelativePaths": toInt32(nodebuilder.FlagsAllowNodeModulesRelativePaths), + "IgnoreErrors": toInt32(nodebuilder.FlagsIgnoreErrors), + "InObjectTypeLiteral": toInt32(nodebuilder.FlagsInObjectTypeLiteral), + "InTypeAlias": toInt32(nodebuilder.FlagsInTypeAlias), + "InInitialEntityName": toInt32(nodebuilder.FlagsInInitialEntityName), + }, + "CompletionItemKind": { + "Text": toInt32(lsproto.CompletionItemKindText), + "Method": toInt32(lsproto.CompletionItemKindMethod), + "Function": toInt32(lsproto.CompletionItemKindFunction), + "Constructor": toInt32(lsproto.CompletionItemKindConstructor), + "Field": toInt32(lsproto.CompletionItemKindField), + "Variable": toInt32(lsproto.CompletionItemKindVariable), + "Class": toInt32(lsproto.CompletionItemKindClass), + "Interface": toInt32(lsproto.CompletionItemKindInterface), + "Module": toInt32(lsproto.CompletionItemKindModule), + "Property": toInt32(lsproto.CompletionItemKindProperty), + "Unit": toInt32(lsproto.CompletionItemKindUnit), + "Value": toInt32(lsproto.CompletionItemKindValue), + "Enum": toInt32(lsproto.CompletionItemKindEnum), + "Keyword": toInt32(lsproto.CompletionItemKindKeyword), + "Snippet": toInt32(lsproto.CompletionItemKindSnippet), + "Color": toInt32(lsproto.CompletionItemKindColor), + "File": toInt32(lsproto.CompletionItemKindFile), + "Reference": toInt32(lsproto.CompletionItemKindReference), + "Folder": toInt32(lsproto.CompletionItemKindFolder), + "EnumMember": toInt32(lsproto.CompletionItemKindEnumMember), + "Constant": toInt32(lsproto.CompletionItemKindConstant), + "Struct": toInt32(lsproto.CompletionItemKindStruct), + "Event": toInt32(lsproto.CompletionItemKindEvent), + "Operator": toInt32(lsproto.CompletionItemKindOperator), + "TypeParameter": toInt32(lsproto.CompletionItemKindTypeParameter), + }, + "EmitOnly": { + "All": toInt32(compiler.EmitAll), + "OnlyJs": toInt32(compiler.EmitOnlyJs), + "OnlyDts": toInt32(compiler.EmitOnlyDts), + }, + } + if err := json.NewEncoder(os.Stdout).Encode(values); err != nil { + panic(err) + } +} + +// A generic function call (unlike a constant conversion) forces Go to evaluate the conversion at +// runtime, truncating uint32-backed flags with a leading bitwise-not the same way JS's 32-bit +// bitwise operators would, instead of rejecting "constant overflows int32" at compile time. +func toInt32[T ~int8 | ~int16 | ~int32 | ~int | ~uint8 | ~uint16 | ~uint32](v T) int32 { + return int32(v) +} diff --git a/tsc/internal/ast/symbolflags.go b/tsc/internal/ast/symbolflags.go index 0a66285a13ab1..12170d1d2b6e7 100644 --- a/tsc/internal/ast/symbolflags.go +++ b/tsc/internal/ast/symbolflags.go @@ -36,8 +36,8 @@ const ( SymbolFlagsModuleExports SymbolFlags = 1 << 27 // Symbol for CommonJS `module` of `module.exports` SymbolFlagsConstEnumOnlyModule SymbolFlags = 1 << 28 // Module contains only const enums or other modules with only const enums SymbolFlagsReplaceableByMethod SymbolFlags = 1 << 29 - SymbolFlagsGlobalLookup SymbolFlags = 1 << 30 // Flag to signal this is a global lookup - SymbolFlagsAll SymbolFlags = 1<<30 - 1 // All flags except SymbolFlagsGlobalLookup + SymbolFlagsGlobalLookup SymbolFlags = 1 << 30 // Flag to signal this is a global lookup + SymbolFlagsAll SymbolFlags = (1 << 30) - 1 // All flags except SymbolFlagsGlobalLookup. Do not remove () they are needed when the expression is copied to TS. SymbolFlagsEnum = SymbolFlagsRegularEnum | SymbolFlagsConstEnum SymbolFlagsVariable = SymbolFlagsFunctionScopedVariable | SymbolFlagsBlockScopedVariable