UNPKG

create-next-flask

Version:
1 lines 230 kB
{"version":3,"sources":["../src/index.ts","../src/comments.ts","../src/tokens.ts","../src/compilerOptions.ts","../src/flags.ts","../src/modifiers.ts","../src/nodes/access.ts","../src/syntax.ts","../src/nodes/typeGuards/compound.ts","../src/nodes/typeGuards/single.ts","../src/nodes/typeGuards/union.ts","../src/utils.ts","../src/scopes.ts","../src/types/getters.ts","../src/types/typeGuards/intrinsic.ts","../src/types/typeGuards/objects.ts","../src/types/typeGuards/single.ts","../src/types/typeGuards/compound.ts","../src/types/typeGuards/literal.ts","../src/types/utilities.ts","../src/nodes/utilities.ts","../src/usage/UsageWalker.ts","../src/usage/Scope.ts","../src/usage/declarations.ts","../src/usage/utils.ts","../src/usage/getPropertyName.ts","../src/usage/getUsageDomain.ts","../src/usage/scopes.ts","../src/usage/collectVariableUsage.ts"],"sourcesContent":["export * from \"./comments\";\nexport * from \"./compilerOptions\";\nexport * from \"./flags\";\nexport * from \"./modifiers\";\nexport * from \"./nodes\";\nexport * from \"./scopes\";\nexport * from \"./syntax\";\nexport * from \"./tokens\";\nexport * from \"./types\";\nexport * from \"./usage\";\n","// Code largely based on https://github.com/ajafff/tsutils\n// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE\n\nimport ts from \"typescript\";\n\nimport { forEachToken } from \"./tokens\";\n\n/**\n * Exclude trailing positions that would lead to scanning for trivia inside `JsxText`.\n * @internal\n */\nfunction canHaveTrailingTrivia(token: ts.Node): boolean {\n\tswitch (token.kind) {\n\t\tcase ts.SyntaxKind.CloseBraceToken:\n\t\t\t// after a JsxExpression inside a JsxElement's body can only be other JsxChild, but no trivia\n\t\t\treturn (\n\t\t\t\ttoken.parent.kind !== ts.SyntaxKind.JsxExpression ||\n\t\t\t\t!isJsxElementOrFragment(token.parent.parent)\n\t\t\t);\n\t\tcase ts.SyntaxKind.GreaterThanToken:\n\t\t\tswitch (token.parent.kind) {\n\t\t\t\tcase ts.SyntaxKind.JsxOpeningElement:\n\t\t\t\t\t// if end is not equal, this is part of the type arguments list. in all other cases it would be inside the element body\n\t\t\t\t\treturn token.end !== token.parent.end;\n\t\t\t\tcase ts.SyntaxKind.JsxOpeningFragment:\n\t\t\t\t\treturn false; // would be inside the fragment\n\t\t\t\tcase ts.SyntaxKind.JsxSelfClosingElement:\n\t\t\t\t\treturn (\n\t\t\t\t\t\ttoken.end !== token.parent.end || // if end is not equal, this is part of the type arguments list\n\t\t\t\t\t\t!isJsxElementOrFragment(token.parent.parent)\n\t\t\t\t\t); // there's only trailing trivia if it's the end of the top element\n\t\t\t\tcase ts.SyntaxKind.JsxClosingElement:\n\t\t\t\tcase ts.SyntaxKind.JsxClosingFragment:\n\t\t\t\t\t// there's only trailing trivia if it's the end of the top element\n\t\t\t\t\treturn !isJsxElementOrFragment(token.parent.parent.parent);\n\t\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Test if a node is a `JsxElement` or `JsxFragment`.\n * @internal\n */\nfunction isJsxElementOrFragment(\n\tnode: ts.Node,\n): node is ts.JsxElement | ts.JsxFragment {\n\treturn (\n\t\tnode.kind === ts.SyntaxKind.JsxElement ||\n\t\tnode.kind === ts.SyntaxKind.JsxFragment\n\t);\n}\n\n/**\n * Callback type used for {@link forEachComment}.\n * @category Callbacks\n */\nexport type ForEachCommentCallback = (\n\tfullText: string,\n\tcomment: ts.CommentRange,\n) => void;\n\n/**\n * Iterates over all comments owned by `node` or its children.\n * @category Nodes - Other Utilities\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * forEachComment(node, (fullText, comment) => {\n * console.log(`Found comment at position ${comment.pos}: '${fullText}'.`);\n * });\n * ```\n */\nexport function forEachComment(\n\tnode: ts.Node,\n\tcallback: ForEachCommentCallback,\n\tsourceFile: ts.SourceFile = node.getSourceFile(),\n): void {\n\t/* Visit all tokens and skip trivia.\n Comment ranges between tokens are parsed without the need of a scanner.\n forEachTokenWithWhitespace does intentionally not pay attention to the correct comment ownership of nodes as it always\n scans all trivia before each token, which could include trailing comments of the previous token.\n Comment ownership is done right in this function*/\n\tconst fullText = sourceFile.text;\n\tconst notJsx = sourceFile.languageVariant !== ts.LanguageVariant.JSX;\n\treturn forEachToken(\n\t\tnode,\n\t\t(token) => {\n\t\t\tif (token.pos === token.end) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (token.kind !== ts.SyntaxKind.JsxText) {\n\t\t\t\tts.forEachLeadingCommentRange(\n\t\t\t\t\tfullText,\n\t\t\t\t\t// skip shebang at position 0\n\t\t\t\t\ttoken.pos === 0 ? (ts.getShebang(fullText) ?? \"\").length : token.pos,\n\t\t\t\t\tcommentCallback,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (notJsx || canHaveTrailingTrivia(token)) {\n\t\t\t\treturn ts.forEachTrailingCommentRange(\n\t\t\t\t\tfullText,\n\t\t\t\t\ttoken.end,\n\t\t\t\t\tcommentCallback,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\tsourceFile,\n\t);\n\tfunction commentCallback(pos: number, end: number, kind: ts.CommentKind) {\n\t\tcallback(fullText, { end, kind, pos });\n\t}\n}\n","// Code largely based on ajafff/tsutils:\n// https://github.com/ajafff/tsutils/blob/03b4df15d14702f9c7a128ac3fae77171778d613/util/util.ts\n// Original license MIT:\n// https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE\n\nimport ts from \"typescript\";\n\n/**\n * Callback type used for {@link forEachToken}.\n * @category Callbacks\n */\nexport type ForEachTokenCallback = (token: ts.Node) => void;\n\n/**\n * Iterates over all tokens of `node`\n * @category Nodes - Other Utilities\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * forEachToken(node, (token) => {\n * \tconsole.log(\"Found token:\", token.getText());\n * });\n * ```\n * @param node - The node whose tokens should be visited\n * @param callback - Is called for every token contained in `node`\n */\nexport function forEachToken(\n\tnode: ts.Node,\n\tcallback: ForEachTokenCallback,\n\tsourceFile: ts.SourceFile = node.getSourceFile(),\n): void {\n\tconst queue = [];\n\twhile (true) {\n\t\tif (ts.isTokenKind(node.kind)) {\n\t\t\tcallback(node);\n\t\t} else if (\n\t\t\t// eslint-disable-next-line deprecation/deprecation -- need for support of TS < 4.7\n\t\t\tnode.kind !== ts.SyntaxKind.JSDocComment\n\t\t) {\n\t\t\tconst children = node.getChildren(sourceFile);\n\t\t\tif (children.length === 1) {\n\t\t\t\tnode = children[0];\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// add children in reverse order, when we pop the next element from the queue, it's the first child\n\t\t\tfor (let i = children.length - 1; i >= 0; --i) {\n\t\t\t\tqueue.push(children[i]);\n\t\t\t}\n\t\t}\n\n\t\tif (queue.length === 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\tnode = queue.pop()!;\n\t}\n}\n","// Code largely based on https://github.com/ajafff/tsutils\n// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE\n\nimport ts from \"typescript\";\n\n/**\n * An option that can be tested with {@link isCompilerOptionEnabled}.\n * @category Compiler Options\n */\nexport type BooleanCompilerOptions = keyof {\n\t[K in keyof ts.CompilerOptions as NonNullable<\n\t\tts.CompilerOptions[K]\n\t> extends boolean\n\t\t? K\n\t\t: never]: unknown;\n};\n\n/**\n * Checks if a given compiler option is enabled.\n * It handles dependencies of options, e.g. `declaration` is implicitly enabled by `composite` or `strictNullChecks` is enabled by `strict`.\n * However, it does not check dependencies that are already checked and reported as errors, e.g. `checkJs` without `allowJs`.\n * This function only handles boolean flags.\n * @category Compiler Options\n * @example\n * ```ts\n * const options = {\n * \tallowJs: true,\n * };\n *\n * isCompilerOptionEnabled(options, \"allowJs\"); // true\n * isCompilerOptionEnabled(options, \"allowSyntheticDefaultImports\"); // false\n * ```\n */\nexport function isCompilerOptionEnabled(\n\toptions: ts.CompilerOptions,\n\toption: BooleanCompilerOptions,\n): boolean {\n\tswitch (option) {\n\t\tcase \"stripInternal\":\n\t\tcase \"declarationMap\":\n\t\tcase \"emitDeclarationOnly\":\n\t\t\treturn (\n\t\t\t\toptions[option] === true &&\n\t\t\t\tisCompilerOptionEnabled(options, \"declaration\")\n\t\t\t);\n\t\tcase \"declaration\":\n\t\t\treturn (\n\t\t\t\toptions.declaration || isCompilerOptionEnabled(options, \"composite\")\n\t\t\t);\n\t\tcase \"incremental\":\n\t\t\treturn options.incremental === undefined\n\t\t\t\t? isCompilerOptionEnabled(options, \"composite\")\n\t\t\t\t: options.incremental;\n\t\tcase \"skipDefaultLibCheck\":\n\t\t\treturn (\n\t\t\t\toptions.skipDefaultLibCheck ||\n\t\t\t\tisCompilerOptionEnabled(options, \"skipLibCheck\")\n\t\t\t);\n\t\tcase \"suppressImplicitAnyIndexErrors\":\n\t\t\treturn (\n\t\t\t\toptions.suppressImplicitAnyIndexErrors === true &&\n\t\t\t\tisCompilerOptionEnabled(options, \"noImplicitAny\")\n\t\t\t);\n\t\tcase \"allowSyntheticDefaultImports\":\n\t\t\treturn options.allowSyntheticDefaultImports !== undefined\n\t\t\t\t? options.allowSyntheticDefaultImports\n\t\t\t\t: isCompilerOptionEnabled(options, \"esModuleInterop\") ||\n\t\t\t\t\t\toptions.module === ts.ModuleKind.System;\n\t\tcase \"noUncheckedIndexedAccess\":\n\t\t\treturn (\n\t\t\t\toptions.noUncheckedIndexedAccess === true &&\n\t\t\t\tisCompilerOptionEnabled(options, \"strictNullChecks\")\n\t\t\t);\n\t\tcase \"allowJs\":\n\t\t\treturn options.allowJs === undefined\n\t\t\t\t? isCompilerOptionEnabled(options, \"checkJs\")\n\t\t\t\t: options.allowJs;\n\t\tcase \"noImplicitAny\":\n\t\tcase \"noImplicitThis\":\n\t\tcase \"strictNullChecks\":\n\t\tcase \"strictFunctionTypes\":\n\t\tcase \"strictPropertyInitialization\":\n\t\tcase \"alwaysStrict\":\n\t\tcase \"strictBindCallApply\":\n\t\t\ttype AssertEqual<T, U extends T> = U; // make sure all strict options are handled here\n\t\t\treturn isStrictCompilerOptionEnabled(\n\t\t\t\toptions,\n\t\t\t\toption as AssertEqual<typeof option, StrictCompilerOption>,\n\t\t\t);\n\t}\n\n\treturn options[option] === true;\n}\n\n/**\n * An option that can be tested with {@link isStrictCompilerOptionEnabled}.\n * @category Compiler Options\n */\nexport type StrictCompilerOption =\n\t| \"alwaysStrict\"\n\t| \"noImplicitAny\"\n\t| \"noImplicitThis\"\n\t| \"strictBindCallApply\"\n\t| \"strictFunctionTypes\"\n\t| \"strictNullChecks\"\n\t| \"strictPropertyInitialization\";\n\n/**\n * Checks if a given compiler option is enabled, accounting for whether all flags\n * (except `strictPropertyInitialization`) have been enabled by `strict: true`.\n * @category Compiler Options\n * @example\n * ```ts\n * const optionsLenient = {\n * \tnoImplicitAny: true,\n * };\n *\n * isStrictCompilerOptionEnabled(optionsLenient, \"noImplicitAny\"); // true\n * isStrictCompilerOptionEnabled(optionsLenient, \"noImplicitThis\"); // false\n * ```\n * @example\n * ```ts\n * const optionsStrict = {\n * \tnoImplicitThis: false,\n * \tstrict: true,\n * };\n *\n * isStrictCompilerOptionEnabled(optionsStrict, \"noImplicitAny\"); // true\n * isStrictCompilerOptionEnabled(optionsStrict, \"noImplicitThis\"); // false\n * ```\n */\nexport function isStrictCompilerOptionEnabled(\n\toptions: ts.CompilerOptions,\n\toption: StrictCompilerOption,\n): boolean {\n\treturn (\n\t\t(options.strict ? options[option] !== false : options[option] === true) &&\n\t\t(option !== \"strictPropertyInitialization\" ||\n\t\t\tisStrictCompilerOptionEnabled(options, \"strictNullChecks\"))\n\t);\n}\n","// Code largely based on https://github.com/ajafff/tsutils\n// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE\n\nimport ts from \"typescript\";\n\n/**\n * Test if the given flag is set on the combined flags.\n * @internal\n */\nfunction isFlagSet(allFlags: number, flag: number): boolean {\n\treturn (allFlags & flag) !== 0;\n}\n\n/**\n * Test if the given flag is set on the given object.\n * @internal\n */\nfunction isFlagSetOnObject(obj: { flags: number }, flag: number): boolean {\n\treturn isFlagSet(obj.flags, flag);\n}\n\n/**\n * Test if the given node has the given `ModifierFlags` set.\n * @category Nodes - Flag Utilities\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isModifierFlagSet(node, ts.ModifierFlags.Abstract)) {\n * // ...\n * }\n * ```\n */\nexport function isModifierFlagSet(\n\tnode: ts.Declaration,\n\tflag: ts.ModifierFlags,\n): boolean {\n\treturn isFlagSet(ts.getCombinedModifierFlags(node), flag);\n}\n\n/**\n * Test if the given node has the given `NodeFlags` set.\n * @category Nodes - Flag Utilities\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isNodeFlagSet(node, ts.NodeFlags.AwaitContext)) {\n * // ...\n * }\n * ```\n */\nexport const isNodeFlagSet: (node: ts.Node, flag: ts.NodeFlags) => boolean =\n\tisFlagSetOnObject;\n\n/**\n * Test if the given node has the given `ObjectFlags` set.\n * @category Nodes - Flag Utilities\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isObjectFlagSet(node, ts.ObjectFlags.Anonymous)) {\n * // ...\n * }\n * ```\n */\nexport function isObjectFlagSet(\n\tobjectType: ts.ObjectType,\n\tflag: ts.ObjectFlags,\n): boolean {\n\treturn isFlagSet(objectType.objectFlags, flag);\n}\n\n/**\n * Test if the given node has the given `SymbolFlags` set.\n * @category Nodes - Flag Utilities\n * @example\n * ```ts\n * declare const symbol: ts.Symbol;\n *\n * if (isSymbolFlagSet(symbol, ts.SymbolFlags.Accessor)) {\n * // ...\n * }\n * ```\n */\nexport const isSymbolFlagSet: (\n\tsymbol: ts.Symbol,\n\tflag: ts.SymbolFlags,\n) => boolean = isFlagSetOnObject;\n\n/**\n * Test if the given node has the given `TypeFlags` set.\n * @category Nodes - Flag Utilities\n * @example\n * ```ts\n * declare const type: ts.Type;\n *\n * if (isTypeFlagSet(type, ts.TypeFlags.Any)) {\n * // ...\n * }\n * ```\n */\nexport const isTypeFlagSet: (type: ts.Type, flag: ts.TypeFlags) => boolean =\n\tisFlagSetOnObject;\n","// Code largely based on https://github.com/ajafff/tsutils\n// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE\n\nimport ts from \"typescript\";\n\n/**\n * Test if the given iterable includes a modifier of any of the given kinds.\n * @category Modifier Utilities\n * @example\n * ```ts\n * declare const modifiers: ts.Modifier[];\n *\n * includesModifier(modifiers, ts.SyntaxKind.AbstractKeyword);\n * ```\n */\nexport function includesModifier(\n\tmodifiers: Iterable<ts.ModifierLike> | undefined,\n\t...kinds: ts.ModifierSyntaxKind[]\n): boolean {\n\tif (modifiers === undefined) {\n\t\treturn false;\n\t}\n\n\tfor (const modifier of modifiers) {\n\t\tif (kinds.includes(modifier.kind as ts.ModifierSyntaxKind)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n","// Code largely based on https://github.com/ajafff/tsutils\n// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE\n\nimport ts from \"typescript\";\n\nimport { isAssignmentKind } from \"../syntax\";\n\n/* eslint-disable perfectionist/sort-enums */\n/**\n * What operations(s), if any, an expression applies.\n */\nexport enum AccessKind {\n\tNone = 0,\n\tRead = 1 << 0,\n\tWrite = 1 << 1,\n\tDelete = 1 << 2,\n\tReadWrite = Read | Write,\n\t/* eslint-enable perfectionist/sort-enums */\n}\n\n/**\n * Determines which operation(s), if any, an expression applies.\n * @example\n * ```ts\n * declare const node: ts.Expression;\n *\n * if (getAccessKind(node).Write & AccessKind.Write) !== 0) {\n * // this is a reassignment (write)\n * }\n * ```\n */\nexport function getAccessKind(node: ts.Expression): AccessKind {\n\tconst parent = node.parent;\n\tswitch (parent.kind) {\n\t\tcase ts.SyntaxKind.DeleteExpression:\n\t\t\treturn AccessKind.Delete;\n\t\tcase ts.SyntaxKind.PostfixUnaryExpression:\n\t\t\treturn AccessKind.ReadWrite;\n\t\tcase ts.SyntaxKind.PrefixUnaryExpression:\n\t\t\treturn (parent as ts.PrefixUnaryExpression).operator ===\n\t\t\t\tts.SyntaxKind.PlusPlusToken ||\n\t\t\t\t(parent as ts.PrefixUnaryExpression).operator ===\n\t\t\t\t\tts.SyntaxKind.MinusMinusToken\n\t\t\t\t? AccessKind.ReadWrite\n\t\t\t\t: AccessKind.Read;\n\t\tcase ts.SyntaxKind.BinaryExpression:\n\t\t\treturn (parent as ts.BinaryExpression).right === node\n\t\t\t\t? AccessKind.Read\n\t\t\t\t: !isAssignmentKind((parent as ts.BinaryExpression).operatorToken.kind)\n\t\t\t\t\t? AccessKind.Read\n\t\t\t\t\t: (parent as ts.BinaryExpression).operatorToken.kind ===\n\t\t\t\t\t\t ts.SyntaxKind.EqualsToken\n\t\t\t\t\t\t? AccessKind.Write\n\t\t\t\t\t\t: AccessKind.ReadWrite;\n\t\tcase ts.SyntaxKind.ShorthandPropertyAssignment:\n\t\t\treturn (parent as ts.ShorthandPropertyAssignment)\n\t\t\t\t.objectAssignmentInitializer === node\n\t\t\t\t? AccessKind.Read\n\t\t\t\t: isInDestructuringAssignment(parent as ts.ShorthandPropertyAssignment)\n\t\t\t\t\t? AccessKind.Write\n\t\t\t\t\t: AccessKind.Read;\n\t\tcase ts.SyntaxKind.PropertyAssignment:\n\t\t\treturn (parent as ts.PropertyAssignment).name === node\n\t\t\t\t? AccessKind.None\n\t\t\t\t: isInDestructuringAssignment(parent as ts.PropertyAssignment)\n\t\t\t\t\t? AccessKind.Write\n\t\t\t\t\t: AccessKind.Read;\n\t\tcase ts.SyntaxKind.ArrayLiteralExpression:\n\t\tcase ts.SyntaxKind.SpreadElement:\n\t\tcase ts.SyntaxKind.SpreadAssignment:\n\t\t\treturn isInDestructuringAssignment(\n\t\t\t\tparent as\n\t\t\t\t\t| ts.ArrayLiteralExpression\n\t\t\t\t\t| ts.SpreadAssignment\n\t\t\t\t\t| ts.SpreadElement,\n\t\t\t)\n\t\t\t\t? AccessKind.Write\n\t\t\t\t: AccessKind.Read;\n\t\tcase ts.SyntaxKind.ParenthesizedExpression:\n\t\tcase ts.SyntaxKind.NonNullExpression:\n\t\tcase ts.SyntaxKind.TypeAssertionExpression:\n\t\tcase ts.SyntaxKind.AsExpression:\n\t\t\t// (<number>foo! as {})++\n\t\t\treturn getAccessKind(parent as ts.Expression);\n\t\tcase ts.SyntaxKind.ForOfStatement:\n\t\tcase ts.SyntaxKind.ForInStatement:\n\t\t\treturn (parent as ts.ForInOrOfStatement).initializer === node\n\t\t\t\t? AccessKind.Write\n\t\t\t\t: AccessKind.Read;\n\t\tcase ts.SyntaxKind.ExpressionWithTypeArguments:\n\t\t\treturn (\n\t\t\t\t(parent as ts.ExpressionWithTypeArguments).parent as ts.HeritageClause\n\t\t\t).token === ts.SyntaxKind.ExtendsKeyword &&\n\t\t\t\tparent.parent.parent.kind !== ts.SyntaxKind.InterfaceDeclaration\n\t\t\t\t? AccessKind.Read\n\t\t\t\t: AccessKind.None;\n\t\tcase ts.SyntaxKind.ComputedPropertyName:\n\t\tcase ts.SyntaxKind.ExpressionStatement:\n\t\tcase ts.SyntaxKind.TypeOfExpression:\n\t\tcase ts.SyntaxKind.ElementAccessExpression:\n\t\tcase ts.SyntaxKind.ForStatement:\n\t\tcase ts.SyntaxKind.IfStatement:\n\t\tcase ts.SyntaxKind.DoStatement:\n\t\tcase ts.SyntaxKind.WhileStatement:\n\t\tcase ts.SyntaxKind.SwitchStatement:\n\t\tcase ts.SyntaxKind.WithStatement:\n\t\tcase ts.SyntaxKind.ThrowStatement:\n\t\tcase ts.SyntaxKind.CallExpression:\n\t\tcase ts.SyntaxKind.NewExpression:\n\t\tcase ts.SyntaxKind.TaggedTemplateExpression:\n\t\tcase ts.SyntaxKind.JsxExpression:\n\t\tcase ts.SyntaxKind.Decorator:\n\t\tcase ts.SyntaxKind.TemplateSpan:\n\t\tcase ts.SyntaxKind.JsxOpeningElement:\n\t\tcase ts.SyntaxKind.JsxSelfClosingElement:\n\t\tcase ts.SyntaxKind.JsxSpreadAttribute:\n\t\tcase ts.SyntaxKind.VoidExpression:\n\t\tcase ts.SyntaxKind.ReturnStatement:\n\t\tcase ts.SyntaxKind.AwaitExpression:\n\t\tcase ts.SyntaxKind.YieldExpression:\n\t\tcase ts.SyntaxKind.ConditionalExpression:\n\t\tcase ts.SyntaxKind.CaseClause:\n\t\tcase ts.SyntaxKind.JsxElement:\n\t\t\treturn AccessKind.Read;\n\t\tcase ts.SyntaxKind.ArrowFunction:\n\t\t\treturn (parent as ts.ArrowFunction).body === node\n\t\t\t\t? AccessKind.Read\n\t\t\t\t: AccessKind.Write;\n\t\tcase ts.SyntaxKind.PropertyDeclaration:\n\t\tcase ts.SyntaxKind.VariableDeclaration:\n\t\tcase ts.SyntaxKind.Parameter:\n\t\tcase ts.SyntaxKind.EnumMember:\n\t\tcase ts.SyntaxKind.BindingElement:\n\t\tcase ts.SyntaxKind.JsxAttribute:\n\t\t\treturn (parent as ts.JsxAttribute).initializer === node\n\t\t\t\t? AccessKind.Read\n\t\t\t\t: AccessKind.None;\n\t\tcase ts.SyntaxKind.PropertyAccessExpression:\n\t\t\treturn (parent as ts.PropertyAccessExpression).expression === node\n\t\t\t\t? AccessKind.Read\n\t\t\t\t: AccessKind.None;\n\t\tcase ts.SyntaxKind.ExportAssignment:\n\t\t\treturn (parent as ts.ExportAssignment).isExportEquals\n\t\t\t\t? AccessKind.Read\n\t\t\t\t: AccessKind.None;\n\t}\n\n\treturn AccessKind.None;\n}\n\nfunction isInDestructuringAssignment(\n\tnode:\n\t\t| ts.ArrayLiteralExpression\n\t\t| ts.ObjectLiteralExpression\n\t\t| ts.PropertyAssignment\n\t\t| ts.ShorthandPropertyAssignment\n\t\t| ts.SpreadAssignment\n\t\t| ts.SpreadElement,\n): boolean {\n\tswitch (node.kind) {\n\t\tcase ts.SyntaxKind.ShorthandPropertyAssignment:\n\t\t\tif (node.objectAssignmentInitializer !== undefined) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t// falls through\n\t\tcase ts.SyntaxKind.PropertyAssignment:\n\t\tcase ts.SyntaxKind.SpreadAssignment:\n\t\t\tnode = node.parent as\n\t\t\t\t| ts.ArrayLiteralExpression\n\t\t\t\t| ts.ObjectLiteralExpression;\n\t\t\tbreak;\n\t\tcase ts.SyntaxKind.SpreadElement:\n\t\t\tif (node.parent.kind !== ts.SyntaxKind.ArrayLiteralExpression) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tnode = node.parent;\n\t}\n\n\twhile (true) {\n\t\tswitch (node.parent.kind) {\n\t\t\tcase ts.SyntaxKind.BinaryExpression:\n\t\t\t\treturn (\n\t\t\t\t\t(node.parent as ts.BinaryExpression).left === node &&\n\t\t\t\t\t(node.parent as ts.BinaryExpression).operatorToken.kind ===\n\t\t\t\t\t\tts.SyntaxKind.EqualsToken\n\t\t\t\t);\n\t\t\tcase ts.SyntaxKind.ForOfStatement:\n\t\t\t\treturn (node.parent as ts.ForOfStatement).initializer === node;\n\t\t\tcase ts.SyntaxKind.ArrayLiteralExpression:\n\t\t\tcase ts.SyntaxKind.ObjectLiteralExpression:\n\t\t\t\tnode = node.parent as\n\t\t\t\t\t| ts.ArrayLiteralExpression\n\t\t\t\t\t| ts.ObjectLiteralExpression;\n\t\t\t\tbreak;\n\t\t\tcase ts.SyntaxKind.SpreadAssignment:\n\t\t\tcase ts.SyntaxKind.PropertyAssignment:\n\t\t\t\tnode = node.parent.parent as ts.ObjectLiteralExpression;\n\t\t\t\tbreak;\n\t\t\tcase ts.SyntaxKind.SpreadElement:\n\t\t\t\tif (node.parent.parent.kind !== ts.SyntaxKind.ArrayLiteralExpression) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tnode = node.parent.parent as ts.ArrayLiteralExpression;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}\n}\n","// Code largely based on https://github.com/ajafff/tsutils\n// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE\n\nimport ts from \"typescript\";\n\n/**\n * Test of the kind given is for assignment.\n * @category Syntax Utilities\n * @example\n * ```ts\n * declare const kind: ts.SyntaxKind;\n *\n * isAssignmentKind(kind);\n * ```\n */\nexport function isAssignmentKind(kind: ts.SyntaxKind): boolean {\n\treturn (\n\t\tkind >= ts.SyntaxKind.FirstAssignment &&\n\t\tkind <= ts.SyntaxKind.LastAssignment\n\t);\n}\n\n/**\n * Test if a string is numeric.\n * @category Syntax Utilities\n * @example\n * ```ts\n * isNumericPropertyName(\"abc\"); // false\n * isNumericPropertyName(\"123\"); // true\n * ```\n */\nexport function isNumericPropertyName(name: string | ts.__String): boolean {\n\treturn String(+name) === name;\n}\n\nfunction charSize(ch: number) {\n\treturn ch >= 0x10000 ? 2 : 1;\n}\n\n/**\n * Determines whether the given text can be used to access a property with a `PropertyAccessExpression` while preserving the property's name.\n * @category Syntax Utilities\n * @example\n * ```ts\n * isValidPropertyAccess(\"abc\"); // true\n * isValidPropertyAccess(\"123\"); // false\n * ```\n */\nexport function isValidPropertyAccess(\n\ttext: string,\n\tlanguageVersion = ts.ScriptTarget.Latest,\n): boolean {\n\tif (text.length === 0) {\n\t\treturn false;\n\t}\n\n\tlet ch = text.codePointAt(0)!;\n\tif (!ts.isIdentifierStart(ch, languageVersion)) {\n\t\treturn false;\n\t}\n\n\tfor (let i = charSize(ch); i < text.length; i += charSize(ch)) {\n\t\tch = text.codePointAt(i)!;\n\t\tif (!ts.isIdentifierPart(ch, languageVersion)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n","import ts from \"typescript\";\n\nimport { isSuperExpression } from \"./single\";\nimport {\n\tisDeclarationName,\n\tisEntityNameExpression,\n\tisJSDocNamespaceBody,\n\tisJsxTagNameExpression,\n\tisNamespaceBody,\n} from \"./union\";\n\n/**\n * An `AssertionExpression` that is declared as const.\n * @category Node Types\n */\nexport type ConstAssertionExpression = ts.AssertionExpression & {\n\ttype: ts.TypeReferenceNode;\n\ttypeName: ConstAssertionIdentifier;\n};\n\n/**\n * An `Identifier` with an `escapedText` value of `\"const\"`.\n * @category Node Types\n */\nexport type ConstAssertionIdentifier = ts.Identifier & {\n\tescapedText: ts.__String & \"const\";\n};\n\n/**\n * Test if a node is a {@link ConstAssertionExpression}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isConstAssertionExpression(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a {@link ConstAssertionExpression}.\n */\nexport function isConstAssertionExpression(\n\tnode: ts.AssertionExpression,\n): node is ConstAssertionExpression {\n\treturn (\n\t\tts.isTypeReferenceNode(node.type) &&\n\t\tts.isIdentifier(node.type.typeName) &&\n\t\tnode.type.typeName.escapedText === \"const\"\n\t);\n}\n\n/**\n * Test if a node is an `IterationStatement`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isIterationStatement(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `IterationStatement`.\n */\nexport function isIterationStatement(\n\tnode: ts.Node,\n): node is ts.IterationStatement {\n\tswitch (node.kind) {\n\t\tcase ts.SyntaxKind.DoStatement:\n\t\tcase ts.SyntaxKind.ForInStatement:\n\t\tcase ts.SyntaxKind.ForOfStatement:\n\t\tcase ts.SyntaxKind.ForStatement:\n\t\tcase ts.SyntaxKind.WhileStatement:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\n/**\n * Test if a node is a `JSDocNamespaceDeclaration`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isJSDocNamespaceDeclaration(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `JSDocNamespaceDeclaration`.\n */\nexport function isJSDocNamespaceDeclaration(\n\tnode: ts.Node,\n): node is ts.JSDocNamespaceDeclaration {\n\treturn (\n\t\tts.isModuleDeclaration(node) &&\n\t\tts.isIdentifier(node.name) &&\n\t\t(node.body === undefined || isJSDocNamespaceBody(node.body))\n\t);\n}\n\n/**\n * Test if a node is a `JsxTagNamePropertyAccess`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isJsxTagNamePropertyAccess(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `JsxTagNamePropertyAccess`.\n */\nexport function isJsxTagNamePropertyAccess(\n\tnode: ts.Node,\n): node is ts.JsxTagNamePropertyAccess {\n\treturn (\n\t\tts.isPropertyAccessExpression(node) &&\n\t\t// eslint-disable-next-line deprecation/deprecation -- Keep compatibility with ts < 5\n\t\tisJsxTagNameExpression(node.expression)\n\t);\n}\n\n/**\n * a `NamedDeclaration` that definitely has a name.\n * @category Node Types\n */\nexport interface NamedDeclarationWithName extends ts.NamedDeclaration {\n\tname: ts.DeclarationName;\n}\n\n/**\n * Test if a node is a {@link NamedDeclarationWithName}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isNamedDeclarationWithName(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a {@link NamedDeclarationWithName}.\n */\nexport function isNamedDeclarationWithName(\n\tnode: ts.Declaration,\n): node is NamedDeclarationWithName {\n\treturn (\n\t\t\"name\" in node &&\n\t\tnode.name !== undefined &&\n\t\tnode.name !== null &&\n\t\tisDeclarationName(node.name as ts.Node)\n\t);\n}\n\n/**\n * Test if a node is a `NamespaceDeclaration`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isNamespaceDeclaration(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `NamespaceDeclaration`.\n */\nexport function isNamespaceDeclaration(\n\tnode: ts.Node,\n): node is ts.NamespaceDeclaration {\n\treturn (\n\t\tts.isModuleDeclaration(node) &&\n\t\tts.isIdentifier(node.name) &&\n\t\tnode.body !== undefined &&\n\t\tisNamespaceBody(node.body)\n\t);\n}\n\n/**\n * A number or string-like literal.\n * @category Node Types\n */\nexport type NumericOrStringLikeLiteral =\n\t| ts.NumericLiteral\n\t| ts.StringLiteralLike;\n\n/**\n * Test if a node is a {@link NumericOrStringLikeLiteral}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isNumericOrStringLikeLiteral(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a {@link NumericOrStringLikeLiteral}.\n */\nexport function isNumericOrStringLikeLiteral(\n\tnode: ts.Node,\n): node is NumericOrStringLikeLiteral {\n\tswitch (node.kind) {\n\t\tcase ts.SyntaxKind.StringLiteral:\n\t\tcase ts.SyntaxKind.NumericLiteral:\n\t\tcase ts.SyntaxKind.NoSubstitutionTemplateLiteral:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\n/**\n * Test if a node is a `PropertyAccessEntityNameExpression`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isPropertyAccessEntityNameExpression(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `PropertyAccessEntityNameExpression`.\n */\nexport function isPropertyAccessEntityNameExpression(\n\tnode: ts.Node,\n): node is ts.PropertyAccessEntityNameExpression {\n\treturn (\n\t\tts.isPropertyAccessExpression(node) &&\n\t\tts.isIdentifier(node.name) &&\n\t\tisEntityNameExpression(node.expression)\n\t);\n}\n\n/**\n * Test if a node is a `SuperElementAccessExpression`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isSuperElementAccessExpression(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `SuperElementAccessExpression`.\n */\nexport function isSuperElementAccessExpression(\n\tnode: ts.Node,\n): node is ts.SuperElementAccessExpression {\n\treturn (\n\t\tts.isElementAccessExpression(node) && isSuperExpression(node.expression)\n\t);\n}\n\n/**\n * Test if a node is a `SuperPropertyAccessExpression`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isSuperPropertyAccessExpression(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `SuperPropertyAccessExpression`.\n */\nexport function isSuperPropertyAccessExpression(\n\tnode: ts.Node,\n): node is ts.SuperPropertyAccessExpression {\n\treturn (\n\t\tts.isPropertyAccessExpression(node) && isSuperExpression(node.expression)\n\t);\n}\n","import ts from \"typescript\";\n\n/**\n * A node that represents the any keyword.\n * @category Node Types\n */\nexport type AnyKeyword = ts.KeywordToken<ts.SyntaxKind.AnyKeyword>;\n\n/**\n * A node that represents the bigint keyword.\n * @category Node Types\n */\nexport type BigIntKeyword = ts.KeywordToken<ts.SyntaxKind.BigIntKeyword>;\n\n/**\n * A node that represents the boolean keyword.\n * @category Node Types\n */\nexport type BooleanKeyword = ts.KeywordToken<ts.SyntaxKind.BooleanKeyword>;\n\n/**\n * A node that represents the false keyword.\n * @category Node Types\n */\nexport type FalseKeyword = ts.KeywordToken<ts.SyntaxKind.FalseKeyword>;\n\n/**\n * A node that represents the import keyword.\n * @category Node Types\n */\nexport type ImportKeyword = ts.KeywordToken<ts.SyntaxKind.ImportKeyword>;\n\n/**\n * A node that represents the never keyword.\n * @category Node Types\n */\nexport type NeverKeyword = ts.KeywordToken<ts.SyntaxKind.NeverKeyword>;\n\n/**\n * A node that represents the null keyword.\n * @category Node Types\n */\nexport type NullKeyword = ts.KeywordToken<ts.SyntaxKind.NullKeyword>;\n\n/**\n * A node that represents the number keyword.\n * @category Node Types\n */\nexport type NumberKeyword = ts.KeywordToken<ts.SyntaxKind.NumberKeyword>;\n\n/**\n * A node that represents the object keyword.\n * @category Node Types\n */\nexport type ObjectKeyword = ts.KeywordToken<ts.SyntaxKind.ObjectKeyword>;\n\n/**\n * A node that represents the string keyword.\n * @category Node Types\n */\nexport type StringKeyword = ts.KeywordToken<ts.SyntaxKind.StringKeyword>;\n\n/**\n * A node that represents the super keyword.\n * @category Node Types\n */\nexport type SuperKeyword = ts.KeywordToken<ts.SyntaxKind.SuperKeyword>;\n\n/**\n * A node that represents the symbol keyword.\n * @category Node Types\n */\nexport type SymbolKeyword = ts.KeywordToken<ts.SyntaxKind.SymbolKeyword>;\n\n/**\n * A node that represents the this keyword.\n * @category Node Types\n */\nexport type ThisKeyword = ts.KeywordToken<ts.SyntaxKind.ThisKeyword>;\n\n/**\n * A node that represents the true keyword.\n * @category Node Types\n */\nexport type TrueKeyword = ts.KeywordToken<ts.SyntaxKind.TrueKeyword>;\n\n/**\n * A node that represents the undefined keyword.\n * @category Node Types\n */\nexport type UndefinedKeyword = ts.KeywordToken<ts.SyntaxKind.UndefinedKeyword>;\n\n/**\n * A node that represents the unknown keyword.\n * @category Node Types\n */\nexport type UnknownKeyword = ts.KeywordToken<ts.SyntaxKind.UnknownKeyword>;\n\n/**\n * A node that represents the void keyword.\n * @category Node Types\n */\nexport type VoidKeyword = ts.KeywordToken<ts.SyntaxKind.VoidKeyword>;\n\n/**\n * Test if a node is an `AbstractKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isAbstractKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `AbstractKeyword`.\n */\nexport function isAbstractKeyword(node: ts.Node): node is ts.AbstractKeyword {\n\treturn node.kind === ts.SyntaxKind.AbstractKeyword;\n}\n\n/**\n * Test if a node is an `AccessorKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isAccessorKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `AccessorKeyword`.\n */\nexport function isAccessorKeyword(node: ts.Node): node is ts.AccessorKeyword {\n\treturn node.kind === ts.SyntaxKind.AccessorKeyword;\n}\n\n/**\n * Test if a node is an {@link AnyKeyword}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isAnyKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an {@link AnyKeyword}.\n */\nexport function isAnyKeyword(node: ts.Node): node is AnyKeyword {\n\treturn node.kind === ts.SyntaxKind.AnyKeyword;\n}\n\n/**\n * Test if a node is an `AssertKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isAssertKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `AssertKeyword`.\n */\nexport function isAssertKeyword(node: ts.Node): node is ts.AssertKeyword {\n\treturn node.kind === ts.SyntaxKind.AssertKeyword;\n}\n\n/**\n * Test if a node is an `AssertsKeyword`.\n * @deprecated With TypeScript v5, in favor of typescript's `isAssertsKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isAssertsKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `AssertsKeyword`.\n */\nexport function isAssertsKeyword(node: ts.Node): node is ts.AssertsKeyword {\n\treturn node.kind === ts.SyntaxKind.AssertsKeyword;\n}\n\n/**\n * Test if a node is an `AsyncKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isAsyncKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `AsyncKeyword`.\n */\nexport function isAsyncKeyword(node: ts.Node): node is ts.AsyncKeyword {\n\treturn node.kind === ts.SyntaxKind.AsyncKeyword;\n}\n\n/**\n * Test if a node is an `AwaitKeyword`.\n * @deprecated With TypeScript v5, in favor of typescript's `isAwaitKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isAwaitKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `AwaitKeyword`.\n */\nexport function isAwaitKeyword(node: ts.Node): node is ts.AwaitKeyword {\n\treturn node.kind === ts.SyntaxKind.AwaitKeyword;\n}\n\n/**\n * Test if a node is a {@link BigIntKeyword}.\n * @deprecated With TypeScript v5, in favor of typescript's `isBigIntKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isBigIntKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a {@link BigIntKeyword}.\n */\nexport function isBigIntKeyword(node: ts.Node): node is BigIntKeyword {\n\treturn node.kind === ts.SyntaxKind.BigIntKeyword;\n}\n\n/**\n * Test if a node is a {@link BooleanKeyword}.\n * @deprecated With TypeScript v5, in favor of typescript's `isBooleanKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isBooleanKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a {@link BooleanKeyword}.\n */\nexport function isBooleanKeyword(node: ts.Node): node is BooleanKeyword {\n\treturn node.kind === ts.SyntaxKind.BooleanKeyword;\n}\n\n/**\n * Test if a node is a `ColonToken`.\n * @deprecated With TypeScript v5, in favor of typescript's `isColonToken`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isColonToken(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `ColonToken`.\n */\nexport function isColonToken(node: ts.Node): node is ts.ColonToken {\n\treturn node.kind === ts.SyntaxKind.ColonToken;\n}\n\n/**\n * Test if a node is a `ConstKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isConstKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `ConstKeyword`.\n */\nexport function isConstKeyword(node: ts.Node): node is ts.ConstKeyword {\n\treturn node.kind === ts.SyntaxKind.ConstKeyword;\n}\n\n/**\n * Test if a node is a `DeclareKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isDeclareKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `DeclareKeyword`.\n */\nexport function isDeclareKeyword(node: ts.Node): node is ts.DeclareKeyword {\n\treturn node.kind === ts.SyntaxKind.DeclareKeyword;\n}\n\n/**\n * Test if a node is a `DefaultKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isDefaultKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `DefaultKeyword`.\n */\nexport function isDefaultKeyword(node: ts.Node): node is ts.DefaultKeyword {\n\treturn node.kind === ts.SyntaxKind.DefaultKeyword;\n}\n\n/**\n * Test if a node is a `DotToken`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isDotToken(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `DotToken`.\n */\nexport function isDotToken(node: ts.Node): node is ts.DotToken {\n\treturn node.kind === ts.SyntaxKind.DotToken;\n}\n\n/**\n * Test if a node is an `EndOfFileToken`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isEndOfFileToken(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `EndOfFileToken`.\n */\nexport function isEndOfFileToken(node: ts.Node): node is ts.EndOfFileToken {\n\treturn node.kind === ts.SyntaxKind.EndOfFileToken;\n}\n\n/**\n * Test if a node is an `EqualsGreaterThanToken`.\n * @deprecated With TypeScript v5, in favor of typescript's `isEqualsGreaterThanToken`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isEqualsGreaterThanToken(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `EqualsGreaterThanToken`.\n */\nexport function isEqualsGreaterThanToken(\n\tnode: ts.Node,\n): node is ts.EqualsGreaterThanToken {\n\treturn node.kind === ts.SyntaxKind.EqualsGreaterThanToken;\n}\n\n/**\n * Test if a node is an `EqualsToken`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isEqualsToken(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `EqualsToken`.\n */\nexport function isEqualsToken(node: ts.Node): node is ts.EqualsToken {\n\treturn node.kind === ts.SyntaxKind.EqualsToken;\n}\n\n/**\n * Test if a node is an `ExclamationToken`.\n * @deprecated With TypeScript v5, in favor of typescript's `isExclamationToken`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isExclamationToken(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `ExclamationToken`.\n */\nexport function isExclamationToken(node: ts.Node): node is ts.ExclamationToken {\n\treturn node.kind === ts.SyntaxKind.ExclamationToken;\n}\n\n/**\n * Test if a node is an `ExportKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isExportKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `ExportKeyword`.\n */\nexport function isExportKeyword(node: ts.Node): node is ts.ExportKeyword {\n\treturn node.kind === ts.SyntaxKind.ExportKeyword;\n}\n\n/**\n * Test if a node is a {@link FalseKeyword}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isFalseKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a {@link FalseKeyword}.\n */\nexport function isFalseKeyword(node: ts.Node): node is FalseKeyword {\n\treturn node.kind === ts.SyntaxKind.FalseKeyword;\n}\n\n/**\n * Test if a node is a `FalseLiteral`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isFalseLiteral(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `FalseLiteral`.\n */\nexport function isFalseLiteral(node: ts.Node): node is ts.FalseLiteral {\n\treturn node.kind === ts.SyntaxKind.FalseKeyword;\n}\n\n/**\n * Test if a node is an `ImportExpression`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isImportExpression(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `ImportExpression`.\n */\nexport function isImportExpression(node: ts.Node): node is ts.ImportExpression {\n\treturn node.kind === ts.SyntaxKind.ImportKeyword;\n}\n\n/**\n * Test if a node is an {@link ImportKeyword}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isImportKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an {@link ImportKeyword}.\n */\nexport function isImportKeyword(node: ts.Node): node is ImportKeyword {\n\treturn node.kind === ts.SyntaxKind.ImportKeyword;\n}\n\n/**\n * Test if a node is an `InKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isInKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `InKeyword`.\n */\nexport function isInKeyword(node: ts.Node): node is ts.InKeyword {\n\treturn node.kind === ts.SyntaxKind.InKeyword;\n}\n\n/* eslint-disable deprecation/deprecation */\n/**\n * Test if a node is an `InputFiles`.\n * @deprecated With TypeScript v5\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isInputFiles(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `InputFiles`.\n */\nexport function isInputFiles(node: ts.Node): node is ts.InputFiles {\n\treturn node.kind === ts.SyntaxKind.InputFiles;\n}\n/* eslint-enable deprecation/deprecation */\n\n/**\n * Test if a node is a `JSDocText`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isJSDocText(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `JSDocText`.\n */\nexport function isJSDocText(node: ts.Node): node is ts.JSDocText {\n\treturn node.kind === ts.SyntaxKind.JSDocText;\n}\n\n/**\n * Test if a node is a `JsonMinusNumericLiteral`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isJsonMinusNumericLiteral(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `JsonMinusNumericLiteral`.\n */\nexport function isJsonMinusNumericLiteral(\n\tnode: ts.Node,\n): node is ts.JsonMinusNumericLiteral {\n\treturn node.kind === ts.SyntaxKind.PrefixUnaryExpression;\n}\n\n/**\n * Test if a node is a {@link NeverKeyword}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isNeverKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a {@link NeverKeyword}.\n */\nexport function isNeverKeyword(node: ts.Node): node is NeverKeyword {\n\treturn node.kind === ts.SyntaxKind.NeverKeyword;\n}\n\n/**\n * Test if a node is a {@link NullKeyword}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isNullKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a {@link NullKeyword}.\n */\nexport function isNullKeyword(node: ts.Node): node is NullKeyword {\n\treturn node.kind === ts.SyntaxKind.NullKeyword;\n}\n\n/**\n * Test if a node is a `NullLiteral`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isNullLiteral(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `NullLiteral`.\n */\nexport function isNullLiteral(node: ts.Node): node is ts.NullLiteral {\n\treturn node.kind === ts.SyntaxKind.NullKeyword;\n}\n\n/**\n * Test if a node is a {@link NumberKeyword}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isNumberKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a {@link NumberKeyword}.\n */\nexport function isNumberKeyword(node: ts.Node): node is NumberKeyword {\n\treturn node.kind === ts.SyntaxKind.NumberKeyword;\n}\n\n/**\n * Test if a node is an {@link ObjectKeyword}.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isObjectKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an {@link ObjectKeyword}.\n */\nexport function isObjectKeyword(node: ts.Node): node is ObjectKeyword {\n\treturn node.kind === ts.SyntaxKind.ObjectKeyword;\n}\n\n/**\n * Test if a node is an `OutKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isOutKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `OutKeyword`.\n */\nexport function isOutKeyword(node: ts.Node): node is ts.OutKeyword {\n\treturn node.kind === ts.SyntaxKind.OutKeyword;\n}\n\n/**\n * Test if a node is an `OverrideKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isOverrideKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be an `OverrideKeyword`.\n */\nexport function isOverrideKeyword(node: ts.Node): node is ts.OverrideKeyword {\n\treturn node.kind === ts.SyntaxKind.OverrideKeyword;\n}\n\n/**\n * Test if a node is a `PrivateKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isPrivateKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `PrivateKeyword`.\n */\nexport function isPrivateKeyword(node: ts.Node): node is ts.PrivateKeyword {\n\treturn node.kind === ts.SyntaxKind.PrivateKeyword;\n}\n\n/**\n * Test if a node is a `ProtectedKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isProtectedKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `ProtectedKeyword`.\n */\nexport function isProtectedKeyword(node: ts.Node): node is ts.ProtectedKeyword {\n\treturn node.kind === ts.SyntaxKind.ProtectedKeyword;\n}\n\n/**\n * Test if a node is a `PublicKeyword`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n * if (isPublicKeyword(node)) {\n * // ...\n * }\n * ```\n * @returns Whether the given node appears to be a `PublicKeyword`.\n */\nexport function isPublicKeyword(node: ts.Node): node is ts.PublicKeyword {\n\treturn node.kind === ts.SyntaxKind.PublicKeyword;\n}\n\n/**\n * Test if a node is a `QuestionDotToken`.\n * @deprecated With TypeScript v5, in favor of typescript's `isQuestionDotToken`.\n * @category Nodes - Type Guards\n * @example\n * ```ts\n * declare const node: ts.Node;\n *\n