Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2025-02-03 17:20:53 +00:00
parent 3e913ef09d
commit 9660df3fcc
990 changed files with 74805 additions and 60149 deletions

View file

@ -32,7 +32,7 @@ exports.default = (0, util_1.createRule)({
},
},
ignoreClassesThatImplementAnInterface: {
description: 'Makes the rule ignore class members that are defined within a class that `implements` a type',
description: 'Whether to ignore class members that are defined within a class that `implements` a type.',
oneOf: [
{
type: 'boolean',
@ -47,7 +47,7 @@ exports.default = (0, util_1.createRule)({
},
ignoreOverrideMethods: {
type: 'boolean',
description: 'Ignore members marked with the `override` modifier',
description: 'Whether to ignore members marked with the `override` modifier.',
},
},
},

View file

@ -1 +1 @@
{"version":3,"file":"class-methods-use-this.js","sourceRoot":"","sources":["../../src/rules/class-methods-use-this.ts"],"names":[],"mappings":";;AAEA,oDAA0D;AAE1D,kCAKiB;AAYjB,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,2CAA2C;YACxD,eAAe,EAAE,IAAI;YACrB,oBAAoB,EAAE,KAAK;SAC5B;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,+CAA+C;SAC7D;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE;oBACV,qBAAqB,EAAE;wBACrB,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,IAAI;wBACb,WAAW,EACT,6EAA6E;qBAChF;oBACD,aAAa,EAAE;wBACb,IAAI,EAAE,OAAO;wBACb,WAAW,EACT,6DAA6D;wBAC/D,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;yBACf;qBACF;oBACD,qCAAqC,EAAE;wBACrC,WAAW,EACT,8FAA8F;wBAChG,KAAK,EAAE;4BACL;gCACE,IAAI,EAAE,SAAS;gCACf,WAAW,EAAE,gDA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gBACH,CAAC,CAAC,EAAE,CAAC;YAEP;;eAEG;YACH,yBAAyB;gBACvB,UAAU,EAAE,CAAC;YACf,CAAC;YACD,iCAAiC;gBAC/B,WAAW,EAAE,CAAC;YAChB,CAAC;YAED;;;;;eAKG;YACH,WAAW;gBACT,WAAW,EAAE,CAAC;YAChB,CAAC;YACD,kBAAkB;gBAChB,UAAU,EAAE,CAAC;YACf,CAAC;YAED,uBAAuB;gBACrB,IAAI,KAAK,EAAE,CAAC;oBACV,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACxB,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
{"version":3,"file":"class-methods-use-this.js","sourceRoot":"","sources":["../../src/rules/class-methods-use-this.ts"],"names":[],"mappings":";;AAEA,oDAA0D;AAE1D,kCAKiB;AAYjB,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,2CAA2C;YACxD,eAAe,EAAE,IAAI;YACrB,oBAAoB,EAAE,KAAK;SAC5B;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,+CAA+C;SAC7D;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE;oBACV,qBAAqB,EAAE;wBACrB,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,IAAI;wBACb,WAAW,EACT,6EAA6E;qBAChF;oBACD,aAAa,EAAE;wBACb,IAAI,EAAE,OAAO;wBACb,WAAW,EACT,6DAA6D;wBAC/D,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;yBACf;qBACF;oBACD,qCAAqC,EAAE;wBACrC,WAAW,EACT,2FAA2F;wBAC7F,KAAK,EAAE;4BACL;gCACE,IAAI,EAAE,SAAS;gCACf,WAAW,EAAE,gDAAgD;6BAC9D;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AC,EAAE,CAAC;YAEP;;eAEG;YACH,yBAAyB;gBACvB,UAAU,EAAE,CAAC;YACf,CAAC;YACD,iCAAiC;gBAC/B,WAAW,EAAE,CAAC;YAChB,CAAC;YAED;;;;;eAKG;YACH,WAAW;gBACT,WAAW,EAAE,CAAC;YAChB,CAAC;YACD,kBAAkB;gBAChB,UAAU,EAAE,CAAC;YACf,CAAC;YAED,uBAAuB;gBACrB,IAAI,KAAK,EAAE,CAAC;oBACV,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACxB,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}

View file

@ -100,6 +100,7 @@ exports.default = (0, util_1.createRule)({
create(context, [options]) {
const rules = baseRule.create(context);
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
const allowPrivateClassPropertyAccess = options.allowPrivateClassPropertyAccess;
const allowProtectedClassPropertyAccess = options.allowProtectedClassPropertyAccess;
const allowIndexSignaturePropertyAccess = (options.allowIndexSignaturePropertyAccess ?? false) ||
@ -126,11 +127,11 @@ exports.default = (0, util_1.createRule)({
return;
}
if (propertySymbol == null && allowIndexSignaturePropertyAccess) {
const objectType = services.getTypeAtLocation(node.object);
const indexType = objectType
.getNonNullableType()
.getStringIndexType();
if (indexType != null) {
const objectType = services
.getTypeAtLocation(node.object)
.getNonNullableType();
const indexInfos = checker.getIndexInfosOfType(objectType);
if (indexInfos.some(info => info.keyType.flags & ts.TypeFlags.StringLike)) {
return;
}
}

View file

@ -1 +1 @@
{"version":3,"file":"dot-notation.js","sourceRoot":"","sources":["../../src/rules/dot-notation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,oDAA0D;AAC1D,sDAAwC;AACxC,+CAAiC;AAOjC,kCAAsE;AACtE,iEAA8D;AAE9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,cAAc,CAAC,CAAC;AAKnD,MAAM,cAAc,GAAY;IAC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BACD,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}

View file

@ -163,20 +163,27 @@ exports.default = (0, util_1.createRule)({
}
const restrictedPatterns = getRestrictedPatterns(options);
const allowedImportTypeMatchers = [];
const allowedImportTypeRegexMatchers = [];
for (const restrictedPattern of restrictedPatterns) {
if (typeof restrictedPattern === 'object' &&
restrictedPattern.allowTypeImports) {
// Following how ignore is configured in the base rule
allowedImportTypeMatchers.push((0, ignore_1.default)({
allowRelativePaths: true,
ignoreCase: !restrictedPattern.caseSensitive,
}).add(restrictedPattern.group));
if (restrictedPattern.group) {
allowedImportTypeMatchers.push((0, ignore_1.default)({
allowRelativePaths: true,
ignoreCase: !restrictedPattern.caseSensitive,
}).add(restrictedPattern.group));
}
if (restrictedPattern.regex) {
allowedImportTypeRegexMatchers.push(new RegExp(restrictedPattern.regex, restrictedPattern.caseSensitive ? 'u' : 'iu'));
}
}
}
function isAllowedTypeImportPattern(importSource) {
return (
// As long as there's one matching pattern that allows type import
allowedImportTypeMatchers.some(matcher => matcher.ignores(importSource)));
allowedImportTypeMatchers.some(matcher => matcher.ignores(importSource)) ||
allowedImportTypeRegexMatchers.some(regex => regex.test(importSource)));
}
function checkImportNode(node) {
if (node.importKind === 'type' ||

File diff suppressed because one or more lines are too long

View file

@ -401,6 +401,22 @@ exports.default = (0, util_1.createRule)({
global: true,
};
}
/**
* Checks if the initialization of a variable has the declare modifier in a
* definition file.
*/
function isDeclareInDTSFile(variable) {
const fileName = context.filename;
if (!(0, util_1.isDefinitionFile)(fileName)) {
return false;
}
return variable.defs.some(def => {
return ((def.type === scope_manager_1.DefinitionType.Variable && def.parent.declare) ||
(def.type === scope_manager_1.DefinitionType.ClassName && def.node.declare) ||
(def.type === scope_manager_1.DefinitionType.TSEnumName && def.node.declare) ||
(def.type === scope_manager_1.DefinitionType.TSModuleName && def.node.declare));
});
}
/**
* Checks the current context for shadowed variables.
* @param scope Fixme
@ -432,6 +448,10 @@ exports.default = (0, util_1.createRule)({
if (isAllowed(variable)) {
continue;
}
// ignore variables with the declare keyword in .d.ts files
if (isDeclareInDTSFile(variable)) {
continue;
}
// Gets shadowed variable.
const shadowed = scope.upper
? utils_1.ASTUtils.findVariable(scope.upper, variable.name)

File diff suppressed because one or more lines are too long

View file

@ -53,6 +53,7 @@ exports.default = (0, util_1.createRule)({
comparingNullableToTrueNegated: 'This expression unnecessarily compares a nullable boolean value to true instead of negating it.',
direct: 'This expression unnecessarily compares a boolean value to a boolean instead of using it directly.',
negated: 'This expression unnecessarily compares a boolean value to a boolean instead of negating it.',
noStrictNullCheck: 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.',
},
schema: [
{
@ -67,6 +68,10 @@ exports.default = (0, util_1.createRule)({
type: 'boolean',
description: 'Whether to allow comparisons between nullable boolean variables and `true`.',
},
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: {
type: 'boolean',
description: 'Unless this is set to `true`, the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`.',
},
},
},
],
@ -75,11 +80,24 @@ exports.default = (0, util_1.createRule)({
{
allowComparingNullableBooleansToFalse: true,
allowComparingNullableBooleansToTrue: true,
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
},
],
create(context, [options]) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
const compilerOptions = services.program.getCompilerOptions();
const isStrictNullChecks = tsutils.isStrictCompilerOptionEnabled(compilerOptions, 'strictNullChecks');
if (!isStrictNullChecks &&
options.allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing !== true) {
context.report({
loc: {
start: { column: 0, line: 0 },
end: { column: 0, line: 0 },
},
messageId: 'noStrictNullCheck',
});
}
function getBooleanComparison(node) {
const comparison = deconstructComparison(node);
if (!comparison) {

File diff suppressed because one or more lines are too long

View file

@ -329,8 +329,9 @@ exports.default = (0, util_1.createRule)({
TSTemplateLiteralType(node) {
if (isTrivialInterpolation(node) &&
!hasCommentsBetweenQuasi(node.quasis[0], node.quasis[1])) {
const { constraintType } = (0, util_1.getConstraintInfo)(checker, services.getTypeAtLocation(node.types[0]));
const { constraintType, isTypeParameter } = (0, util_1.getConstraintInfo)(checker, services.getTypeAtLocation(node.types[0]));
if (constraintType &&
!isTypeParameter &&
isUnderlyingTypeString(constraintType) &&
!isEnumType(constraintType)) {
reportSingleInterpolation(node);

File diff suppressed because one or more lines are too long

View file

@ -141,18 +141,23 @@ exports.default = (0, util_1.createRule)({
node.typeName.type === utils_1.AST_NODE_TYPES.Identifier &&
node.typeName.name === 'const');
}
function isImplicitlyNarrowedConstDeclaration({ expression, parent, }) {
function isTemplateLiteralWithExpressions(expression) {
return (expression.type === utils_1.AST_NODE_TYPES.TemplateLiteral &&
expression.expressions.length !== 0);
}
function isImplicitlyNarrowedLiteralDeclaration({ expression, parent, }) {
/**
* Even on `const` variable declarations, template literals with expressions can sometimes be widened without a type assertion.
* @see https://github.com/typescript-eslint/typescript-eslint/issues/8737
*/
if (isTemplateLiteralWithExpressions(expression)) {
return false;
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const maybeDeclarationNode = parent.parent;
const isTemplateLiteralWithExpressions = expression.type === utils_1.AST_NODE_TYPES.TemplateLiteral &&
expression.expressions.length !== 0;
return (maybeDeclarationNode.type === utils_1.AST_NODE_TYPES.VariableDeclaration &&
maybeDeclarationNode.kind === 'const' &&
/**
* Even on `const` variable declarations, template literals with expressions can sometimes be widened without a type assertion.
* @see https://github.com/typescript-eslint/typescript-eslint/issues/8737
*/
!isTemplateLiteralWithExpressions);
return ((maybeDeclarationNode.type === utils_1.AST_NODE_TYPES.VariableDeclaration &&
maybeDeclarationNode.kind === 'const') ||
(parent.type === utils_1.AST_NODE_TYPES.PropertyDefinition && parent.readonly));
}
function isTypeUnchanged(uncast, cast) {
if (uncast === cast) {
@ -184,7 +189,7 @@ exports.default = (0, util_1.createRule)({
const uncastType = services.getTypeAtLocation(node.expression);
const typeIsUnchanged = isTypeUnchanged(uncastType, castType);
const wouldSameTypeBeInferred = castType.isLiteral()
? isImplicitlyNarrowedConstDeclaration(node)
? isImplicitlyNarrowedLiteralDeclaration(node)
: !isConstAssertion(node.typeAnnotation);
if (typeIsUnchanged && wouldSameTypeBeInferred) {
context.report({

File diff suppressed because one or more lines are too long

View file

@ -336,6 +336,9 @@ exports.default = (0, util_1.createRule)({
(0, util_1.isNodeEqual)(testNode, node.alternate)) {
identifierOrMemberExpression = testNode;
}
else {
return;
}
}
}
if (!identifierOrMemberExpression) {

File diff suppressed because one or more lines are too long

View file

@ -101,6 +101,11 @@ exports.default = (0, util_1.createRule)({
}
return;
}
function typeToString(type) {
return checker.typeToString(type, undefined, ts.TypeFormatFlags.AllowUniqueESSymbolType |
ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope |
ts.TypeFormatFlags.UseFullyQualifiedType);
}
function getSwitchMetadata(node) {
const defaultCase = node.cases.find(switchCase => switchCase.test == null);
const discriminantType = (0, util_1.getConstrainedTypeAtLocation)(services, node.discriminant);
@ -154,7 +159,7 @@ exports.default = (0, util_1.createRule)({
missingBranches: missingLiteralBranchTypes
.map(missingType => tsutils.isTypeFlagSet(missingType, ts.TypeFlags.ESSymbolLike)
? `typeof ${missingType.getSymbol()?.escapedName}`
: checker.typeToString(missingType))
: typeToString(missingType))
.join(' | '),
},
suggest: [
@ -186,7 +191,7 @@ exports.default = (0, util_1.createRule)({
let caseTest = tsutils.isTypeFlagSet(missingBranchType, ts.TypeFlags.ESSymbolLike)
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
missingBranchName
: checker.typeToString(missingBranchType);
: typeToString(missingBranchType);
if (symbolName &&
(missingBranchName || missingBranchName === '') &&
(0, util_1.requiresQuoting)(missingBranchName.toString(), compilerOptions.target)) {

File diff suppressed because one or more lines are too long

View file

@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem';
> See **https://typescript-eslint.io/rules/class-methods-use-this** for documentation.
This rule extends the base [`eslint/class-methods-use-this`](https://eslint.org/docs/rules/class-methods-use-this) rule.
It adds support for ignoring `override` methods or methods on classes that implement an interface.
It adds support for ignoring `override` methods and/or methods on classes that implement an interface.
## Options
@ -33,12 +33,15 @@ const defaultOptions: Options = {
{/* insert option description */}
Makes the rule ignore any class member explicitly marked with `override`.
Example of a correct code when `ignoreOverrideMethods` is set to `true`:
Example of correct code when `ignoreOverrideMethods` is set to `true`:
```ts option='{ "ignoreOverrideMethods": true }' showPlaygroundButton
class X {
abstract class Base {
abstract method(): void;
abstract property: () => void;
}
class Derived extends Base {
override method() {}
override property = () => {};
}
@ -53,19 +56,39 @@ If specified, it can be either:
- `true`: Ignore all classes that implement an interface
- `'public-fields'`: Ignore only the public fields of classes that implement an interface
It's important to note that this option does not only apply to members defined in the interface as that would require type information.
Note that this option applies to all class members, not just those defined in the interface.
#### `true`
Example of correct code when `ignoreClassesThatImplementAnInterface` is set to `true`:
Examples of code when `ignoreClassesThatImplementAnInterface` is set to `true`:
<Tabs>
<TabItem value="❌ Incorrect">
```ts option='{ "ignoreClassesThatImplementAnInterface": true }' showPlaygroundButton
class X implements Y {
class Standalone {
method() {}
property = () => {};
}
```
</TabItem>
<TabItem value="✅ Correct">
```ts option='{ "ignoreClassesThatImplementAnInterface": true }' showPlaygroundButton
interface Base {
method(): void;
}
class Derived implements Base {
method() {}
property = () => {};
}
```
</TabItem>
</Tabs>
#### `'public-fields'`
Example of incorrect code when `ignoreClassesThatImplementAnInterface` is set to `'public-fields'`:
@ -73,16 +96,20 @@ Example of incorrect code when `ignoreClassesThatImplementAnInterface` is set to
<Tabs>
<TabItem value="❌ Incorrect">
```ts option='{ "ignoreClassesThatImplementAnInterface": "public-fields" }'
class X implements Y {
```ts option='{ "ignoreClassesThatImplementAnInterface": "public-fields" }' showPlaygroundButton
interface Base {
method(): void;
}
class Derived implements Base {
method() {}
property = () => {};
private privateMethod() {}
private privateProperty = () => {};
protected privateMethod() {}
protected privateProperty = () => {};
protected protectedMethod() {}
protected protectedProperty = () => {};
}
```
@ -90,7 +117,11 @@ class X implements Y {
<TabItem value="✅ Correct">
```ts option='{ "ignoreClassesThatImplementAnInterface": "public-fields" }'
class X implements Y {
interface Base {
method(): void;
}
class Derived implements Base {
method() {}
property = () => {};
}

View file

@ -119,7 +119,7 @@ const foo = <Foo props={{ bar: 1 } as Bar} />;
{/* insert option description */}
Always prefer `const x: T[] = [ ... ];` to `const x = [ ... ] as T[];` (or similar with angle brackets).
For example, this would prefer `const x: T[] = [ ... ];` to `const x = [ ... ] as T[];` (or similar with angle brackets).
The compiler will warn for excess properties of elements with this syntax, but not missing _required_ fields of those objects.
For example: `const x: {foo: number}[] = [{}];` will fail to compile, but `const x = [{}] as [{ foo: number }]` will succeed.

View file

@ -79,8 +79,6 @@ cond ? console.log('true') : console.error('false');
{/* insert option description */}
Whether to ignore "shorthand" `() =>` arrow functions: those without `{ ... }` braces.
It might be undesirable to wrap every arrow function shorthand expression.
Especially when using the Prettier formatter, which spreads such code across 3 lines instead of 1.
@ -94,8 +92,6 @@ promise.then(value => window.postMessage(value));
{/* insert option description */}
Whether to ignore returns that start with the `void` operator.
It might be preferable to only use some distinct syntax
to explicitly mark the confusing but valid usage of void expressions.
This option allows void expressions which are explicitly wrapped in the `void` operator.
@ -127,8 +123,6 @@ console.log(void alert('Hello, world!'));
{/* insert option description */}
Whether to ignore returns from functions with `void` return types when inside a function with a `void` return type.
Some projects prefer allowing functions that explicitly return `void` to return `void` expressions. Doing so allows more writing more succinct functions.
:::note

View file

@ -129,6 +129,22 @@ if (someNullCondition ?? true) {
</TabItem>
</Tabs>
### `allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing`
:::danger Deprecated
This option will be removed in the next major version of typescript-eslint.
:::
{/* insert option description */}
Without `strictNullChecks`, TypeScript essentially erases `undefined` and `null` from the types. This means when this rule inspects the types from a variable, **it will not be able to tell that the variable might be `null` or `undefined`**, which essentially makes this rule useless.
You should be using `strictNullChecks` to ensure complete type-safety in your codebase.
If for some reason you cannot turn on `strictNullChecks`, but still want to use this rule - you can use this option to allow it - but know that the behavior of this rule is _undefined_ with the compiler option turned off. We will not accept bug reports if you are using this option.
## Fixer
| Comparison | Fixer Output | Notes |

View file

@ -67,6 +67,9 @@ enum ABC {
}
type ABCUnion = `${ABC}`;
// Interpolating type parameters is allowed.
type TextUtil<T extends string> = `${T}`;
const stringWithNumber = `1 + 1 = 2`;
const stringWithBoolean = `true is true`;

View file

@ -181,8 +181,6 @@ Also, if you would like to ignore all primitives types, you can set `ignorePrimi
{/* insert option description */}
Whether to ignore expressions that coerce a value into a boolean: `Boolean(...)`.
Incorrect code for `ignoreBooleanCoercion: false`, and correct code for `ignoreBooleanCoercion: true`:
```ts option='{ "ignoreBooleanCoercion": true }' showPlaygroundButton

View file

@ -148,8 +148,6 @@ const msg1 = `arg = ${arg}`;
{/* insert option description */}
Whether to allow additional types in template expressions.
This option takes the shared [`TypeOrValueSpecifier` format](/packages/type-utils/type-or-value-specifier).
Examples of additional **correct** code for this rule with the default option `{ allow: [{ from: 'lib', name: 'Error' }, { from: 'lib', name: 'URL' }, { from: 'lib', name: 'URLSearchParams' }] }`:

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.22.0",
"version": "8.23.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -46,13 +46,13 @@
"typecheck": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/visitor-keys": "8.22.0"
"@typescript-eslint/types": "8.23.0",
"@typescript-eslint/visitor-keys": "8.23.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "8.22.0",
"@typescript-eslint/typescript-estree": "8.23.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",

View file

@ -54,6 +54,24 @@ declare module './generated/ast-spec' {
interface ImportSpecifier {
parent: TSESTree.ExportAllDeclaration | TSESTree.ExportNamedDeclaration | TSESTree.ImportDeclaration;
}
interface ExportDefaultDeclaration {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface ExportNamedDeclarationWithoutSourceWithMultiple {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface ExportNamedDeclarationWithoutSourceWithSingle {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface ExportNamedDeclarationWithSource {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface FunctionDeclarationWithName {
parent: TSESTree.BlockStatement | TSESTree.ExportDefaultDeclaration | TSESTree.ExportNamedDeclaration | TSESTree.Program;
}
interface FunctionDeclarationWithOptionalName {
parent: TSESTree.ExportDefaultDeclaration;
}
interface JSXAttribute {
parent: TSESTree.JSXOpeningElement;
}

View file

@ -1 +1 @@
{"version":3,"file":"ts-estree.d.ts","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAGtD,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;KACvB;IAED,UAAU,OAAO;QACf;;WAEG;QACH,MAAM,CAAC,EAAE,KAAK,CAAC;KAChB;IAED,UAAU,4BAA4B;QACpC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IACD,UAAU,+BAA+B;QACvC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IACD,UAAU,sCAAsC;QAC9C,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IACD,UAAU,yCAAyC;QACjD,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IAED,UAAU,oCAAoC;QAC5C,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;I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;IACD,UAAU,gCAAgC;QACxC,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IAED,UAAU,aAAa;QACrB,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IAED,UAAU,mBAAmB;QAC3B,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC;KAC/B;IAED,UAAU,+BAA+B;QACvC,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IACD,UAAU,kCAAkC;QAC1C,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IAED,UAAU,eAAe;QACvB,MAAM,EACF,QAAQ,CAAC,WAAW,GACpB,QAAQ,CAAC,YAAY,GACrB,QAAQ,CAAC,0BAA0B,CAAC;KACzC;IAED,UAAU,kCAAkC;QAC1C,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;KACzC;IACD,UAAU,uCAAuC;QAC/C,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;KACzC;CACF;AAED,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC"}

View file

@ -1 +1 @@
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmOA,iEAAiD"}
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+PA,iEAAiD"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.22.0",
"version": "8.23.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.22.0",
"version": "8.23.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -54,14 +54,14 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/visitor-keys": "8.22.0",
"@typescript-eslint/types": "8.23.0",
"@typescript-eslint/visitor-keys": "8.23.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
"ts-api-utils": "^2.0.0"
"ts-api-utils": "^2.0.1"
},
"devDependencies": {
"@jest/types": "29.6.3",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
"version": "8.22.0",
"version": "8.23.0",
"description": "Utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -64,9 +64,9 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.22.0",
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/typescript-estree": "8.22.0"
"@typescript-eslint/scope-manager": "8.23.0",
"@typescript-eslint/types": "8.23.0",
"@typescript-eslint/typescript-estree": "8.23.0"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.22.0",
"version": "8.23.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -47,7 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/types": "8.23.0",
"eslint-visitor-keys": "^4.2.0"
},
"devDependencies": {

View file

@ -88,9 +88,9 @@ function isJsxElementOrFragment(node) {
function isCompilerOptionEnabled(options, option) {
switch (option) {
case "allowJs":
return options.allowJs === void 0 ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
return options.allowJs === undefined ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
case "allowSyntheticDefaultImports":
return options.allowSyntheticDefaultImports !== void 0 ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9__default.default.ModuleKind.System;
return options.allowSyntheticDefaultImports !== undefined ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9__default.default.ModuleKind.System;
case "alwaysStrict":
case "noImplicitAny":
case "noImplicitThis":
@ -109,7 +109,7 @@ function isCompilerOptionEnabled(options, option) {
case "stripInternal":
return options[option] === true && isCompilerOptionEnabled(options, "declaration");
case "incremental":
return options.incremental === void 0 ? isCompilerOptionEnabled(options, "composite") : options.incremental;
return options.incremental === undefined ? isCompilerOptionEnabled(options, "composite") : options.incremental;
case "noUncheckedIndexedAccess":
return options.noUncheckedIndexedAccess === true && isCompilerOptionEnabled(options, "strictNullChecks");
case "skipDefaultLibCheck":
@ -146,7 +146,7 @@ var isTypeFlagSet = isFlagSetOnObject;
// src/modifiers.ts
function includesModifier(modifiers, ...kinds) {
if (modifiers === void 0) {
if (modifiers === undefined) {
return false;
}
for (const modifier of modifiers) {
@ -269,7 +269,7 @@ function getAccessKind(node) {
function isInDestructuringAssignment(node) {
switch (node.kind) {
case ts9__default.default.SyntaxKind.ShorthandPropertyAssignment:
if (node.objectAssignmentInitializer !== void 0) {
if (node.objectAssignmentInitializer !== undefined) {
return true;
}
// falls through
@ -692,17 +692,17 @@ function isIterationStatement(node) {
}
}
function isJSDocNamespaceDeclaration(node) {
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && (node.body === void 0 || isJSDocNamespaceBody(node.body));
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && (node.body === undefined || isJSDocNamespaceBody(node.body));
}
function isJsxTagNamePropertyAccess(node) {
return ts9__default.default.isPropertyAccessExpression(node) && // eslint-disable-next-line @typescript-eslint/no-deprecated -- Keep compatibility with ts < 5
isJsxTagNameExpression(node.expression);
}
function isNamedDeclarationWithName(node) {
return "name" in node && node.name !== void 0 && node.name !== null && isDeclarationName(node.name);
return "name" in node && node.name !== undefined && node.name !== null && isDeclarationName(node.name);
}
function isNamespaceDeclaration(node) {
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && node.body !== void 0 && isNamespaceBody(node.body);
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && node.body !== undefined && isNamespaceBody(node.body);
}
function isNumericOrStringLikeLiteral(node) {
switch (node.kind) {
@ -894,13 +894,13 @@ function getCallSignaturesOfType(type) {
for (const subType of type.types) {
const sig = getCallSignaturesOfType(subType);
if (sig.length !== 0) {
if (signatures !== void 0) {
if (signatures !== undefined) {
return [];
}
signatures = sig;
}
}
return signatures === void 0 ? [] : signatures;
return signatures === undefined ? [] : signatures;
}
return type.getCallSignatures();
}
@ -916,8 +916,8 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
if (!prop.name.startsWith(prefix)) {
continue;
}
const declaration = prop.valueDeclaration ?? prop.getDeclarations()[0];
if (!isNamedDeclarationWithName(declaration) || declaration.name === void 0 || !ts9__default.default.isComputedPropertyName(declaration.name)) {
const declaration = prop.valueDeclaration ?? prop.getDeclarations()?.[0];
if (!declaration || !isNamedDeclarationWithName(declaration) || declaration.name === undefined || !ts9__default.default.isComputedPropertyName(declaration.name)) {
continue;
}
const globalSymbol = typeChecker.getApparentType(
@ -931,7 +931,7 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
return prop;
}
}
return void 0;
return undefined;
}
function getPropertyNameOfWellKnownSymbol(typeChecker, symbolConstructor, symbolName) {
const knownSymbol = symbolConstructor && typeChecker.getTypeOfSymbolAtLocation(
@ -973,7 +973,7 @@ function isInConstContext(node, typeChecker) {
const functionSignature = typeChecker.getResolvedSignature(
parent
);
if (functionSignature === void 0) {
if (functionSignature === undefined) {
return false;
}
const argumentIndex = parent.arguments.indexOf(
@ -983,12 +983,12 @@ function isInConstContext(node, typeChecker) {
return false;
}
const parameterSymbol = functionSignature.getParameters()[argumentIndex];
if (parameterSymbol === void 0 || !("links" in parameterSymbol)) {
if (parameterSymbol === undefined || !("links" in parameterSymbol)) {
return false;
}
const parameterSymbolLinks = parameterSymbol.links;
const propertySymbol = parameterSymbolLinks.type?.getProperties()?.[argumentIndex];
if (propertySymbol === void 0 || !("links" in propertySymbol)) {
if (propertySymbol === undefined || !("links" in propertySymbol)) {
return false;
}
return isTransientSymbolLinksFlagSet(
@ -1047,8 +1047,8 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
if (getPropertyOfType(subType, name) === void 0) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.Number) : void 0) ?? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.String);
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.String);
if (index?.isReadonly) {
if (seenProperty) {
return true;
@ -1066,7 +1066,7 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
if (then === void 0) {
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
@ -1107,7 +1107,7 @@ function isCallback(typeChecker, param, node) {
);
if (param.valueDeclaration.dotDotDotToken) {
type = type.getNumberIndexType();
if (type === void 0) {
if (type === undefined) {
return false;
}
}
@ -1123,14 +1123,14 @@ function isReadonlyAssignmentDeclaration(node, typeChecker) {
return false;
}
const descriptorType = typeChecker.getTypeAtLocation(node.arguments[2]);
if (descriptorType.getProperty("value") === void 0) {
return descriptorType.getProperty("set") === void 0;
if (descriptorType.getProperty("value") === undefined) {
return descriptorType.getProperty("set") === undefined;
}
const writableProp = descriptorType.getProperty("writable");
if (writableProp === void 0) {
if (writableProp === undefined) {
return false;
}
const writableType = writableProp.valueDeclaration !== void 0 && ts9__default.default.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
const writableType = writableProp.valueDeclaration !== undefined && ts9__default.default.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
return isFalseLiteralType(writableType);
}
function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
@ -1138,7 +1138,7 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return;
}
const declaration = type.symbol.declarations[0];
if (declaration.readonlyToken !== void 0 && !/^__@[^@]+$/.test(name)) {
if (declaration.readonlyToken !== undefined && !/^__@[^@]+$/.test(name)) {
return declaration.readonlyToken.kind !== ts9__default.default.SyntaxKind.MinusToken;
}
const { modifiersType } = type;
@ -1148,7 +1148,7 @@ function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
if (prop === void 0) {
if (prop === undefined) {
return false;
}
if (prop.flags & ts9__default.default.SymbolFlags.Transient) {
@ -1196,7 +1196,7 @@ function getDeclarationDomain(node) {
// TODO handle type-only imports
case ts9__default.default.SyntaxKind.ImportEqualsDeclaration:
case ts9__default.default.SyntaxKind.ImportSpecifier:
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : void 0;
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : undefined;
case ts9__default.default.SyntaxKind.InterfaceDeclaration:
case ts9__default.default.SyntaxKind.TypeAliasDeclaration:
case ts9__default.default.SyntaxKind.TypeParameter:
@ -1210,7 +1210,7 @@ function getDeclarationDomain(node) {
// falls through
case ts9__default.default.SyntaxKind.BindingElement:
case ts9__default.default.SyntaxKind.VariableDeclaration:
return node.parent.name === node ? 4 /* Value */ : void 0;
return node.parent.name === node ? 4 /* Value */ : undefined;
}
}
function getPropertyName(propertyName) {
@ -1223,7 +1223,7 @@ function getPropertyName(propertyName) {
negate = true;
// falls through
case ts9__default.default.SyntaxKind.PlusToken:
return ts9__default.default.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9__default.default.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : void 0;
return ts9__default.default.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9__default.default.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : undefined;
default:
return;
}
@ -1236,7 +1236,7 @@ function getPropertyName(propertyName) {
}
return;
}
return propertyName.kind === ts9__default.default.SyntaxKind.PrivateIdentifier ? void 0 : propertyName.text;
return propertyName.kind === ts9__default.default.SyntaxKind.PrivateIdentifier ? undefined : propertyName.text;
}
function unwrapParentheses(node) {
while (node.kind === ts9__default.default.SyntaxKind.ParenthesizedExpression) {
@ -1302,7 +1302,7 @@ function getUsageDomain(node) {
case ts9__default.default.SyntaxKind.ExportAssignment:
return 7 /* Any */;
case ts9__default.default.SyntaxKind.ExportSpecifier:
if (parent.propertyName === void 0 || parent.propertyName === node) {
if (parent.propertyName === undefined || parent.propertyName === node) {
return 7 /* Any */;
}
break;
@ -1319,7 +1319,7 @@ function getUsageDomain(node) {
case ts9__default.default.SyntaxKind.TypeQuery:
return 5 /* ValueOrNamespace */ | 8 /* TypeQuery */;
case ts9__default.default.SyntaxKind.TypeReference:
return identifierToKeywordKind(node) !== ts9__default.default.SyntaxKind.ConstKeyword ? 2 /* Type */ : void 0;
return identifierToKeywordKind(node) !== ts9__default.default.SyntaxKind.ConstKeyword ? 2 /* Type */ : undefined;
default:
return 5 /* ValueOrNamespace */;
}
@ -1357,10 +1357,10 @@ var AbstractScope = class {
constructor(global) {
this.global = global;
}
namespaceScopes = void 0;
namespaceScopes = undefined;
uses = [];
variables = /* @__PURE__ */ new Map();
#enumScopes = void 0;
#enumScopes = undefined;
addUse(use) {
this.uses.push(use);
}
@ -1372,7 +1372,7 @@ var AbstractScope = class {
exported
};
const variable = variables.get(identifier);
if (variable === void 0) {
if (variable === undefined) {
variables.set(identifier, {
declarations: [declaration],
domain,
@ -1386,12 +1386,12 @@ var AbstractScope = class {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
createOrReuseEnumScope(name, _exported) {
let scope;
if (this.#enumScopes === void 0) {
if (this.#enumScopes === undefined) {
this.#enumScopes = /* @__PURE__ */ new Map();
} else {
scope = this.#enumScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new EnumScope(this);
this.#enumScopes.set(name, scope);
}
@ -1400,12 +1400,12 @@ var AbstractScope = class {
// only relevant for the root scope
createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) {
let scope;
if (this.namespaceScopes === void 0) {
if (this.namespaceScopes === undefined) {
this.namespaceScopes = /* @__PURE__ */ new Map();
} else {
scope = this.namespaceScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new NamespaceScope(ambient, hasExportStatement, this);
this.namespaceScopes.set(name, scope);
} else {
@ -1414,10 +1414,10 @@ var AbstractScope = class {
return scope;
}
end(cb) {
if (this.namespaceScopes !== void 0) {
if (this.namespaceScopes !== undefined) {
this.namespaceScopes.forEach((value) => value.finish(cb));
}
this.namespaceScopes = this.#enumScopes = void 0;
this.namespaceScopes = this.#enumScopes = undefined;
this.applyUses();
this.variables.forEach((variable) => {
for (const declaration of variable.declarations) {
@ -1456,7 +1456,7 @@ var AbstractScope = class {
}
applyUse(use, variables = this.variables) {
const variable = variables.get(use.location.text);
if (variable === void 0 || (variable.domain & use.domain) === 0) {
if (variable === undefined || (variable.domain & use.domain) === 0) {
return false;
}
variable.uses.push(use);
@ -1581,7 +1581,7 @@ var FunctionExpressionScope = class extends AbstractNamedExpressionScope {
};
var NamespaceScope = class extends NonRootScope {
#ambient;
#exports = void 0;
#exports = undefined;
#hasExport;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(ambient, hasExport, parent) {
@ -1619,11 +1619,11 @@ var NamespaceScope = class extends NonRootScope {
}
end(cb) {
this.#innerScope.end((variable, key, scope) => {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== void 0 && !this.#exports.has(key.text))) {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== undefined && !this.#exports.has(key.text))) {
return cb(variable, key, scope);
}
const namespaceVar = this.variables.get(key.text);
if (namespaceVar === void 0) {
if (namespaceVar === undefined) {
this.variables.set(key.text, {
declarations: variable.declarations.map(mapDeclaration),
domain: variable.domain,
@ -1657,7 +1657,7 @@ var NamespaceScope = class extends NonRootScope {
return this.#innerScope;
}
markExported(name) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = /* @__PURE__ */ new Set();
}
this.#exports.add(name.text);
@ -1669,7 +1669,7 @@ var NamespaceScope = class extends NonRootScope {
};
var RootScope = class extends AbstractScope {
#exportAll;
#exports = void 0;
#exports = undefined;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(exportAll, global) {
super(global);
@ -1695,12 +1695,12 @@ var RootScope = class extends AbstractScope {
}
end(cb) {
this.#innerScope.end((value, key) => {
value.exported ||= this.#exportAll || this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= this.#exportAll || this.#exports !== undefined && this.#exports.includes(key.text);
value.inGlobalScope = this.global;
return cb(value, key, this);
});
return super.end((value, key, scope) => {
value.exported ||= scope === this && this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= scope === this && this.#exports !== undefined && this.#exports.includes(key.text);
return cb(value, key, scope);
});
}
@ -1708,7 +1708,7 @@ var RootScope = class extends AbstractScope {
return this;
}
markExported(id) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = [id.text];
} else {
this.#exports.push(id.text);
@ -1775,7 +1775,7 @@ var UsageWalker = class {
case ts9__default.default.SyntaxKind.ClassExpression:
return continueWithScope(
node,
node.name !== void 0 ? new ClassExpressionScope(
node.name !== undefined ? new ClassExpressionScope(
node.name,
this.#scope
) : new NonRootScope(this.#scope, 1 /* Function */)
@ -1819,7 +1819,7 @@ var UsageWalker = class {
}
break;
case ts9__default.default.SyntaxKind.ExportSpecifier:
if (node.propertyName !== void 0) {
if (node.propertyName !== undefined) {
return this.#scope.markExported(
node.propertyName,
node.name
@ -1828,7 +1828,7 @@ var UsageWalker = class {
return this.#scope.markExported(node.name);
case ts9__default.default.SyntaxKind.Identifier: {
const domain = getUsageDomain(node);
if (domain !== void 0) {
if (domain !== undefined) {
this.#scope.addUse({ domain, location: node });
}
return;
@ -1899,7 +1899,7 @@ var UsageWalker = class {
this.#scope = savedScope;
};
const handleBlockScope = (node) => {
if (node.kind === ts9__default.default.SyntaxKind.CatchClause && node.variableDeclaration !== void 0) {
if (node.kind === ts9__default.default.SyntaxKind.CatchClause && node.variableDeclaration !== undefined) {
this.#handleBindingName(
node.variableDeclaration.name,
true,
@ -1949,7 +1949,7 @@ var UsageWalker = class {
this.#scope = savedScope;
}
#handleDeclaration(node, blockScoped, domain) {
if (node.name !== void 0) {
if (node.name !== undefined) {
this.#scope.addVariable(
node.name.text,
node.name,
@ -1970,18 +1970,18 @@ var UsageWalker = class {
if (node.kind === ts9__default.default.SyntaxKind.FunctionDeclaration) {
this.#handleDeclaration(node, false, 4 /* Value */);
}
const scope = this.#scope = node.kind === ts9__default.default.SyntaxKind.FunctionExpression && node.name !== void 0 ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== void 0) {
const scope = this.#scope = node.kind === ts9__default.default.SyntaxKind.FunctionExpression && node.name !== undefined ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== undefined) {
cb(node.name);
}
if (node.typeParameters !== void 0) {
if (node.typeParameters !== undefined) {
node.typeParameters.forEach(cb);
}
node.parameters.forEach(cb);
if (node.type !== void 0) {
if (node.type !== undefined) {
cb(node.type);
}
if (node.body !== void 0) {
if (node.body !== undefined) {
scope.beginBody();
cb(node.body);
}
@ -2070,7 +2070,7 @@ function isNamespaceExported(node) {
return node.parent.kind === ts9__default.default.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9__default.default.SyntaxKind.ExportKeyword);
}
function namespaceHasExportStatement(ns) {
if (ns.body === void 0 || ns.body.kind !== ts9__default.default.SyntaxKind.ModuleBlock) {
if (ns.body === undefined || ns.body.kind !== ts9__default.default.SyntaxKind.ModuleBlock) {
return false;
}
return containsExportStatement(ns.body);

View file

@ -82,9 +82,9 @@ function isJsxElementOrFragment(node) {
function isCompilerOptionEnabled(options, option) {
switch (option) {
case "allowJs":
return options.allowJs === void 0 ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
return options.allowJs === undefined ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
case "allowSyntheticDefaultImports":
return options.allowSyntheticDefaultImports !== void 0 ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9.ModuleKind.System;
return options.allowSyntheticDefaultImports !== undefined ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9.ModuleKind.System;
case "alwaysStrict":
case "noImplicitAny":
case "noImplicitThis":
@ -103,7 +103,7 @@ function isCompilerOptionEnabled(options, option) {
case "stripInternal":
return options[option] === true && isCompilerOptionEnabled(options, "declaration");
case "incremental":
return options.incremental === void 0 ? isCompilerOptionEnabled(options, "composite") : options.incremental;
return options.incremental === undefined ? isCompilerOptionEnabled(options, "composite") : options.incremental;
case "noUncheckedIndexedAccess":
return options.noUncheckedIndexedAccess === true && isCompilerOptionEnabled(options, "strictNullChecks");
case "skipDefaultLibCheck":
@ -140,7 +140,7 @@ var isTypeFlagSet = isFlagSetOnObject;
// src/modifiers.ts
function includesModifier(modifiers, ...kinds) {
if (modifiers === void 0) {
if (modifiers === undefined) {
return false;
}
for (const modifier of modifiers) {
@ -263,7 +263,7 @@ function getAccessKind(node) {
function isInDestructuringAssignment(node) {
switch (node.kind) {
case ts9.SyntaxKind.ShorthandPropertyAssignment:
if (node.objectAssignmentInitializer !== void 0) {
if (node.objectAssignmentInitializer !== undefined) {
return true;
}
// falls through
@ -686,17 +686,17 @@ function isIterationStatement(node) {
}
}
function isJSDocNamespaceDeclaration(node) {
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && (node.body === void 0 || isJSDocNamespaceBody(node.body));
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && (node.body === undefined || isJSDocNamespaceBody(node.body));
}
function isJsxTagNamePropertyAccess(node) {
return ts9.isPropertyAccessExpression(node) && // eslint-disable-next-line @typescript-eslint/no-deprecated -- Keep compatibility with ts < 5
isJsxTagNameExpression(node.expression);
}
function isNamedDeclarationWithName(node) {
return "name" in node && node.name !== void 0 && node.name !== null && isDeclarationName(node.name);
return "name" in node && node.name !== undefined && node.name !== null && isDeclarationName(node.name);
}
function isNamespaceDeclaration(node) {
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && node.body !== void 0 && isNamespaceBody(node.body);
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && node.body !== undefined && isNamespaceBody(node.body);
}
function isNumericOrStringLikeLiteral(node) {
switch (node.kind) {
@ -888,13 +888,13 @@ function getCallSignaturesOfType(type) {
for (const subType of type.types) {
const sig = getCallSignaturesOfType(subType);
if (sig.length !== 0) {
if (signatures !== void 0) {
if (signatures !== undefined) {
return [];
}
signatures = sig;
}
}
return signatures === void 0 ? [] : signatures;
return signatures === undefined ? [] : signatures;
}
return type.getCallSignatures();
}
@ -910,8 +910,8 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
if (!prop.name.startsWith(prefix)) {
continue;
}
const declaration = prop.valueDeclaration ?? prop.getDeclarations()[0];
if (!isNamedDeclarationWithName(declaration) || declaration.name === void 0 || !ts9.isComputedPropertyName(declaration.name)) {
const declaration = prop.valueDeclaration ?? prop.getDeclarations()?.[0];
if (!declaration || !isNamedDeclarationWithName(declaration) || declaration.name === undefined || !ts9.isComputedPropertyName(declaration.name)) {
continue;
}
const globalSymbol = typeChecker.getApparentType(
@ -925,7 +925,7 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
return prop;
}
}
return void 0;
return undefined;
}
function getPropertyNameOfWellKnownSymbol(typeChecker, symbolConstructor, symbolName) {
const knownSymbol = symbolConstructor && typeChecker.getTypeOfSymbolAtLocation(
@ -967,7 +967,7 @@ function isInConstContext(node, typeChecker) {
const functionSignature = typeChecker.getResolvedSignature(
parent
);
if (functionSignature === void 0) {
if (functionSignature === undefined) {
return false;
}
const argumentIndex = parent.arguments.indexOf(
@ -977,12 +977,12 @@ function isInConstContext(node, typeChecker) {
return false;
}
const parameterSymbol = functionSignature.getParameters()[argumentIndex];
if (parameterSymbol === void 0 || !("links" in parameterSymbol)) {
if (parameterSymbol === undefined || !("links" in parameterSymbol)) {
return false;
}
const parameterSymbolLinks = parameterSymbol.links;
const propertySymbol = parameterSymbolLinks.type?.getProperties()?.[argumentIndex];
if (propertySymbol === void 0 || !("links" in propertySymbol)) {
if (propertySymbol === undefined || !("links" in propertySymbol)) {
return false;
}
return isTransientSymbolLinksFlagSet(
@ -1041,8 +1041,8 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
if (getPropertyOfType(subType, name) === void 0) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : void 0) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);
if (index?.isReadonly) {
if (seenProperty) {
return true;
@ -1060,7 +1060,7 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
if (then === void 0) {
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
@ -1101,7 +1101,7 @@ function isCallback(typeChecker, param, node) {
);
if (param.valueDeclaration.dotDotDotToken) {
type = type.getNumberIndexType();
if (type === void 0) {
if (type === undefined) {
return false;
}
}
@ -1117,14 +1117,14 @@ function isReadonlyAssignmentDeclaration(node, typeChecker) {
return false;
}
const descriptorType = typeChecker.getTypeAtLocation(node.arguments[2]);
if (descriptorType.getProperty("value") === void 0) {
return descriptorType.getProperty("set") === void 0;
if (descriptorType.getProperty("value") === undefined) {
return descriptorType.getProperty("set") === undefined;
}
const writableProp = descriptorType.getProperty("writable");
if (writableProp === void 0) {
if (writableProp === undefined) {
return false;
}
const writableType = writableProp.valueDeclaration !== void 0 && ts9.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
const writableType = writableProp.valueDeclaration !== undefined && ts9.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
return isFalseLiteralType(writableType);
}
function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
@ -1132,7 +1132,7 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return;
}
const declaration = type.symbol.declarations[0];
if (declaration.readonlyToken !== void 0 && !/^__@[^@]+$/.test(name)) {
if (declaration.readonlyToken !== undefined && !/^__@[^@]+$/.test(name)) {
return declaration.readonlyToken.kind !== ts9.SyntaxKind.MinusToken;
}
const { modifiersType } = type;
@ -1142,7 +1142,7 @@ function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
if (prop === void 0) {
if (prop === undefined) {
return false;
}
if (prop.flags & ts9.SymbolFlags.Transient) {
@ -1190,7 +1190,7 @@ function getDeclarationDomain(node) {
// TODO handle type-only imports
case ts9.SyntaxKind.ImportEqualsDeclaration:
case ts9.SyntaxKind.ImportSpecifier:
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : void 0;
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : undefined;
case ts9.SyntaxKind.InterfaceDeclaration:
case ts9.SyntaxKind.TypeAliasDeclaration:
case ts9.SyntaxKind.TypeParameter:
@ -1204,7 +1204,7 @@ function getDeclarationDomain(node) {
// falls through
case ts9.SyntaxKind.BindingElement:
case ts9.SyntaxKind.VariableDeclaration:
return node.parent.name === node ? 4 /* Value */ : void 0;
return node.parent.name === node ? 4 /* Value */ : undefined;
}
}
function getPropertyName(propertyName) {
@ -1217,7 +1217,7 @@ function getPropertyName(propertyName) {
negate = true;
// falls through
case ts9.SyntaxKind.PlusToken:
return ts9.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : void 0;
return ts9.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : undefined;
default:
return;
}
@ -1230,7 +1230,7 @@ function getPropertyName(propertyName) {
}
return;
}
return propertyName.kind === ts9.SyntaxKind.PrivateIdentifier ? void 0 : propertyName.text;
return propertyName.kind === ts9.SyntaxKind.PrivateIdentifier ? undefined : propertyName.text;
}
function unwrapParentheses(node) {
while (node.kind === ts9.SyntaxKind.ParenthesizedExpression) {
@ -1296,7 +1296,7 @@ function getUsageDomain(node) {
case ts9.SyntaxKind.ExportAssignment:
return 7 /* Any */;
case ts9.SyntaxKind.ExportSpecifier:
if (parent.propertyName === void 0 || parent.propertyName === node) {
if (parent.propertyName === undefined || parent.propertyName === node) {
return 7 /* Any */;
}
break;
@ -1313,7 +1313,7 @@ function getUsageDomain(node) {
case ts9.SyntaxKind.TypeQuery:
return 5 /* ValueOrNamespace */ | 8 /* TypeQuery */;
case ts9.SyntaxKind.TypeReference:
return identifierToKeywordKind(node) !== ts9.SyntaxKind.ConstKeyword ? 2 /* Type */ : void 0;
return identifierToKeywordKind(node) !== ts9.SyntaxKind.ConstKeyword ? 2 /* Type */ : undefined;
default:
return 5 /* ValueOrNamespace */;
}
@ -1351,10 +1351,10 @@ var AbstractScope = class {
constructor(global) {
this.global = global;
}
namespaceScopes = void 0;
namespaceScopes = undefined;
uses = [];
variables = /* @__PURE__ */ new Map();
#enumScopes = void 0;
#enumScopes = undefined;
addUse(use) {
this.uses.push(use);
}
@ -1366,7 +1366,7 @@ var AbstractScope = class {
exported
};
const variable = variables.get(identifier);
if (variable === void 0) {
if (variable === undefined) {
variables.set(identifier, {
declarations: [declaration],
domain,
@ -1380,12 +1380,12 @@ var AbstractScope = class {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
createOrReuseEnumScope(name, _exported) {
let scope;
if (this.#enumScopes === void 0) {
if (this.#enumScopes === undefined) {
this.#enumScopes = /* @__PURE__ */ new Map();
} else {
scope = this.#enumScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new EnumScope(this);
this.#enumScopes.set(name, scope);
}
@ -1394,12 +1394,12 @@ var AbstractScope = class {
// only relevant for the root scope
createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) {
let scope;
if (this.namespaceScopes === void 0) {
if (this.namespaceScopes === undefined) {
this.namespaceScopes = /* @__PURE__ */ new Map();
} else {
scope = this.namespaceScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new NamespaceScope(ambient, hasExportStatement, this);
this.namespaceScopes.set(name, scope);
} else {
@ -1408,10 +1408,10 @@ var AbstractScope = class {
return scope;
}
end(cb) {
if (this.namespaceScopes !== void 0) {
if (this.namespaceScopes !== undefined) {
this.namespaceScopes.forEach((value) => value.finish(cb));
}
this.namespaceScopes = this.#enumScopes = void 0;
this.namespaceScopes = this.#enumScopes = undefined;
this.applyUses();
this.variables.forEach((variable) => {
for (const declaration of variable.declarations) {
@ -1450,7 +1450,7 @@ var AbstractScope = class {
}
applyUse(use, variables = this.variables) {
const variable = variables.get(use.location.text);
if (variable === void 0 || (variable.domain & use.domain) === 0) {
if (variable === undefined || (variable.domain & use.domain) === 0) {
return false;
}
variable.uses.push(use);
@ -1575,7 +1575,7 @@ var FunctionExpressionScope = class extends AbstractNamedExpressionScope {
};
var NamespaceScope = class extends NonRootScope {
#ambient;
#exports = void 0;
#exports = undefined;
#hasExport;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(ambient, hasExport, parent) {
@ -1613,11 +1613,11 @@ var NamespaceScope = class extends NonRootScope {
}
end(cb) {
this.#innerScope.end((variable, key, scope) => {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== void 0 && !this.#exports.has(key.text))) {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== undefined && !this.#exports.has(key.text))) {
return cb(variable, key, scope);
}
const namespaceVar = this.variables.get(key.text);
if (namespaceVar === void 0) {
if (namespaceVar === undefined) {
this.variables.set(key.text, {
declarations: variable.declarations.map(mapDeclaration),
domain: variable.domain,
@ -1651,7 +1651,7 @@ var NamespaceScope = class extends NonRootScope {
return this.#innerScope;
}
markExported(name) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = /* @__PURE__ */ new Set();
}
this.#exports.add(name.text);
@ -1663,7 +1663,7 @@ var NamespaceScope = class extends NonRootScope {
};
var RootScope = class extends AbstractScope {
#exportAll;
#exports = void 0;
#exports = undefined;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(exportAll, global) {
super(global);
@ -1689,12 +1689,12 @@ var RootScope = class extends AbstractScope {
}
end(cb) {
this.#innerScope.end((value, key) => {
value.exported ||= this.#exportAll || this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= this.#exportAll || this.#exports !== undefined && this.#exports.includes(key.text);
value.inGlobalScope = this.global;
return cb(value, key, this);
});
return super.end((value, key, scope) => {
value.exported ||= scope === this && this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= scope === this && this.#exports !== undefined && this.#exports.includes(key.text);
return cb(value, key, scope);
});
}
@ -1702,7 +1702,7 @@ var RootScope = class extends AbstractScope {
return this;
}
markExported(id) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = [id.text];
} else {
this.#exports.push(id.text);
@ -1769,7 +1769,7 @@ var UsageWalker = class {
case ts9.SyntaxKind.ClassExpression:
return continueWithScope(
node,
node.name !== void 0 ? new ClassExpressionScope(
node.name !== undefined ? new ClassExpressionScope(
node.name,
this.#scope
) : new NonRootScope(this.#scope, 1 /* Function */)
@ -1813,7 +1813,7 @@ var UsageWalker = class {
}
break;
case ts9.SyntaxKind.ExportSpecifier:
if (node.propertyName !== void 0) {
if (node.propertyName !== undefined) {
return this.#scope.markExported(
node.propertyName,
node.name
@ -1822,7 +1822,7 @@ var UsageWalker = class {
return this.#scope.markExported(node.name);
case ts9.SyntaxKind.Identifier: {
const domain = getUsageDomain(node);
if (domain !== void 0) {
if (domain !== undefined) {
this.#scope.addUse({ domain, location: node });
}
return;
@ -1893,7 +1893,7 @@ var UsageWalker = class {
this.#scope = savedScope;
};
const handleBlockScope = (node) => {
if (node.kind === ts9.SyntaxKind.CatchClause && node.variableDeclaration !== void 0) {
if (node.kind === ts9.SyntaxKind.CatchClause && node.variableDeclaration !== undefined) {
this.#handleBindingName(
node.variableDeclaration.name,
true,
@ -1943,7 +1943,7 @@ var UsageWalker = class {
this.#scope = savedScope;
}
#handleDeclaration(node, blockScoped, domain) {
if (node.name !== void 0) {
if (node.name !== undefined) {
this.#scope.addVariable(
node.name.text,
node.name,
@ -1964,18 +1964,18 @@ var UsageWalker = class {
if (node.kind === ts9.SyntaxKind.FunctionDeclaration) {
this.#handleDeclaration(node, false, 4 /* Value */);
}
const scope = this.#scope = node.kind === ts9.SyntaxKind.FunctionExpression && node.name !== void 0 ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== void 0) {
const scope = this.#scope = node.kind === ts9.SyntaxKind.FunctionExpression && node.name !== undefined ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== undefined) {
cb(node.name);
}
if (node.typeParameters !== void 0) {
if (node.typeParameters !== undefined) {
node.typeParameters.forEach(cb);
}
node.parameters.forEach(cb);
if (node.type !== void 0) {
if (node.type !== undefined) {
cb(node.type);
}
if (node.body !== void 0) {
if (node.body !== undefined) {
scope.beginBody();
cb(node.body);
}
@ -2064,7 +2064,7 @@ function isNamespaceExported(node) {
return node.parent.kind === ts9.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9.SyntaxKind.ExportKeyword);
}
function namespaceHasExportStatement(ns) {
if (ns.body === void 0 || ns.body.kind !== ts9.SyntaxKind.ModuleBlock) {
if (ns.body === undefined || ns.body.kind !== ts9.SyntaxKind.ModuleBlock) {
return false;
}
return containsExportStatement(ns.body);

View file

@ -1,6 +1,6 @@
{
"name": "ts-api-utils",
"version": "2.0.0",
"version": "2.0.1",
"description": "Utility functions for working with TypeScript's API. Successor to the wonderful tsutils. 🛠️️",
"repository": {
"type": "git",
@ -51,51 +51,51 @@
},
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
"@eslint/js": "^9.15.0",
"@eslint/js": "^9.19.0",
"@phenomnomnominal/tsquery": "^6.1.3",
"@release-it/conventional-changelog": "^9.0.3",
"@release-it/conventional-changelog": "^10.0.0",
"@types/eslint-plugin-markdown": "^2.0.2",
"@types/node": "^18.19.65",
"@types/node": "^18.19.74",
"@typescript/vfs": "^1.6.0",
"@vitest/coverage-v8": "^2.1.5",
"@vitest/eslint-plugin": "^1.1.10",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/eslint-plugin": "^1.1.25",
"console-fail-test": "^0.5.0",
"cspell": "^8.16.0",
"eslint": "^9.15.0",
"eslint-plugin-jsdoc": "^50.5.0",
"eslint-plugin-jsonc": "^2.18.2",
"cspell": "^8.17.3",
"eslint": "^9.19.0",
"eslint-plugin-jsdoc": "^50.6.3",
"eslint-plugin-jsonc": "^2.19.1",
"eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-package-json": "^0.15.6",
"eslint-plugin-perfectionist": "^4.1.2",
"eslint-plugin-n": "^17.15.1",
"eslint-plugin-package-json": "^0.19.0",
"eslint-plugin-perfectionist": "^4.7.0",
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-yml": "^1.15.0",
"eslint-plugin-yml": "^1.16.0",
"husky": "^9.1.7",
"jsonc-eslint-parser": "^2.4.0",
"knip": "^5.37.2",
"lint-staged": "^15.2.10",
"markdownlint": "^0.36.1",
"knip": "^5.43.6",
"lint-staged": "^15.4.3",
"markdownlint": "^0.37.4",
"markdownlint-cli": "^0.43.0",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"prettier-plugin-curly": "^0.3.1",
"prettier-plugin-packagejson": "^2.5.6",
"release-it": "^17.10.0",
"sentences-per-line": "^0.2.1",
"prettier-plugin-packagejson": "^2.5.8",
"release-it": "^18.1.2",
"sentences-per-line": "^0.3.0",
"should-semantic-release": "^0.3.0",
"tsup": "^8.3.5",
"typedoc": "^0.26.11",
"typedoc-plugin-coverage": "^3.4.0",
"tsup": "^8.3.6",
"typedoc": "^0.27.6",
"typedoc-plugin-coverage": "^3.4.1",
"typedoc-plugin-custom-validation": "^2.0.2",
"typedoc-plugin-konamimojisplosion": "^0.0.2",
"typedoc-plugin-mdn-links": "^4.0.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"vitest": "^2.1.5"
"typedoc-plugin-mdn-links": "^4.0.10",
"typescript": "^5.7.3",
"typescript-eslint": "^8.22.0",
"vitest": "^2.1.8"
},
"peerDependencies": {
"typescript": ">=4.8.4"
},
"packageManager": "pnpm@9.14.2",
"packageManager": "pnpm@9.15.3",
"engines": {
"node": ">=18.12"
},

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
"version": "8.22.0",
"version": "8.23.0",
"description": "TypeScript plugin for ESLint",
"files": [
"dist",
@ -61,22 +61,22 @@
},
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.22.0",
"@typescript-eslint/type-utils": "8.22.0",
"@typescript-eslint/utils": "8.22.0",
"@typescript-eslint/visitor-keys": "8.22.0",
"@typescript-eslint/scope-manager": "8.23.0",
"@typescript-eslint/type-utils": "8.23.0",
"@typescript-eslint/utils": "8.23.0",
"@typescript-eslint/visitor-keys": "8.23.0",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
"ts-api-utils": "^2.0.0"
"ts-api-utils": "^2.0.1"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/marked": "^5.0.2",
"@types/mdast": "^4.0.3",
"@types/natural-compare": "*",
"@typescript-eslint/rule-schema-to-typescript-types": "8.22.0",
"@typescript-eslint/rule-tester": "8.22.0",
"@typescript-eslint/rule-schema-to-typescript-types": "8.23.0",
"@typescript-eslint/rule-tester": "8.23.0",
"ajv": "^6.12.6",
"cross-env": "^7.0.3",
"cross-fetch": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.22.0",
"version": "8.23.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -46,13 +46,13 @@
"typecheck": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/visitor-keys": "8.22.0"
"@typescript-eslint/types": "8.23.0",
"@typescript-eslint/visitor-keys": "8.23.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "8.22.0",
"@typescript-eslint/typescript-estree": "8.23.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",

View file

@ -54,6 +54,24 @@ declare module './generated/ast-spec' {
interface ImportSpecifier {
parent: TSESTree.ExportAllDeclaration | TSESTree.ExportNamedDeclaration | TSESTree.ImportDeclaration;
}
interface ExportDefaultDeclaration {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface ExportNamedDeclarationWithoutSourceWithMultiple {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface ExportNamedDeclarationWithoutSourceWithSingle {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface ExportNamedDeclarationWithSource {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface FunctionDeclarationWithName {
parent: TSESTree.BlockStatement | TSESTree.ExportDefaultDeclaration | TSESTree.ExportNamedDeclaration | TSESTree.Program;
}
interface FunctionDeclarationWithOptionalName {
parent: TSESTree.ExportDefaultDeclaration;
}
interface JSXAttribute {
parent: TSESTree.JSXOpeningElement;
}

View file

@ -1 +1 @@
{"version":3,"file":"ts-estree.d.ts","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAGtD,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;KACvB;IAED,UAAU,OAAO;QACf;;WAEG;QACH,MAAM,CAAC,EAAE,KAAK,CAAC;KAChB;IAED,UAAU,4BAA4B;QACpC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IACD,UAAU,+BAA+B;QACvC,MAAM,EAAE,QA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AAC;KAC5B;IAED,UAAU,eAAe;QACvB,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;KACzC;IAED,UAAU,mBAAmB;QAC3B,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC;KAClC;IAED,UAAU,6BAA6B;QACrC,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IACD,UAAU,gCAAgC;QACxC,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IAED,UAAU,aAAa;QACrB,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IAED,UAAU,mBAAmB;QAC3B,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC;KAC/B;IAED,UAAU,+BAA+B;QACvC,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IACD,UAAU,kCAAkC;QAC1C,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IAED,UAAU,eAAe;QACvB,MAAM,EACF,QAAQ,CAAC,WAAW,GACpB,QAAQ,CAAC,YAAY,GACrB,QAAQ,CAAC,0BAA0B,CAAC;KACzC;IAED,UAAU,kCAAkC;QAC1C,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;KACzC;IACD,UAAU,uCAAuC;QAC/C,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;KACzC;CACF;AAED,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC"}

View file

@ -1 +1 @@
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmOA,iEAAiD"}
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+PA,iEAAiD"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.22.0",
"version": "8.23.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.22.0",
"version": "8.23.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -54,14 +54,14 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/visitor-keys": "8.22.0",
"@typescript-eslint/types": "8.23.0",
"@typescript-eslint/visitor-keys": "8.23.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
"ts-api-utils": "^2.0.0"
"ts-api-utils": "^2.0.1"
},
"devDependencies": {
"@jest/types": "29.6.3",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.22.0",
"version": "8.23.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -47,7 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/types": "8.23.0",
"eslint-visitor-keys": "^4.2.0"
},
"devDependencies": {

View file

@ -88,9 +88,9 @@ function isJsxElementOrFragment(node) {
function isCompilerOptionEnabled(options, option) {
switch (option) {
case "allowJs":
return options.allowJs === void 0 ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
return options.allowJs === undefined ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
case "allowSyntheticDefaultImports":
return options.allowSyntheticDefaultImports !== void 0 ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9__default.default.ModuleKind.System;
return options.allowSyntheticDefaultImports !== undefined ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9__default.default.ModuleKind.System;
case "alwaysStrict":
case "noImplicitAny":
case "noImplicitThis":
@ -109,7 +109,7 @@ function isCompilerOptionEnabled(options, option) {
case "stripInternal":
return options[option] === true && isCompilerOptionEnabled(options, "declaration");
case "incremental":
return options.incremental === void 0 ? isCompilerOptionEnabled(options, "composite") : options.incremental;
return options.incremental === undefined ? isCompilerOptionEnabled(options, "composite") : options.incremental;
case "noUncheckedIndexedAccess":
return options.noUncheckedIndexedAccess === true && isCompilerOptionEnabled(options, "strictNullChecks");
case "skipDefaultLibCheck":
@ -146,7 +146,7 @@ var isTypeFlagSet = isFlagSetOnObject;
// src/modifiers.ts
function includesModifier(modifiers, ...kinds) {
if (modifiers === void 0) {
if (modifiers === undefined) {
return false;
}
for (const modifier of modifiers) {
@ -269,7 +269,7 @@ function getAccessKind(node) {
function isInDestructuringAssignment(node) {
switch (node.kind) {
case ts9__default.default.SyntaxKind.ShorthandPropertyAssignment:
if (node.objectAssignmentInitializer !== void 0) {
if (node.objectAssignmentInitializer !== undefined) {
return true;
}
// falls through
@ -692,17 +692,17 @@ function isIterationStatement(node) {
}
}
function isJSDocNamespaceDeclaration(node) {
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && (node.body === void 0 || isJSDocNamespaceBody(node.body));
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && (node.body === undefined || isJSDocNamespaceBody(node.body));
}
function isJsxTagNamePropertyAccess(node) {
return ts9__default.default.isPropertyAccessExpression(node) && // eslint-disable-next-line @typescript-eslint/no-deprecated -- Keep compatibility with ts < 5
isJsxTagNameExpression(node.expression);
}
function isNamedDeclarationWithName(node) {
return "name" in node && node.name !== void 0 && node.name !== null && isDeclarationName(node.name);
return "name" in node && node.name !== undefined && node.name !== null && isDeclarationName(node.name);
}
function isNamespaceDeclaration(node) {
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && node.body !== void 0 && isNamespaceBody(node.body);
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && node.body !== undefined && isNamespaceBody(node.body);
}
function isNumericOrStringLikeLiteral(node) {
switch (node.kind) {
@ -894,13 +894,13 @@ function getCallSignaturesOfType(type) {
for (const subType of type.types) {
const sig = getCallSignaturesOfType(subType);
if (sig.length !== 0) {
if (signatures !== void 0) {
if (signatures !== undefined) {
return [];
}
signatures = sig;
}
}
return signatures === void 0 ? [] : signatures;
return signatures === undefined ? [] : signatures;
}
return type.getCallSignatures();
}
@ -916,8 +916,8 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
if (!prop.name.startsWith(prefix)) {
continue;
}
const declaration = prop.valueDeclaration ?? prop.getDeclarations()[0];
if (!isNamedDeclarationWithName(declaration) || declaration.name === void 0 || !ts9__default.default.isComputedPropertyName(declaration.name)) {
const declaration = prop.valueDeclaration ?? prop.getDeclarations()?.[0];
if (!declaration || !isNamedDeclarationWithName(declaration) || declaration.name === undefined || !ts9__default.default.isComputedPropertyName(declaration.name)) {
continue;
}
const globalSymbol = typeChecker.getApparentType(
@ -931,7 +931,7 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
return prop;
}
}
return void 0;
return undefined;
}
function getPropertyNameOfWellKnownSymbol(typeChecker, symbolConstructor, symbolName) {
const knownSymbol = symbolConstructor && typeChecker.getTypeOfSymbolAtLocation(
@ -973,7 +973,7 @@ function isInConstContext(node, typeChecker) {
const functionSignature = typeChecker.getResolvedSignature(
parent
);
if (functionSignature === void 0) {
if (functionSignature === undefined) {
return false;
}
const argumentIndex = parent.arguments.indexOf(
@ -983,12 +983,12 @@ function isInConstContext(node, typeChecker) {
return false;
}
const parameterSymbol = functionSignature.getParameters()[argumentIndex];
if (parameterSymbol === void 0 || !("links" in parameterSymbol)) {
if (parameterSymbol === undefined || !("links" in parameterSymbol)) {
return false;
}
const parameterSymbolLinks = parameterSymbol.links;
const propertySymbol = parameterSymbolLinks.type?.getProperties()?.[argumentIndex];
if (propertySymbol === void 0 || !("links" in propertySymbol)) {
if (propertySymbol === undefined || !("links" in propertySymbol)) {
return false;
}
return isTransientSymbolLinksFlagSet(
@ -1047,8 +1047,8 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
if (getPropertyOfType(subType, name) === void 0) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.Number) : void 0) ?? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.String);
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.String);
if (index?.isReadonly) {
if (seenProperty) {
return true;
@ -1066,7 +1066,7 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
if (then === void 0) {
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
@ -1107,7 +1107,7 @@ function isCallback(typeChecker, param, node) {
);
if (param.valueDeclaration.dotDotDotToken) {
type = type.getNumberIndexType();
if (type === void 0) {
if (type === undefined) {
return false;
}
}
@ -1123,14 +1123,14 @@ function isReadonlyAssignmentDeclaration(node, typeChecker) {
return false;
}
const descriptorType = typeChecker.getTypeAtLocation(node.arguments[2]);
if (descriptorType.getProperty("value") === void 0) {
return descriptorType.getProperty("set") === void 0;
if (descriptorType.getProperty("value") === undefined) {
return descriptorType.getProperty("set") === undefined;
}
const writableProp = descriptorType.getProperty("writable");
if (writableProp === void 0) {
if (writableProp === undefined) {
return false;
}
const writableType = writableProp.valueDeclaration !== void 0 && ts9__default.default.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
const writableType = writableProp.valueDeclaration !== undefined && ts9__default.default.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
return isFalseLiteralType(writableType);
}
function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
@ -1138,7 +1138,7 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return;
}
const declaration = type.symbol.declarations[0];
if (declaration.readonlyToken !== void 0 && !/^__@[^@]+$/.test(name)) {
if (declaration.readonlyToken !== undefined && !/^__@[^@]+$/.test(name)) {
return declaration.readonlyToken.kind !== ts9__default.default.SyntaxKind.MinusToken;
}
const { modifiersType } = type;
@ -1148,7 +1148,7 @@ function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
if (prop === void 0) {
if (prop === undefined) {
return false;
}
if (prop.flags & ts9__default.default.SymbolFlags.Transient) {
@ -1196,7 +1196,7 @@ function getDeclarationDomain(node) {
// TODO handle type-only imports
case ts9__default.default.SyntaxKind.ImportEqualsDeclaration:
case ts9__default.default.SyntaxKind.ImportSpecifier:
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : void 0;
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : undefined;
case ts9__default.default.SyntaxKind.InterfaceDeclaration:
case ts9__default.default.SyntaxKind.TypeAliasDeclaration:
case ts9__default.default.SyntaxKind.TypeParameter:
@ -1210,7 +1210,7 @@ function getDeclarationDomain(node) {
// falls through
case ts9__default.default.SyntaxKind.BindingElement:
case ts9__default.default.SyntaxKind.VariableDeclaration:
return node.parent.name === node ? 4 /* Value */ : void 0;
return node.parent.name === node ? 4 /* Value */ : undefined;
}
}
function getPropertyName(propertyName) {
@ -1223,7 +1223,7 @@ function getPropertyName(propertyName) {
negate = true;
// falls through
case ts9__default.default.SyntaxKind.PlusToken:
return ts9__default.default.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9__default.default.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : void 0;
return ts9__default.default.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9__default.default.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : undefined;
default:
return;
}
@ -1236,7 +1236,7 @@ function getPropertyName(propertyName) {
}
return;
}
return propertyName.kind === ts9__default.default.SyntaxKind.PrivateIdentifier ? void 0 : propertyName.text;
return propertyName.kind === ts9__default.default.SyntaxKind.PrivateIdentifier ? undefined : propertyName.text;
}
function unwrapParentheses(node) {
while (node.kind === ts9__default.default.SyntaxKind.ParenthesizedExpression) {
@ -1302,7 +1302,7 @@ function getUsageDomain(node) {
case ts9__default.default.SyntaxKind.ExportAssignment:
return 7 /* Any */;
case ts9__default.default.SyntaxKind.ExportSpecifier:
if (parent.propertyName === void 0 || parent.propertyName === node) {
if (parent.propertyName === undefined || parent.propertyName === node) {
return 7 /* Any */;
}
break;
@ -1319,7 +1319,7 @@ function getUsageDomain(node) {
case ts9__default.default.SyntaxKind.TypeQuery:
return 5 /* ValueOrNamespace */ | 8 /* TypeQuery */;
case ts9__default.default.SyntaxKind.TypeReference:
return identifierToKeywordKind(node) !== ts9__default.default.SyntaxKind.ConstKeyword ? 2 /* Type */ : void 0;
return identifierToKeywordKind(node) !== ts9__default.default.SyntaxKind.ConstKeyword ? 2 /* Type */ : undefined;
default:
return 5 /* ValueOrNamespace */;
}
@ -1357,10 +1357,10 @@ var AbstractScope = class {
constructor(global) {
this.global = global;
}
namespaceScopes = void 0;
namespaceScopes = undefined;
uses = [];
variables = /* @__PURE__ */ new Map();
#enumScopes = void 0;
#enumScopes = undefined;
addUse(use) {
this.uses.push(use);
}
@ -1372,7 +1372,7 @@ var AbstractScope = class {
exported
};
const variable = variables.get(identifier);
if (variable === void 0) {
if (variable === undefined) {
variables.set(identifier, {
declarations: [declaration],
domain,
@ -1386,12 +1386,12 @@ var AbstractScope = class {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
createOrReuseEnumScope(name, _exported) {
let scope;
if (this.#enumScopes === void 0) {
if (this.#enumScopes === undefined) {
this.#enumScopes = /* @__PURE__ */ new Map();
} else {
scope = this.#enumScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new EnumScope(this);
this.#enumScopes.set(name, scope);
}
@ -1400,12 +1400,12 @@ var AbstractScope = class {
// only relevant for the root scope
createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) {
let scope;
if (this.namespaceScopes === void 0) {
if (this.namespaceScopes === undefined) {
this.namespaceScopes = /* @__PURE__ */ new Map();
} else {
scope = this.namespaceScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new NamespaceScope(ambient, hasExportStatement, this);
this.namespaceScopes.set(name, scope);
} else {
@ -1414,10 +1414,10 @@ var AbstractScope = class {
return scope;
}
end(cb) {
if (this.namespaceScopes !== void 0) {
if (this.namespaceScopes !== undefined) {
this.namespaceScopes.forEach((value) => value.finish(cb));
}
this.namespaceScopes = this.#enumScopes = void 0;
this.namespaceScopes = this.#enumScopes = undefined;
this.applyUses();
this.variables.forEach((variable) => {
for (const declaration of variable.declarations) {
@ -1456,7 +1456,7 @@ var AbstractScope = class {
}
applyUse(use, variables = this.variables) {
const variable = variables.get(use.location.text);
if (variable === void 0 || (variable.domain & use.domain) === 0) {
if (variable === undefined || (variable.domain & use.domain) === 0) {
return false;
}
variable.uses.push(use);
@ -1581,7 +1581,7 @@ var FunctionExpressionScope = class extends AbstractNamedExpressionScope {
};
var NamespaceScope = class extends NonRootScope {
#ambient;
#exports = void 0;
#exports = undefined;
#hasExport;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(ambient, hasExport, parent) {
@ -1619,11 +1619,11 @@ var NamespaceScope = class extends NonRootScope {
}
end(cb) {
this.#innerScope.end((variable, key, scope) => {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== void 0 && !this.#exports.has(key.text))) {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== undefined && !this.#exports.has(key.text))) {
return cb(variable, key, scope);
}
const namespaceVar = this.variables.get(key.text);
if (namespaceVar === void 0) {
if (namespaceVar === undefined) {
this.variables.set(key.text, {
declarations: variable.declarations.map(mapDeclaration),
domain: variable.domain,
@ -1657,7 +1657,7 @@ var NamespaceScope = class extends NonRootScope {
return this.#innerScope;
}
markExported(name) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = /* @__PURE__ */ new Set();
}
this.#exports.add(name.text);
@ -1669,7 +1669,7 @@ var NamespaceScope = class extends NonRootScope {
};
var RootScope = class extends AbstractScope {
#exportAll;
#exports = void 0;
#exports = undefined;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(exportAll, global) {
super(global);
@ -1695,12 +1695,12 @@ var RootScope = class extends AbstractScope {
}
end(cb) {
this.#innerScope.end((value, key) => {
value.exported ||= this.#exportAll || this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= this.#exportAll || this.#exports !== undefined && this.#exports.includes(key.text);
value.inGlobalScope = this.global;
return cb(value, key, this);
});
return super.end((value, key, scope) => {
value.exported ||= scope === this && this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= scope === this && this.#exports !== undefined && this.#exports.includes(key.text);
return cb(value, key, scope);
});
}
@ -1708,7 +1708,7 @@ var RootScope = class extends AbstractScope {
return this;
}
markExported(id) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = [id.text];
} else {
this.#exports.push(id.text);
@ -1775,7 +1775,7 @@ var UsageWalker = class {
case ts9__default.default.SyntaxKind.ClassExpression:
return continueWithScope(
node,
node.name !== void 0 ? new ClassExpressionScope(
node.name !== undefined ? new ClassExpressionScope(
node.name,
this.#scope
) : new NonRootScope(this.#scope, 1 /* Function */)
@ -1819,7 +1819,7 @@ var UsageWalker = class {
}
break;
case ts9__default.default.SyntaxKind.ExportSpecifier:
if (node.propertyName !== void 0) {
if (node.propertyName !== undefined) {
return this.#scope.markExported(
node.propertyName,
node.name
@ -1828,7 +1828,7 @@ var UsageWalker = class {
return this.#scope.markExported(node.name);
case ts9__default.default.SyntaxKind.Identifier: {
const domain = getUsageDomain(node);
if (domain !== void 0) {
if (domain !== undefined) {
this.#scope.addUse({ domain, location: node });
}
return;
@ -1899,7 +1899,7 @@ var UsageWalker = class {
this.#scope = savedScope;
};
const handleBlockScope = (node) => {
if (node.kind === ts9__default.default.SyntaxKind.CatchClause && node.variableDeclaration !== void 0) {
if (node.kind === ts9__default.default.SyntaxKind.CatchClause && node.variableDeclaration !== undefined) {
this.#handleBindingName(
node.variableDeclaration.name,
true,
@ -1949,7 +1949,7 @@ var UsageWalker = class {
this.#scope = savedScope;
}
#handleDeclaration(node, blockScoped, domain) {
if (node.name !== void 0) {
if (node.name !== undefined) {
this.#scope.addVariable(
node.name.text,
node.name,
@ -1970,18 +1970,18 @@ var UsageWalker = class {
if (node.kind === ts9__default.default.SyntaxKind.FunctionDeclaration) {
this.#handleDeclaration(node, false, 4 /* Value */);
}
const scope = this.#scope = node.kind === ts9__default.default.SyntaxKind.FunctionExpression && node.name !== void 0 ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== void 0) {
const scope = this.#scope = node.kind === ts9__default.default.SyntaxKind.FunctionExpression && node.name !== undefined ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== undefined) {
cb(node.name);
}
if (node.typeParameters !== void 0) {
if (node.typeParameters !== undefined) {
node.typeParameters.forEach(cb);
}
node.parameters.forEach(cb);
if (node.type !== void 0) {
if (node.type !== undefined) {
cb(node.type);
}
if (node.body !== void 0) {
if (node.body !== undefined) {
scope.beginBody();
cb(node.body);
}
@ -2070,7 +2070,7 @@ function isNamespaceExported(node) {
return node.parent.kind === ts9__default.default.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9__default.default.SyntaxKind.ExportKeyword);
}
function namespaceHasExportStatement(ns) {
if (ns.body === void 0 || ns.body.kind !== ts9__default.default.SyntaxKind.ModuleBlock) {
if (ns.body === undefined || ns.body.kind !== ts9__default.default.SyntaxKind.ModuleBlock) {
return false;
}
return containsExportStatement(ns.body);

View file

@ -82,9 +82,9 @@ function isJsxElementOrFragment(node) {
function isCompilerOptionEnabled(options, option) {
switch (option) {
case "allowJs":
return options.allowJs === void 0 ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
return options.allowJs === undefined ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
case "allowSyntheticDefaultImports":
return options.allowSyntheticDefaultImports !== void 0 ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9.ModuleKind.System;
return options.allowSyntheticDefaultImports !== undefined ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9.ModuleKind.System;
case "alwaysStrict":
case "noImplicitAny":
case "noImplicitThis":
@ -103,7 +103,7 @@ function isCompilerOptionEnabled(options, option) {
case "stripInternal":
return options[option] === true && isCompilerOptionEnabled(options, "declaration");
case "incremental":
return options.incremental === void 0 ? isCompilerOptionEnabled(options, "composite") : options.incremental;
return options.incremental === undefined ? isCompilerOptionEnabled(options, "composite") : options.incremental;
case "noUncheckedIndexedAccess":
return options.noUncheckedIndexedAccess === true && isCompilerOptionEnabled(options, "strictNullChecks");
case "skipDefaultLibCheck":
@ -140,7 +140,7 @@ var isTypeFlagSet = isFlagSetOnObject;
// src/modifiers.ts
function includesModifier(modifiers, ...kinds) {
if (modifiers === void 0) {
if (modifiers === undefined) {
return false;
}
for (const modifier of modifiers) {
@ -263,7 +263,7 @@ function getAccessKind(node) {
function isInDestructuringAssignment(node) {
switch (node.kind) {
case ts9.SyntaxKind.ShorthandPropertyAssignment:
if (node.objectAssignmentInitializer !== void 0) {
if (node.objectAssignmentInitializer !== undefined) {
return true;
}
// falls through
@ -686,17 +686,17 @@ function isIterationStatement(node) {
}
}
function isJSDocNamespaceDeclaration(node) {
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && (node.body === void 0 || isJSDocNamespaceBody(node.body));
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && (node.body === undefined || isJSDocNamespaceBody(node.body));
}
function isJsxTagNamePropertyAccess(node) {
return ts9.isPropertyAccessExpression(node) && // eslint-disable-next-line @typescript-eslint/no-deprecated -- Keep compatibility with ts < 5
isJsxTagNameExpression(node.expression);
}
function isNamedDeclarationWithName(node) {
return "name" in node && node.name !== void 0 && node.name !== null && isDeclarationName(node.name);
return "name" in node && node.name !== undefined && node.name !== null && isDeclarationName(node.name);
}
function isNamespaceDeclaration(node) {
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && node.body !== void 0 && isNamespaceBody(node.body);
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && node.body !== undefined && isNamespaceBody(node.body);
}
function isNumericOrStringLikeLiteral(node) {
switch (node.kind) {
@ -888,13 +888,13 @@ function getCallSignaturesOfType(type) {
for (const subType of type.types) {
const sig = getCallSignaturesOfType(subType);
if (sig.length !== 0) {
if (signatures !== void 0) {
if (signatures !== undefined) {
return [];
}
signatures = sig;
}
}
return signatures === void 0 ? [] : signatures;
return signatures === undefined ? [] : signatures;
}
return type.getCallSignatures();
}
@ -910,8 +910,8 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
if (!prop.name.startsWith(prefix)) {
continue;
}
const declaration = prop.valueDeclaration ?? prop.getDeclarations()[0];
if (!isNamedDeclarationWithName(declaration) || declaration.name === void 0 || !ts9.isComputedPropertyName(declaration.name)) {
const declaration = prop.valueDeclaration ?? prop.getDeclarations()?.[0];
if (!declaration || !isNamedDeclarationWithName(declaration) || declaration.name === undefined || !ts9.isComputedPropertyName(declaration.name)) {
continue;
}
const globalSymbol = typeChecker.getApparentType(
@ -925,7 +925,7 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
return prop;
}
}
return void 0;
return undefined;
}
function getPropertyNameOfWellKnownSymbol(typeChecker, symbolConstructor, symbolName) {
const knownSymbol = symbolConstructor && typeChecker.getTypeOfSymbolAtLocation(
@ -967,7 +967,7 @@ function isInConstContext(node, typeChecker) {
const functionSignature = typeChecker.getResolvedSignature(
parent
);
if (functionSignature === void 0) {
if (functionSignature === undefined) {
return false;
}
const argumentIndex = parent.arguments.indexOf(
@ -977,12 +977,12 @@ function isInConstContext(node, typeChecker) {
return false;
}
const parameterSymbol = functionSignature.getParameters()[argumentIndex];
if (parameterSymbol === void 0 || !("links" in parameterSymbol)) {
if (parameterSymbol === undefined || !("links" in parameterSymbol)) {
return false;
}
const parameterSymbolLinks = parameterSymbol.links;
const propertySymbol = parameterSymbolLinks.type?.getProperties()?.[argumentIndex];
if (propertySymbol === void 0 || !("links" in propertySymbol)) {
if (propertySymbol === undefined || !("links" in propertySymbol)) {
return false;
}
return isTransientSymbolLinksFlagSet(
@ -1041,8 +1041,8 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
if (getPropertyOfType(subType, name) === void 0) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : void 0) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);
if (index?.isReadonly) {
if (seenProperty) {
return true;
@ -1060,7 +1060,7 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
if (then === void 0) {
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
@ -1101,7 +1101,7 @@ function isCallback(typeChecker, param, node) {
);
if (param.valueDeclaration.dotDotDotToken) {
type = type.getNumberIndexType();
if (type === void 0) {
if (type === undefined) {
return false;
}
}
@ -1117,14 +1117,14 @@ function isReadonlyAssignmentDeclaration(node, typeChecker) {
return false;
}
const descriptorType = typeChecker.getTypeAtLocation(node.arguments[2]);
if (descriptorType.getProperty("value") === void 0) {
return descriptorType.getProperty("set") === void 0;
if (descriptorType.getProperty("value") === undefined) {
return descriptorType.getProperty("set") === undefined;
}
const writableProp = descriptorType.getProperty("writable");
if (writableProp === void 0) {
if (writableProp === undefined) {
return false;
}
const writableType = writableProp.valueDeclaration !== void 0 && ts9.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
const writableType = writableProp.valueDeclaration !== undefined && ts9.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
return isFalseLiteralType(writableType);
}
function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
@ -1132,7 +1132,7 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return;
}
const declaration = type.symbol.declarations[0];
if (declaration.readonlyToken !== void 0 && !/^__@[^@]+$/.test(name)) {
if (declaration.readonlyToken !== undefined && !/^__@[^@]+$/.test(name)) {
return declaration.readonlyToken.kind !== ts9.SyntaxKind.MinusToken;
}
const { modifiersType } = type;
@ -1142,7 +1142,7 @@ function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
if (prop === void 0) {
if (prop === undefined) {
return false;
}
if (prop.flags & ts9.SymbolFlags.Transient) {
@ -1190,7 +1190,7 @@ function getDeclarationDomain(node) {
// TODO handle type-only imports
case ts9.SyntaxKind.ImportEqualsDeclaration:
case ts9.SyntaxKind.ImportSpecifier:
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : void 0;
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : undefined;
case ts9.SyntaxKind.InterfaceDeclaration:
case ts9.SyntaxKind.TypeAliasDeclaration:
case ts9.SyntaxKind.TypeParameter:
@ -1204,7 +1204,7 @@ function getDeclarationDomain(node) {
// falls through
case ts9.SyntaxKind.BindingElement:
case ts9.SyntaxKind.VariableDeclaration:
return node.parent.name === node ? 4 /* Value */ : void 0;
return node.parent.name === node ? 4 /* Value */ : undefined;
}
}
function getPropertyName(propertyName) {
@ -1217,7 +1217,7 @@ function getPropertyName(propertyName) {
negate = true;
// falls through
case ts9.SyntaxKind.PlusToken:
return ts9.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : void 0;
return ts9.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : undefined;
default:
return;
}
@ -1230,7 +1230,7 @@ function getPropertyName(propertyName) {
}
return;
}
return propertyName.kind === ts9.SyntaxKind.PrivateIdentifier ? void 0 : propertyName.text;
return propertyName.kind === ts9.SyntaxKind.PrivateIdentifier ? undefined : propertyName.text;
}
function unwrapParentheses(node) {
while (node.kind === ts9.SyntaxKind.ParenthesizedExpression) {
@ -1296,7 +1296,7 @@ function getUsageDomain(node) {
case ts9.SyntaxKind.ExportAssignment:
return 7 /* Any */;
case ts9.SyntaxKind.ExportSpecifier:
if (parent.propertyName === void 0 || parent.propertyName === node) {
if (parent.propertyName === undefined || parent.propertyName === node) {
return 7 /* Any */;
}
break;
@ -1313,7 +1313,7 @@ function getUsageDomain(node) {
case ts9.SyntaxKind.TypeQuery:
return 5 /* ValueOrNamespace */ | 8 /* TypeQuery */;
case ts9.SyntaxKind.TypeReference:
return identifierToKeywordKind(node) !== ts9.SyntaxKind.ConstKeyword ? 2 /* Type */ : void 0;
return identifierToKeywordKind(node) !== ts9.SyntaxKind.ConstKeyword ? 2 /* Type */ : undefined;
default:
return 5 /* ValueOrNamespace */;
}
@ -1351,10 +1351,10 @@ var AbstractScope = class {
constructor(global) {
this.global = global;
}
namespaceScopes = void 0;
namespaceScopes = undefined;
uses = [];
variables = /* @__PURE__ */ new Map();
#enumScopes = void 0;
#enumScopes = undefined;
addUse(use) {
this.uses.push(use);
}
@ -1366,7 +1366,7 @@ var AbstractScope = class {
exported
};
const variable = variables.get(identifier);
if (variable === void 0) {
if (variable === undefined) {
variables.set(identifier, {
declarations: [declaration],
domain,
@ -1380,12 +1380,12 @@ var AbstractScope = class {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
createOrReuseEnumScope(name, _exported) {
let scope;
if (this.#enumScopes === void 0) {
if (this.#enumScopes === undefined) {
this.#enumScopes = /* @__PURE__ */ new Map();
} else {
scope = this.#enumScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new EnumScope(this);
this.#enumScopes.set(name, scope);
}
@ -1394,12 +1394,12 @@ var AbstractScope = class {
// only relevant for the root scope
createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) {
let scope;
if (this.namespaceScopes === void 0) {
if (this.namespaceScopes === undefined) {
this.namespaceScopes = /* @__PURE__ */ new Map();
} else {
scope = this.namespaceScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new NamespaceScope(ambient, hasExportStatement, this);
this.namespaceScopes.set(name, scope);
} else {
@ -1408,10 +1408,10 @@ var AbstractScope = class {
return scope;
}
end(cb) {
if (this.namespaceScopes !== void 0) {
if (this.namespaceScopes !== undefined) {
this.namespaceScopes.forEach((value) => value.finish(cb));
}
this.namespaceScopes = this.#enumScopes = void 0;
this.namespaceScopes = this.#enumScopes = undefined;
this.applyUses();
this.variables.forEach((variable) => {
for (const declaration of variable.declarations) {
@ -1450,7 +1450,7 @@ var AbstractScope = class {
}
applyUse(use, variables = this.variables) {
const variable = variables.get(use.location.text);
if (variable === void 0 || (variable.domain & use.domain) === 0) {
if (variable === undefined || (variable.domain & use.domain) === 0) {
return false;
}
variable.uses.push(use);
@ -1575,7 +1575,7 @@ var FunctionExpressionScope = class extends AbstractNamedExpressionScope {
};
var NamespaceScope = class extends NonRootScope {
#ambient;
#exports = void 0;
#exports = undefined;
#hasExport;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(ambient, hasExport, parent) {
@ -1613,11 +1613,11 @@ var NamespaceScope = class extends NonRootScope {
}
end(cb) {
this.#innerScope.end((variable, key, scope) => {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== void 0 && !this.#exports.has(key.text))) {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== undefined && !this.#exports.has(key.text))) {
return cb(variable, key, scope);
}
const namespaceVar = this.variables.get(key.text);
if (namespaceVar === void 0) {
if (namespaceVar === undefined) {
this.variables.set(key.text, {
declarations: variable.declarations.map(mapDeclaration),
domain: variable.domain,
@ -1651,7 +1651,7 @@ var NamespaceScope = class extends NonRootScope {
return this.#innerScope;
}
markExported(name) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = /* @__PURE__ */ new Set();
}
this.#exports.add(name.text);
@ -1663,7 +1663,7 @@ var NamespaceScope = class extends NonRootScope {
};
var RootScope = class extends AbstractScope {
#exportAll;
#exports = void 0;
#exports = undefined;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(exportAll, global) {
super(global);
@ -1689,12 +1689,12 @@ var RootScope = class extends AbstractScope {
}
end(cb) {
this.#innerScope.end((value, key) => {
value.exported ||= this.#exportAll || this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= this.#exportAll || this.#exports !== undefined && this.#exports.includes(key.text);
value.inGlobalScope = this.global;
return cb(value, key, this);
});
return super.end((value, key, scope) => {
value.exported ||= scope === this && this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= scope === this && this.#exports !== undefined && this.#exports.includes(key.text);
return cb(value, key, scope);
});
}
@ -1702,7 +1702,7 @@ var RootScope = class extends AbstractScope {
return this;
}
markExported(id) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = [id.text];
} else {
this.#exports.push(id.text);
@ -1769,7 +1769,7 @@ var UsageWalker = class {
case ts9.SyntaxKind.ClassExpression:
return continueWithScope(
node,
node.name !== void 0 ? new ClassExpressionScope(
node.name !== undefined ? new ClassExpressionScope(
node.name,
this.#scope
) : new NonRootScope(this.#scope, 1 /* Function */)
@ -1813,7 +1813,7 @@ var UsageWalker = class {
}
break;
case ts9.SyntaxKind.ExportSpecifier:
if (node.propertyName !== void 0) {
if (node.propertyName !== undefined) {
return this.#scope.markExported(
node.propertyName,
node.name
@ -1822,7 +1822,7 @@ var UsageWalker = class {
return this.#scope.markExported(node.name);
case ts9.SyntaxKind.Identifier: {
const domain = getUsageDomain(node);
if (domain !== void 0) {
if (domain !== undefined) {
this.#scope.addUse({ domain, location: node });
}
return;
@ -1893,7 +1893,7 @@ var UsageWalker = class {
this.#scope = savedScope;
};
const handleBlockScope = (node) => {
if (node.kind === ts9.SyntaxKind.CatchClause && node.variableDeclaration !== void 0) {
if (node.kind === ts9.SyntaxKind.CatchClause && node.variableDeclaration !== undefined) {
this.#handleBindingName(
node.variableDeclaration.name,
true,
@ -1943,7 +1943,7 @@ var UsageWalker = class {
this.#scope = savedScope;
}
#handleDeclaration(node, blockScoped, domain) {
if (node.name !== void 0) {
if (node.name !== undefined) {
this.#scope.addVariable(
node.name.text,
node.name,
@ -1964,18 +1964,18 @@ var UsageWalker = class {
if (node.kind === ts9.SyntaxKind.FunctionDeclaration) {
this.#handleDeclaration(node, false, 4 /* Value */);
}
const scope = this.#scope = node.kind === ts9.SyntaxKind.FunctionExpression && node.name !== void 0 ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== void 0) {
const scope = this.#scope = node.kind === ts9.SyntaxKind.FunctionExpression && node.name !== undefined ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== undefined) {
cb(node.name);
}
if (node.typeParameters !== void 0) {
if (node.typeParameters !== undefined) {
node.typeParameters.forEach(cb);
}
node.parameters.forEach(cb);
if (node.type !== void 0) {
if (node.type !== undefined) {
cb(node.type);
}
if (node.body !== void 0) {
if (node.body !== undefined) {
scope.beginBody();
cb(node.body);
}
@ -2064,7 +2064,7 @@ function isNamespaceExported(node) {
return node.parent.kind === ts9.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9.SyntaxKind.ExportKeyword);
}
function namespaceHasExportStatement(ns) {
if (ns.body === void 0 || ns.body.kind !== ts9.SyntaxKind.ModuleBlock) {
if (ns.body === undefined || ns.body.kind !== ts9.SyntaxKind.ModuleBlock) {
return false;
}
return containsExportStatement(ns.body);

View file

@ -1,6 +1,6 @@
{
"name": "ts-api-utils",
"version": "2.0.0",
"version": "2.0.1",
"description": "Utility functions for working with TypeScript's API. Successor to the wonderful tsutils. 🛠️️",
"repository": {
"type": "git",
@ -51,51 +51,51 @@
},
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
"@eslint/js": "^9.15.0",
"@eslint/js": "^9.19.0",
"@phenomnomnominal/tsquery": "^6.1.3",
"@release-it/conventional-changelog": "^9.0.3",
"@release-it/conventional-changelog": "^10.0.0",
"@types/eslint-plugin-markdown": "^2.0.2",
"@types/node": "^18.19.65",
"@types/node": "^18.19.74",
"@typescript/vfs": "^1.6.0",
"@vitest/coverage-v8": "^2.1.5",
"@vitest/eslint-plugin": "^1.1.10",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/eslint-plugin": "^1.1.25",
"console-fail-test": "^0.5.0",
"cspell": "^8.16.0",
"eslint": "^9.15.0",
"eslint-plugin-jsdoc": "^50.5.0",
"eslint-plugin-jsonc": "^2.18.2",
"cspell": "^8.17.3",
"eslint": "^9.19.0",
"eslint-plugin-jsdoc": "^50.6.3",
"eslint-plugin-jsonc": "^2.19.1",
"eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-package-json": "^0.15.6",
"eslint-plugin-perfectionist": "^4.1.2",
"eslint-plugin-n": "^17.15.1",
"eslint-plugin-package-json": "^0.19.0",
"eslint-plugin-perfectionist": "^4.7.0",
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-yml": "^1.15.0",
"eslint-plugin-yml": "^1.16.0",
"husky": "^9.1.7",
"jsonc-eslint-parser": "^2.4.0",
"knip": "^5.37.2",
"lint-staged": "^15.2.10",
"markdownlint": "^0.36.1",
"knip": "^5.43.6",
"lint-staged": "^15.4.3",
"markdownlint": "^0.37.4",
"markdownlint-cli": "^0.43.0",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"prettier-plugin-curly": "^0.3.1",
"prettier-plugin-packagejson": "^2.5.6",
"release-it": "^17.10.0",
"sentences-per-line": "^0.2.1",
"prettier-plugin-packagejson": "^2.5.8",
"release-it": "^18.1.2",
"sentences-per-line": "^0.3.0",
"should-semantic-release": "^0.3.0",
"tsup": "^8.3.5",
"typedoc": "^0.26.11",
"typedoc-plugin-coverage": "^3.4.0",
"tsup": "^8.3.6",
"typedoc": "^0.27.6",
"typedoc-plugin-coverage": "^3.4.1",
"typedoc-plugin-custom-validation": "^2.0.2",
"typedoc-plugin-konamimojisplosion": "^0.0.2",
"typedoc-plugin-mdn-links": "^4.0.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"vitest": "^2.1.5"
"typedoc-plugin-mdn-links": "^4.0.10",
"typescript": "^5.7.3",
"typescript-eslint": "^8.22.0",
"vitest": "^2.1.8"
},
"peerDependencies": {
"typescript": ">=4.8.4"
},
"packageManager": "pnpm@9.14.2",
"packageManager": "pnpm@9.15.3",
"engines": {
"node": ">=18.12"
},

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/parser",
"version": "8.22.0",
"version": "8.23.0",
"description": "An ESLint custom parser which leverages TypeScript ESTree",
"files": [
"dist",
@ -53,10 +53,10 @@
"typescript": ">=4.8.4 <5.8.0"
},
"dependencies": {
"@typescript-eslint/scope-manager": "8.22.0",
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/typescript-estree": "8.22.0",
"@typescript-eslint/visitor-keys": "8.22.0",
"@typescript-eslint/scope-manager": "8.23.0",
"@typescript-eslint/types": "8.23.0",
"@typescript-eslint/typescript-estree": "8.23.0",
"@typescript-eslint/visitor-keys": "8.23.0",
"debug": "^4.3.4"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.22.0",
"version": "8.23.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -46,13 +46,13 @@
"typecheck": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/visitor-keys": "8.22.0"
"@typescript-eslint/types": "8.23.0",
"@typescript-eslint/visitor-keys": "8.23.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "8.22.0",
"@typescript-eslint/typescript-estree": "8.23.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",

View file

@ -54,6 +54,24 @@ declare module './generated/ast-spec' {
interface ImportSpecifier {
parent: TSESTree.ExportAllDeclaration | TSESTree.ExportNamedDeclaration | TSESTree.ImportDeclaration;
}
interface ExportDefaultDeclaration {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface ExportNamedDeclarationWithoutSourceWithMultiple {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface ExportNamedDeclarationWithoutSourceWithSingle {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface ExportNamedDeclarationWithSource {
parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock;
}
interface FunctionDeclarationWithName {
parent: TSESTree.BlockStatement | TSESTree.ExportDefaultDeclaration | TSESTree.ExportNamedDeclaration | TSESTree.Program;
}
interface FunctionDeclarationWithOptionalName {
parent: TSESTree.ExportDefaultDeclaration;
}
interface JSXAttribute {
parent: TSESTree.JSXOpeningElement;
}

View file

@ -1 +1 @@
{"version":3,"file":"ts-estree.d.ts","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAGtD,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;KACvB;IAED,UAAU,OAAO;QACf;;WAEG;QACH,MAAM,CAAC,EAAE,KAAK,CAAC;KAChB;IAED,UAAU,4BAA4B;QACpC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IACD,UAAU,+BAA+B;QACvC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IACD,UAAU,sCAAsC;QAC9C,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IACD,UAAU,yCAAyC;QACjD,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IAED,UAAU,oCAAoC;QAC5C,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IACD,UAAU,2BAA2B;QACnC,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IACD,UAAU,wBAAwB;QAChC,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IACD,UAAU,sBAAsB;QAC9B,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IACD,UAAU,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AAC;KAC/B;IAED,UAAU,+BAA+B;QACvC,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IACD,UAAU,kCAAkC;QAC1C,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IAED,UAAU,eAAe;QACvB,MAAM,EACF,QAAQ,CAAC,WAAW,GACpB,QAAQ,CAAC,YAAY,GACrB,QAAQ,CAAC,0BAA0B,CAAC;KACzC;IAED,UAAU,kCAAkC;QAC1C,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;KACzC;IACD,UAAU,uCAAuC;QAC/C,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;KACzC;CACF;AAED,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC"}

View file

@ -1 +1 @@
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmOA,iEAAiD"}
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+PA,iEAAiD"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.22.0",
"version": "8.23.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.22.0",
"version": "8.23.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -54,14 +54,14 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/visitor-keys": "8.22.0",
"@typescript-eslint/types": "8.23.0",
"@typescript-eslint/visitor-keys": "8.23.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
"ts-api-utils": "^2.0.0"
"ts-api-utils": "^2.0.1"
},
"devDependencies": {
"@jest/types": "29.6.3",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
"version": "8.22.0",
"version": "8.23.0",
"description": "Utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -64,9 +64,9 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.22.0",
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/typescript-estree": "8.22.0"
"@typescript-eslint/scope-manager": "8.23.0",
"@typescript-eslint/types": "8.23.0",
"@typescript-eslint/typescript-estree": "8.23.0"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.22.0",
"version": "8.23.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -47,7 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.22.0",
"@typescript-eslint/types": "8.23.0",
"eslint-visitor-keys": "^4.2.0"
},
"devDependencies": {

View file

@ -88,9 +88,9 @@ function isJsxElementOrFragment(node) {
function isCompilerOptionEnabled(options, option) {
switch (option) {
case "allowJs":
return options.allowJs === void 0 ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
return options.allowJs === undefined ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
case "allowSyntheticDefaultImports":
return options.allowSyntheticDefaultImports !== void 0 ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9__default.default.ModuleKind.System;
return options.allowSyntheticDefaultImports !== undefined ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9__default.default.ModuleKind.System;
case "alwaysStrict":
case "noImplicitAny":
case "noImplicitThis":
@ -109,7 +109,7 @@ function isCompilerOptionEnabled(options, option) {
case "stripInternal":
return options[option] === true && isCompilerOptionEnabled(options, "declaration");
case "incremental":
return options.incremental === void 0 ? isCompilerOptionEnabled(options, "composite") : options.incremental;
return options.incremental === undefined ? isCompilerOptionEnabled(options, "composite") : options.incremental;
case "noUncheckedIndexedAccess":
return options.noUncheckedIndexedAccess === true && isCompilerOptionEnabled(options, "strictNullChecks");
case "skipDefaultLibCheck":
@ -146,7 +146,7 @@ var isTypeFlagSet = isFlagSetOnObject;
// src/modifiers.ts
function includesModifier(modifiers, ...kinds) {
if (modifiers === void 0) {
if (modifiers === undefined) {
return false;
}
for (const modifier of modifiers) {
@ -269,7 +269,7 @@ function getAccessKind(node) {
function isInDestructuringAssignment(node) {
switch (node.kind) {
case ts9__default.default.SyntaxKind.ShorthandPropertyAssignment:
if (node.objectAssignmentInitializer !== void 0) {
if (node.objectAssignmentInitializer !== undefined) {
return true;
}
// falls through
@ -692,17 +692,17 @@ function isIterationStatement(node) {
}
}
function isJSDocNamespaceDeclaration(node) {
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && (node.body === void 0 || isJSDocNamespaceBody(node.body));
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && (node.body === undefined || isJSDocNamespaceBody(node.body));
}
function isJsxTagNamePropertyAccess(node) {
return ts9__default.default.isPropertyAccessExpression(node) && // eslint-disable-next-line @typescript-eslint/no-deprecated -- Keep compatibility with ts < 5
isJsxTagNameExpression(node.expression);
}
function isNamedDeclarationWithName(node) {
return "name" in node && node.name !== void 0 && node.name !== null && isDeclarationName(node.name);
return "name" in node && node.name !== undefined && node.name !== null && isDeclarationName(node.name);
}
function isNamespaceDeclaration(node) {
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && node.body !== void 0 && isNamespaceBody(node.body);
return ts9__default.default.isModuleDeclaration(node) && ts9__default.default.isIdentifier(node.name) && node.body !== undefined && isNamespaceBody(node.body);
}
function isNumericOrStringLikeLiteral(node) {
switch (node.kind) {
@ -894,13 +894,13 @@ function getCallSignaturesOfType(type) {
for (const subType of type.types) {
const sig = getCallSignaturesOfType(subType);
if (sig.length !== 0) {
if (signatures !== void 0) {
if (signatures !== undefined) {
return [];
}
signatures = sig;
}
}
return signatures === void 0 ? [] : signatures;
return signatures === undefined ? [] : signatures;
}
return type.getCallSignatures();
}
@ -916,8 +916,8 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
if (!prop.name.startsWith(prefix)) {
continue;
}
const declaration = prop.valueDeclaration ?? prop.getDeclarations()[0];
if (!isNamedDeclarationWithName(declaration) || declaration.name === void 0 || !ts9__default.default.isComputedPropertyName(declaration.name)) {
const declaration = prop.valueDeclaration ?? prop.getDeclarations()?.[0];
if (!declaration || !isNamedDeclarationWithName(declaration) || declaration.name === undefined || !ts9__default.default.isComputedPropertyName(declaration.name)) {
continue;
}
const globalSymbol = typeChecker.getApparentType(
@ -931,7 +931,7 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
return prop;
}
}
return void 0;
return undefined;
}
function getPropertyNameOfWellKnownSymbol(typeChecker, symbolConstructor, symbolName) {
const knownSymbol = symbolConstructor && typeChecker.getTypeOfSymbolAtLocation(
@ -973,7 +973,7 @@ function isInConstContext(node, typeChecker) {
const functionSignature = typeChecker.getResolvedSignature(
parent
);
if (functionSignature === void 0) {
if (functionSignature === undefined) {
return false;
}
const argumentIndex = parent.arguments.indexOf(
@ -983,12 +983,12 @@ function isInConstContext(node, typeChecker) {
return false;
}
const parameterSymbol = functionSignature.getParameters()[argumentIndex];
if (parameterSymbol === void 0 || !("links" in parameterSymbol)) {
if (parameterSymbol === undefined || !("links" in parameterSymbol)) {
return false;
}
const parameterSymbolLinks = parameterSymbol.links;
const propertySymbol = parameterSymbolLinks.type?.getProperties()?.[argumentIndex];
if (propertySymbol === void 0 || !("links" in propertySymbol)) {
if (propertySymbol === undefined || !("links" in propertySymbol)) {
return false;
}
return isTransientSymbolLinksFlagSet(
@ -1047,8 +1047,8 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
if (getPropertyOfType(subType, name) === void 0) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.Number) : void 0) ?? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.String);
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.String);
if (index?.isReadonly) {
if (seenProperty) {
return true;
@ -1066,7 +1066,7 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
if (then === void 0) {
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
@ -1107,7 +1107,7 @@ function isCallback(typeChecker, param, node) {
);
if (param.valueDeclaration.dotDotDotToken) {
type = type.getNumberIndexType();
if (type === void 0) {
if (type === undefined) {
return false;
}
}
@ -1123,14 +1123,14 @@ function isReadonlyAssignmentDeclaration(node, typeChecker) {
return false;
}
const descriptorType = typeChecker.getTypeAtLocation(node.arguments[2]);
if (descriptorType.getProperty("value") === void 0) {
return descriptorType.getProperty("set") === void 0;
if (descriptorType.getProperty("value") === undefined) {
return descriptorType.getProperty("set") === undefined;
}
const writableProp = descriptorType.getProperty("writable");
if (writableProp === void 0) {
if (writableProp === undefined) {
return false;
}
const writableType = writableProp.valueDeclaration !== void 0 && ts9__default.default.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
const writableType = writableProp.valueDeclaration !== undefined && ts9__default.default.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
return isFalseLiteralType(writableType);
}
function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
@ -1138,7 +1138,7 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return;
}
const declaration = type.symbol.declarations[0];
if (declaration.readonlyToken !== void 0 && !/^__@[^@]+$/.test(name)) {
if (declaration.readonlyToken !== undefined && !/^__@[^@]+$/.test(name)) {
return declaration.readonlyToken.kind !== ts9__default.default.SyntaxKind.MinusToken;
}
const { modifiersType } = type;
@ -1148,7 +1148,7 @@ function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
if (prop === void 0) {
if (prop === undefined) {
return false;
}
if (prop.flags & ts9__default.default.SymbolFlags.Transient) {
@ -1196,7 +1196,7 @@ function getDeclarationDomain(node) {
// TODO handle type-only imports
case ts9__default.default.SyntaxKind.ImportEqualsDeclaration:
case ts9__default.default.SyntaxKind.ImportSpecifier:
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : void 0;
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : undefined;
case ts9__default.default.SyntaxKind.InterfaceDeclaration:
case ts9__default.default.SyntaxKind.TypeAliasDeclaration:
case ts9__default.default.SyntaxKind.TypeParameter:
@ -1210,7 +1210,7 @@ function getDeclarationDomain(node) {
// falls through
case ts9__default.default.SyntaxKind.BindingElement:
case ts9__default.default.SyntaxKind.VariableDeclaration:
return node.parent.name === node ? 4 /* Value */ : void 0;
return node.parent.name === node ? 4 /* Value */ : undefined;
}
}
function getPropertyName(propertyName) {
@ -1223,7 +1223,7 @@ function getPropertyName(propertyName) {
negate = true;
// falls through
case ts9__default.default.SyntaxKind.PlusToken:
return ts9__default.default.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9__default.default.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : void 0;
return ts9__default.default.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9__default.default.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : undefined;
default:
return;
}
@ -1236,7 +1236,7 @@ function getPropertyName(propertyName) {
}
return;
}
return propertyName.kind === ts9__default.default.SyntaxKind.PrivateIdentifier ? void 0 : propertyName.text;
return propertyName.kind === ts9__default.default.SyntaxKind.PrivateIdentifier ? undefined : propertyName.text;
}
function unwrapParentheses(node) {
while (node.kind === ts9__default.default.SyntaxKind.ParenthesizedExpression) {
@ -1302,7 +1302,7 @@ function getUsageDomain(node) {
case ts9__default.default.SyntaxKind.ExportAssignment:
return 7 /* Any */;
case ts9__default.default.SyntaxKind.ExportSpecifier:
if (parent.propertyName === void 0 || parent.propertyName === node) {
if (parent.propertyName === undefined || parent.propertyName === node) {
return 7 /* Any */;
}
break;
@ -1319,7 +1319,7 @@ function getUsageDomain(node) {
case ts9__default.default.SyntaxKind.TypeQuery:
return 5 /* ValueOrNamespace */ | 8 /* TypeQuery */;
case ts9__default.default.SyntaxKind.TypeReference:
return identifierToKeywordKind(node) !== ts9__default.default.SyntaxKind.ConstKeyword ? 2 /* Type */ : void 0;
return identifierToKeywordKind(node) !== ts9__default.default.SyntaxKind.ConstKeyword ? 2 /* Type */ : undefined;
default:
return 5 /* ValueOrNamespace */;
}
@ -1357,10 +1357,10 @@ var AbstractScope = class {
constructor(global) {
this.global = global;
}
namespaceScopes = void 0;
namespaceScopes = undefined;
uses = [];
variables = /* @__PURE__ */ new Map();
#enumScopes = void 0;
#enumScopes = undefined;
addUse(use) {
this.uses.push(use);
}
@ -1372,7 +1372,7 @@ var AbstractScope = class {
exported
};
const variable = variables.get(identifier);
if (variable === void 0) {
if (variable === undefined) {
variables.set(identifier, {
declarations: [declaration],
domain,
@ -1386,12 +1386,12 @@ var AbstractScope = class {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
createOrReuseEnumScope(name, _exported) {
let scope;
if (this.#enumScopes === void 0) {
if (this.#enumScopes === undefined) {
this.#enumScopes = /* @__PURE__ */ new Map();
} else {
scope = this.#enumScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new EnumScope(this);
this.#enumScopes.set(name, scope);
}
@ -1400,12 +1400,12 @@ var AbstractScope = class {
// only relevant for the root scope
createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) {
let scope;
if (this.namespaceScopes === void 0) {
if (this.namespaceScopes === undefined) {
this.namespaceScopes = /* @__PURE__ */ new Map();
} else {
scope = this.namespaceScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new NamespaceScope(ambient, hasExportStatement, this);
this.namespaceScopes.set(name, scope);
} else {
@ -1414,10 +1414,10 @@ var AbstractScope = class {
return scope;
}
end(cb) {
if (this.namespaceScopes !== void 0) {
if (this.namespaceScopes !== undefined) {
this.namespaceScopes.forEach((value) => value.finish(cb));
}
this.namespaceScopes = this.#enumScopes = void 0;
this.namespaceScopes = this.#enumScopes = undefined;
this.applyUses();
this.variables.forEach((variable) => {
for (const declaration of variable.declarations) {
@ -1456,7 +1456,7 @@ var AbstractScope = class {
}
applyUse(use, variables = this.variables) {
const variable = variables.get(use.location.text);
if (variable === void 0 || (variable.domain & use.domain) === 0) {
if (variable === undefined || (variable.domain & use.domain) === 0) {
return false;
}
variable.uses.push(use);
@ -1581,7 +1581,7 @@ var FunctionExpressionScope = class extends AbstractNamedExpressionScope {
};
var NamespaceScope = class extends NonRootScope {
#ambient;
#exports = void 0;
#exports = undefined;
#hasExport;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(ambient, hasExport, parent) {
@ -1619,11 +1619,11 @@ var NamespaceScope = class extends NonRootScope {
}
end(cb) {
this.#innerScope.end((variable, key, scope) => {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== void 0 && !this.#exports.has(key.text))) {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== undefined && !this.#exports.has(key.text))) {
return cb(variable, key, scope);
}
const namespaceVar = this.variables.get(key.text);
if (namespaceVar === void 0) {
if (namespaceVar === undefined) {
this.variables.set(key.text, {
declarations: variable.declarations.map(mapDeclaration),
domain: variable.domain,
@ -1657,7 +1657,7 @@ var NamespaceScope = class extends NonRootScope {
return this.#innerScope;
}
markExported(name) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = /* @__PURE__ */ new Set();
}
this.#exports.add(name.text);
@ -1669,7 +1669,7 @@ var NamespaceScope = class extends NonRootScope {
};
var RootScope = class extends AbstractScope {
#exportAll;
#exports = void 0;
#exports = undefined;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(exportAll, global) {
super(global);
@ -1695,12 +1695,12 @@ var RootScope = class extends AbstractScope {
}
end(cb) {
this.#innerScope.end((value, key) => {
value.exported ||= this.#exportAll || this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= this.#exportAll || this.#exports !== undefined && this.#exports.includes(key.text);
value.inGlobalScope = this.global;
return cb(value, key, this);
});
return super.end((value, key, scope) => {
value.exported ||= scope === this && this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= scope === this && this.#exports !== undefined && this.#exports.includes(key.text);
return cb(value, key, scope);
});
}
@ -1708,7 +1708,7 @@ var RootScope = class extends AbstractScope {
return this;
}
markExported(id) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = [id.text];
} else {
this.#exports.push(id.text);
@ -1775,7 +1775,7 @@ var UsageWalker = class {
case ts9__default.default.SyntaxKind.ClassExpression:
return continueWithScope(
node,
node.name !== void 0 ? new ClassExpressionScope(
node.name !== undefined ? new ClassExpressionScope(
node.name,
this.#scope
) : new NonRootScope(this.#scope, 1 /* Function */)
@ -1819,7 +1819,7 @@ var UsageWalker = class {
}
break;
case ts9__default.default.SyntaxKind.ExportSpecifier:
if (node.propertyName !== void 0) {
if (node.propertyName !== undefined) {
return this.#scope.markExported(
node.propertyName,
node.name
@ -1828,7 +1828,7 @@ var UsageWalker = class {
return this.#scope.markExported(node.name);
case ts9__default.default.SyntaxKind.Identifier: {
const domain = getUsageDomain(node);
if (domain !== void 0) {
if (domain !== undefined) {
this.#scope.addUse({ domain, location: node });
}
return;
@ -1899,7 +1899,7 @@ var UsageWalker = class {
this.#scope = savedScope;
};
const handleBlockScope = (node) => {
if (node.kind === ts9__default.default.SyntaxKind.CatchClause && node.variableDeclaration !== void 0) {
if (node.kind === ts9__default.default.SyntaxKind.CatchClause && node.variableDeclaration !== undefined) {
this.#handleBindingName(
node.variableDeclaration.name,
true,
@ -1949,7 +1949,7 @@ var UsageWalker = class {
this.#scope = savedScope;
}
#handleDeclaration(node, blockScoped, domain) {
if (node.name !== void 0) {
if (node.name !== undefined) {
this.#scope.addVariable(
node.name.text,
node.name,
@ -1970,18 +1970,18 @@ var UsageWalker = class {
if (node.kind === ts9__default.default.SyntaxKind.FunctionDeclaration) {
this.#handleDeclaration(node, false, 4 /* Value */);
}
const scope = this.#scope = node.kind === ts9__default.default.SyntaxKind.FunctionExpression && node.name !== void 0 ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== void 0) {
const scope = this.#scope = node.kind === ts9__default.default.SyntaxKind.FunctionExpression && node.name !== undefined ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== undefined) {
cb(node.name);
}
if (node.typeParameters !== void 0) {
if (node.typeParameters !== undefined) {
node.typeParameters.forEach(cb);
}
node.parameters.forEach(cb);
if (node.type !== void 0) {
if (node.type !== undefined) {
cb(node.type);
}
if (node.body !== void 0) {
if (node.body !== undefined) {
scope.beginBody();
cb(node.body);
}
@ -2070,7 +2070,7 @@ function isNamespaceExported(node) {
return node.parent.kind === ts9__default.default.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9__default.default.SyntaxKind.ExportKeyword);
}
function namespaceHasExportStatement(ns) {
if (ns.body === void 0 || ns.body.kind !== ts9__default.default.SyntaxKind.ModuleBlock) {
if (ns.body === undefined || ns.body.kind !== ts9__default.default.SyntaxKind.ModuleBlock) {
return false;
}
return containsExportStatement(ns.body);

View file

@ -82,9 +82,9 @@ function isJsxElementOrFragment(node) {
function isCompilerOptionEnabled(options, option) {
switch (option) {
case "allowJs":
return options.allowJs === void 0 ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
return options.allowJs === undefined ? isCompilerOptionEnabled(options, "checkJs") : options.allowJs;
case "allowSyntheticDefaultImports":
return options.allowSyntheticDefaultImports !== void 0 ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9.ModuleKind.System;
return options.allowSyntheticDefaultImports !== undefined ? options.allowSyntheticDefaultImports : isCompilerOptionEnabled(options, "esModuleInterop") || options.module === ts9.ModuleKind.System;
case "alwaysStrict":
case "noImplicitAny":
case "noImplicitThis":
@ -103,7 +103,7 @@ function isCompilerOptionEnabled(options, option) {
case "stripInternal":
return options[option] === true && isCompilerOptionEnabled(options, "declaration");
case "incremental":
return options.incremental === void 0 ? isCompilerOptionEnabled(options, "composite") : options.incremental;
return options.incremental === undefined ? isCompilerOptionEnabled(options, "composite") : options.incremental;
case "noUncheckedIndexedAccess":
return options.noUncheckedIndexedAccess === true && isCompilerOptionEnabled(options, "strictNullChecks");
case "skipDefaultLibCheck":
@ -140,7 +140,7 @@ var isTypeFlagSet = isFlagSetOnObject;
// src/modifiers.ts
function includesModifier(modifiers, ...kinds) {
if (modifiers === void 0) {
if (modifiers === undefined) {
return false;
}
for (const modifier of modifiers) {
@ -263,7 +263,7 @@ function getAccessKind(node) {
function isInDestructuringAssignment(node) {
switch (node.kind) {
case ts9.SyntaxKind.ShorthandPropertyAssignment:
if (node.objectAssignmentInitializer !== void 0) {
if (node.objectAssignmentInitializer !== undefined) {
return true;
}
// falls through
@ -686,17 +686,17 @@ function isIterationStatement(node) {
}
}
function isJSDocNamespaceDeclaration(node) {
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && (node.body === void 0 || isJSDocNamespaceBody(node.body));
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && (node.body === undefined || isJSDocNamespaceBody(node.body));
}
function isJsxTagNamePropertyAccess(node) {
return ts9.isPropertyAccessExpression(node) && // eslint-disable-next-line @typescript-eslint/no-deprecated -- Keep compatibility with ts < 5
isJsxTagNameExpression(node.expression);
}
function isNamedDeclarationWithName(node) {
return "name" in node && node.name !== void 0 && node.name !== null && isDeclarationName(node.name);
return "name" in node && node.name !== undefined && node.name !== null && isDeclarationName(node.name);
}
function isNamespaceDeclaration(node) {
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && node.body !== void 0 && isNamespaceBody(node.body);
return ts9.isModuleDeclaration(node) && ts9.isIdentifier(node.name) && node.body !== undefined && isNamespaceBody(node.body);
}
function isNumericOrStringLikeLiteral(node) {
switch (node.kind) {
@ -888,13 +888,13 @@ function getCallSignaturesOfType(type) {
for (const subType of type.types) {
const sig = getCallSignaturesOfType(subType);
if (sig.length !== 0) {
if (signatures !== void 0) {
if (signatures !== undefined) {
return [];
}
signatures = sig;
}
}
return signatures === void 0 ? [] : signatures;
return signatures === undefined ? [] : signatures;
}
return type.getCallSignatures();
}
@ -910,8 +910,8 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
if (!prop.name.startsWith(prefix)) {
continue;
}
const declaration = prop.valueDeclaration ?? prop.getDeclarations()[0];
if (!isNamedDeclarationWithName(declaration) || declaration.name === void 0 || !ts9.isComputedPropertyName(declaration.name)) {
const declaration = prop.valueDeclaration ?? prop.getDeclarations()?.[0];
if (!declaration || !isNamedDeclarationWithName(declaration) || declaration.name === undefined || !ts9.isComputedPropertyName(declaration.name)) {
continue;
}
const globalSymbol = typeChecker.getApparentType(
@ -925,7 +925,7 @@ function getWellKnownSymbolPropertyOfType(type, wellKnownSymbolName, typeChecker
return prop;
}
}
return void 0;
return undefined;
}
function getPropertyNameOfWellKnownSymbol(typeChecker, symbolConstructor, symbolName) {
const knownSymbol = symbolConstructor && typeChecker.getTypeOfSymbolAtLocation(
@ -967,7 +967,7 @@ function isInConstContext(node, typeChecker) {
const functionSignature = typeChecker.getResolvedSignature(
parent
);
if (functionSignature === void 0) {
if (functionSignature === undefined) {
return false;
}
const argumentIndex = parent.arguments.indexOf(
@ -977,12 +977,12 @@ function isInConstContext(node, typeChecker) {
return false;
}
const parameterSymbol = functionSignature.getParameters()[argumentIndex];
if (parameterSymbol === void 0 || !("links" in parameterSymbol)) {
if (parameterSymbol === undefined || !("links" in parameterSymbol)) {
return false;
}
const parameterSymbolLinks = parameterSymbol.links;
const propertySymbol = parameterSymbolLinks.type?.getProperties()?.[argumentIndex];
if (propertySymbol === void 0 || !("links" in propertySymbol)) {
if (propertySymbol === undefined || !("links" in propertySymbol)) {
return false;
}
return isTransientSymbolLinksFlagSet(
@ -1041,8 +1041,8 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
if (getPropertyOfType(subType, name) === void 0) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : void 0) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);
if (index?.isReadonly) {
if (seenProperty) {
return true;
@ -1060,7 +1060,7 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
if (then === void 0) {
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
@ -1101,7 +1101,7 @@ function isCallback(typeChecker, param, node) {
);
if (param.valueDeclaration.dotDotDotToken) {
type = type.getNumberIndexType();
if (type === void 0) {
if (type === undefined) {
return false;
}
}
@ -1117,14 +1117,14 @@ function isReadonlyAssignmentDeclaration(node, typeChecker) {
return false;
}
const descriptorType = typeChecker.getTypeAtLocation(node.arguments[2]);
if (descriptorType.getProperty("value") === void 0) {
return descriptorType.getProperty("set") === void 0;
if (descriptorType.getProperty("value") === undefined) {
return descriptorType.getProperty("set") === undefined;
}
const writableProp = descriptorType.getProperty("writable");
if (writableProp === void 0) {
if (writableProp === undefined) {
return false;
}
const writableType = writableProp.valueDeclaration !== void 0 && ts9.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
const writableType = writableProp.valueDeclaration !== undefined && ts9.isPropertyAssignment(writableProp.valueDeclaration) ? typeChecker.getTypeAtLocation(writableProp.valueDeclaration.initializer) : typeChecker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]);
return isFalseLiteralType(writableType);
}
function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
@ -1132,7 +1132,7 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return;
}
const declaration = type.symbol.declarations[0];
if (declaration.readonlyToken !== void 0 && !/^__@[^@]+$/.test(name)) {
if (declaration.readonlyToken !== undefined && !/^__@[^@]+$/.test(name)) {
return declaration.readonlyToken.kind !== ts9.SyntaxKind.MinusToken;
}
const { modifiersType } = type;
@ -1142,7 +1142,7 @@ function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
if (prop === void 0) {
if (prop === undefined) {
return false;
}
if (prop.flags & ts9.SymbolFlags.Transient) {
@ -1190,7 +1190,7 @@ function getDeclarationDomain(node) {
// TODO handle type-only imports
case ts9.SyntaxKind.ImportEqualsDeclaration:
case ts9.SyntaxKind.ImportSpecifier:
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : void 0;
return node.parent.name === node ? 7 /* Any */ | 8 /* Import */ : undefined;
case ts9.SyntaxKind.InterfaceDeclaration:
case ts9.SyntaxKind.TypeAliasDeclaration:
case ts9.SyntaxKind.TypeParameter:
@ -1204,7 +1204,7 @@ function getDeclarationDomain(node) {
// falls through
case ts9.SyntaxKind.BindingElement:
case ts9.SyntaxKind.VariableDeclaration:
return node.parent.name === node ? 4 /* Value */ : void 0;
return node.parent.name === node ? 4 /* Value */ : undefined;
}
}
function getPropertyName(propertyName) {
@ -1217,7 +1217,7 @@ function getPropertyName(propertyName) {
negate = true;
// falls through
case ts9.SyntaxKind.PlusToken:
return ts9.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : void 0;
return ts9.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : undefined;
default:
return;
}
@ -1230,7 +1230,7 @@ function getPropertyName(propertyName) {
}
return;
}
return propertyName.kind === ts9.SyntaxKind.PrivateIdentifier ? void 0 : propertyName.text;
return propertyName.kind === ts9.SyntaxKind.PrivateIdentifier ? undefined : propertyName.text;
}
function unwrapParentheses(node) {
while (node.kind === ts9.SyntaxKind.ParenthesizedExpression) {
@ -1296,7 +1296,7 @@ function getUsageDomain(node) {
case ts9.SyntaxKind.ExportAssignment:
return 7 /* Any */;
case ts9.SyntaxKind.ExportSpecifier:
if (parent.propertyName === void 0 || parent.propertyName === node) {
if (parent.propertyName === undefined || parent.propertyName === node) {
return 7 /* Any */;
}
break;
@ -1313,7 +1313,7 @@ function getUsageDomain(node) {
case ts9.SyntaxKind.TypeQuery:
return 5 /* ValueOrNamespace */ | 8 /* TypeQuery */;
case ts9.SyntaxKind.TypeReference:
return identifierToKeywordKind(node) !== ts9.SyntaxKind.ConstKeyword ? 2 /* Type */ : void 0;
return identifierToKeywordKind(node) !== ts9.SyntaxKind.ConstKeyword ? 2 /* Type */ : undefined;
default:
return 5 /* ValueOrNamespace */;
}
@ -1351,10 +1351,10 @@ var AbstractScope = class {
constructor(global) {
this.global = global;
}
namespaceScopes = void 0;
namespaceScopes = undefined;
uses = [];
variables = /* @__PURE__ */ new Map();
#enumScopes = void 0;
#enumScopes = undefined;
addUse(use) {
this.uses.push(use);
}
@ -1366,7 +1366,7 @@ var AbstractScope = class {
exported
};
const variable = variables.get(identifier);
if (variable === void 0) {
if (variable === undefined) {
variables.set(identifier, {
declarations: [declaration],
domain,
@ -1380,12 +1380,12 @@ var AbstractScope = class {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
createOrReuseEnumScope(name, _exported) {
let scope;
if (this.#enumScopes === void 0) {
if (this.#enumScopes === undefined) {
this.#enumScopes = /* @__PURE__ */ new Map();
} else {
scope = this.#enumScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new EnumScope(this);
this.#enumScopes.set(name, scope);
}
@ -1394,12 +1394,12 @@ var AbstractScope = class {
// only relevant for the root scope
createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) {
let scope;
if (this.namespaceScopes === void 0) {
if (this.namespaceScopes === undefined) {
this.namespaceScopes = /* @__PURE__ */ new Map();
} else {
scope = this.namespaceScopes.get(name);
}
if (scope === void 0) {
if (scope === undefined) {
scope = new NamespaceScope(ambient, hasExportStatement, this);
this.namespaceScopes.set(name, scope);
} else {
@ -1408,10 +1408,10 @@ var AbstractScope = class {
return scope;
}
end(cb) {
if (this.namespaceScopes !== void 0) {
if (this.namespaceScopes !== undefined) {
this.namespaceScopes.forEach((value) => value.finish(cb));
}
this.namespaceScopes = this.#enumScopes = void 0;
this.namespaceScopes = this.#enumScopes = undefined;
this.applyUses();
this.variables.forEach((variable) => {
for (const declaration of variable.declarations) {
@ -1450,7 +1450,7 @@ var AbstractScope = class {
}
applyUse(use, variables = this.variables) {
const variable = variables.get(use.location.text);
if (variable === void 0 || (variable.domain & use.domain) === 0) {
if (variable === undefined || (variable.domain & use.domain) === 0) {
return false;
}
variable.uses.push(use);
@ -1575,7 +1575,7 @@ var FunctionExpressionScope = class extends AbstractNamedExpressionScope {
};
var NamespaceScope = class extends NonRootScope {
#ambient;
#exports = void 0;
#exports = undefined;
#hasExport;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(ambient, hasExport, parent) {
@ -1613,11 +1613,11 @@ var NamespaceScope = class extends NonRootScope {
}
end(cb) {
this.#innerScope.end((variable, key, scope) => {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== void 0 && !this.#exports.has(key.text))) {
if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== undefined && !this.#exports.has(key.text))) {
return cb(variable, key, scope);
}
const namespaceVar = this.variables.get(key.text);
if (namespaceVar === void 0) {
if (namespaceVar === undefined) {
this.variables.set(key.text, {
declarations: variable.declarations.map(mapDeclaration),
domain: variable.domain,
@ -1651,7 +1651,7 @@ var NamespaceScope = class extends NonRootScope {
return this.#innerScope;
}
markExported(name) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = /* @__PURE__ */ new Set();
}
this.#exports.add(name.text);
@ -1663,7 +1663,7 @@ var NamespaceScope = class extends NonRootScope {
};
var RootScope = class extends AbstractScope {
#exportAll;
#exports = void 0;
#exports = undefined;
#innerScope = new NonRootScope(this, 1 /* Function */);
constructor(exportAll, global) {
super(global);
@ -1689,12 +1689,12 @@ var RootScope = class extends AbstractScope {
}
end(cb) {
this.#innerScope.end((value, key) => {
value.exported ||= this.#exportAll || this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= this.#exportAll || this.#exports !== undefined && this.#exports.includes(key.text);
value.inGlobalScope = this.global;
return cb(value, key, this);
});
return super.end((value, key, scope) => {
value.exported ||= scope === this && this.#exports !== void 0 && this.#exports.includes(key.text);
value.exported ||= scope === this && this.#exports !== undefined && this.#exports.includes(key.text);
return cb(value, key, scope);
});
}
@ -1702,7 +1702,7 @@ var RootScope = class extends AbstractScope {
return this;
}
markExported(id) {
if (this.#exports === void 0) {
if (this.#exports === undefined) {
this.#exports = [id.text];
} else {
this.#exports.push(id.text);
@ -1769,7 +1769,7 @@ var UsageWalker = class {
case ts9.SyntaxKind.ClassExpression:
return continueWithScope(
node,
node.name !== void 0 ? new ClassExpressionScope(
node.name !== undefined ? new ClassExpressionScope(
node.name,
this.#scope
) : new NonRootScope(this.#scope, 1 /* Function */)
@ -1813,7 +1813,7 @@ var UsageWalker = class {
}
break;
case ts9.SyntaxKind.ExportSpecifier:
if (node.propertyName !== void 0) {
if (node.propertyName !== undefined) {
return this.#scope.markExported(
node.propertyName,
node.name
@ -1822,7 +1822,7 @@ var UsageWalker = class {
return this.#scope.markExported(node.name);
case ts9.SyntaxKind.Identifier: {
const domain = getUsageDomain(node);
if (domain !== void 0) {
if (domain !== undefined) {
this.#scope.addUse({ domain, location: node });
}
return;
@ -1893,7 +1893,7 @@ var UsageWalker = class {
this.#scope = savedScope;
};
const handleBlockScope = (node) => {
if (node.kind === ts9.SyntaxKind.CatchClause && node.variableDeclaration !== void 0) {
if (node.kind === ts9.SyntaxKind.CatchClause && node.variableDeclaration !== undefined) {
this.#handleBindingName(
node.variableDeclaration.name,
true,
@ -1943,7 +1943,7 @@ var UsageWalker = class {
this.#scope = savedScope;
}
#handleDeclaration(node, blockScoped, domain) {
if (node.name !== void 0) {
if (node.name !== undefined) {
this.#scope.addVariable(
node.name.text,
node.name,
@ -1964,18 +1964,18 @@ var UsageWalker = class {
if (node.kind === ts9.SyntaxKind.FunctionDeclaration) {
this.#handleDeclaration(node, false, 4 /* Value */);
}
const scope = this.#scope = node.kind === ts9.SyntaxKind.FunctionExpression && node.name !== void 0 ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== void 0) {
const scope = this.#scope = node.kind === ts9.SyntaxKind.FunctionExpression && node.name !== undefined ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
if (node.name !== undefined) {
cb(node.name);
}
if (node.typeParameters !== void 0) {
if (node.typeParameters !== undefined) {
node.typeParameters.forEach(cb);
}
node.parameters.forEach(cb);
if (node.type !== void 0) {
if (node.type !== undefined) {
cb(node.type);
}
if (node.body !== void 0) {
if (node.body !== undefined) {
scope.beginBody();
cb(node.body);
}
@ -2064,7 +2064,7 @@ function isNamespaceExported(node) {
return node.parent.kind === ts9.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9.SyntaxKind.ExportKeyword);
}
function namespaceHasExportStatement(ns) {
if (ns.body === void 0 || ns.body.kind !== ts9.SyntaxKind.ModuleBlock) {
if (ns.body === undefined || ns.body.kind !== ts9.SyntaxKind.ModuleBlock) {
return false;
}
return containsExportStatement(ns.body);

View file

@ -1,6 +1,6 @@
{
"name": "ts-api-utils",
"version": "2.0.0",
"version": "2.0.1",
"description": "Utility functions for working with TypeScript's API. Successor to the wonderful tsutils. 🛠️️",
"repository": {
"type": "git",
@ -51,51 +51,51 @@
},
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
"@eslint/js": "^9.15.0",
"@eslint/js": "^9.19.0",
"@phenomnomnominal/tsquery": "^6.1.3",
"@release-it/conventional-changelog": "^9.0.3",
"@release-it/conventional-changelog": "^10.0.0",
"@types/eslint-plugin-markdown": "^2.0.2",
"@types/node": "^18.19.65",
"@types/node": "^18.19.74",
"@typescript/vfs": "^1.6.0",
"@vitest/coverage-v8": "^2.1.5",
"@vitest/eslint-plugin": "^1.1.10",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/eslint-plugin": "^1.1.25",
"console-fail-test": "^0.5.0",
"cspell": "^8.16.0",
"eslint": "^9.15.0",
"eslint-plugin-jsdoc": "^50.5.0",
"eslint-plugin-jsonc": "^2.18.2",
"cspell": "^8.17.3",
"eslint": "^9.19.0",
"eslint-plugin-jsdoc": "^50.6.3",
"eslint-plugin-jsonc": "^2.19.1",
"eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-package-json": "^0.15.6",
"eslint-plugin-perfectionist": "^4.1.2",
"eslint-plugin-n": "^17.15.1",
"eslint-plugin-package-json": "^0.19.0",
"eslint-plugin-perfectionist": "^4.7.0",
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-yml": "^1.15.0",
"eslint-plugin-yml": "^1.16.0",
"husky": "^9.1.7",
"jsonc-eslint-parser": "^2.4.0",
"knip": "^5.37.2",
"lint-staged": "^15.2.10",
"markdownlint": "^0.36.1",
"knip": "^5.43.6",
"lint-staged": "^15.4.3",
"markdownlint": "^0.37.4",
"markdownlint-cli": "^0.43.0",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"prettier-plugin-curly": "^0.3.1",
"prettier-plugin-packagejson": "^2.5.6",
"release-it": "^17.10.0",
"sentences-per-line": "^0.2.1",
"prettier-plugin-packagejson": "^2.5.8",
"release-it": "^18.1.2",
"sentences-per-line": "^0.3.0",
"should-semantic-release": "^0.3.0",
"tsup": "^8.3.5",
"typedoc": "^0.26.11",
"typedoc-plugin-coverage": "^3.4.0",
"tsup": "^8.3.6",
"typedoc": "^0.27.6",
"typedoc-plugin-coverage": "^3.4.1",
"typedoc-plugin-custom-validation": "^2.0.2",
"typedoc-plugin-konamimojisplosion": "^0.0.2",
"typedoc-plugin-mdn-links": "^4.0.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"vitest": "^2.1.5"
"typedoc-plugin-mdn-links": "^4.0.10",
"typescript": "^5.7.3",
"typescript-eslint": "^8.22.0",
"vitest": "^2.1.8"
},
"peerDependencies": {
"typescript": ">=4.8.4"
},
"packageManager": "pnpm@9.14.2",
"packageManager": "pnpm@9.15.3",
"engines": {
"node": ">=18.12"
},

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/type-utils",
"version": "8.22.0",
"version": "8.23.0",
"description": "Type utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -46,10 +46,10 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/typescript-estree": "8.22.0",
"@typescript-eslint/utils": "8.22.0",
"@typescript-eslint/typescript-estree": "8.23.0",
"@typescript-eslint/utils": "8.23.0",
"debug": "^4.3.4",
"ts-api-utils": "^2.0.0"
"ts-api-utils": "^2.0.1"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",
@ -57,7 +57,7 @@
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/parser": "8.22.0",
"@typescript-eslint/parser": "8.23.0",
"ajv": "^6.12.6",
"downlevel-dts": "*",
"jest": "29.7.0",