From a2f0cbfcecddd758a03f61a26be279d2e2765c4c Mon Sep 17 00:00:00 2001 From: Evgeniy Timokhov Date: Tue, 2 Jan 2024 21:12:55 +0000 Subject: [PATCH 1/2] Exposed `TypeChecker.resolveName` API to public along with `SymbolFlags.All` Related to #46793 --- src/compiler/types.ts | 3 +-- tests/baselines/reference/api/typescript.d.ts | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e56bba5ab4859..f12faf7273420 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5238,7 +5238,7 @@ export interface TypeChecker { * @internal */ getAllPossiblePropertiesOfTypes(type: readonly Type[]): Symbol[]; - /** @internal */ resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined; + resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined; /** @internal */ getJsxNamespace(location?: Node): string; /** @internal */ getJsxFragmentFactory(location: Node): string | undefined; @@ -5744,7 +5744,6 @@ export const enum SymbolFlags { Transient = 1 << 25, // Transient symbol (created during type check) Assignment = 1 << 26, // Assignment treated as declaration (eg `this.prop = 1`) ModuleExports = 1 << 27, // Symbol for CommonJS `module` of `module.exports` - /** @internal */ All = FunctionScopedVariable | BlockScopedVariable | Property | EnumMember | Function | Class | Interface | ConstEnum | RegularEnum | ValueModule | NamespaceModule | TypeLiteral | ObjectLiteral | Method | Constructor | GetAccessor | SetAccessor | Signature | TypeParameter | TypeAlias | ExportValue | Alias | Prototype | ExportStar | Optional | Transient, diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 235f8aeed7c3b..7f6b994e02793 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -6861,6 +6861,7 @@ declare namespace ts { * True if this type is assignable to `ReadonlyArray`. */ isArrayLikeType(type: Type): boolean; + resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined; getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined; /** * Depending on the operation performed, it may be appropriate to throw away the checker @@ -7000,6 +7001,7 @@ declare namespace ts { Transient = 33554432, Assignment = 67108864, ModuleExports = 134217728, + All = 67108863, Enum = 384, Variable = 3, Value = 111551, From fd6f476e81def3de3f30d4a8118d486858b2dfc9 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 19 Jan 2024 12:10:18 -0800 Subject: [PATCH 2/2] Update SymbolFlags.All to be -1 --- src/compiler/types.ts | 3 +-- tests/baselines/reference/api/typescript.d.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f12faf7273420..3854685913dbf 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5744,8 +5744,7 @@ export const enum SymbolFlags { Transient = 1 << 25, // Transient symbol (created during type check) Assignment = 1 << 26, // Assignment treated as declaration (eg `this.prop = 1`) ModuleExports = 1 << 27, // Symbol for CommonJS `module` of `module.exports` - All = FunctionScopedVariable | BlockScopedVariable | Property | EnumMember | Function | Class | Interface | ConstEnum | RegularEnum | ValueModule | NamespaceModule | TypeLiteral - | ObjectLiteral | Method | Constructor | GetAccessor | SetAccessor | Signature | TypeParameter | TypeAlias | ExportValue | Alias | Prototype | ExportStar | Optional | Transient, + All = -1, Enum = RegularEnum | ConstEnum, Variable = FunctionScopedVariable | BlockScopedVariable, diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 7f6b994e02793..4ca29945a8cfb 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -7001,7 +7001,7 @@ declare namespace ts { Transient = 33554432, Assignment = 67108864, ModuleExports = 134217728, - All = 67108863, + All = -1, Enum = 384, Variable = 3, Value = 111551,