Skip to content

Commit ca77636

Browse files
authored
feat: TypeChecker.prototype.resolveName (#1518)
1 parent e8b5727 commit ca77636

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

deno/ts_morph.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9860,6 +9860,7 @@ export declare class TypeChecker {
98609860
isTypeAssignableTo(sourceType: Type, targetType: Type): boolean;
98619861
/** Gets the shorthand assignment value symbol of the provided node. */
98629862
getShorthandAssignmentValueSymbol(node: Node): Symbol | undefined;
9863+
resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined;
98639864
}
98649865

98659866
export declare class Type<TType extends ts.Type = ts.Type> {

deno/ts_morph.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17890,6 +17890,10 @@ class TypeChecker {
1789017890
const symbol = this.compilerObject.getShorthandAssignmentValueSymbol(node.compilerNode);
1789117891
return symbol ? this.#context.compilerFactory.getSymbol(symbol) : undefined;
1789217892
}
17893+
resolveName(name, location, meaning, excludeGlobals) {
17894+
const symbol = this.compilerObject.resolveName(name, location?.compilerNode, meaning, excludeGlobals);
17895+
return symbol ? this.#context.compilerFactory.getSymbol(symbol) : undefined;
17896+
}
1789317897
}
1789417898

1789517899
class Program {

packages/ts-morph/lib/ts-morph.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9860,6 +9860,7 @@ export declare class TypeChecker {
98609860
isTypeAssignableTo(sourceType: Type, targetType: Type): boolean;
98619861
/** Gets the shorthand assignment value symbol of the provided node. */
98629862
getShorthandAssignmentValueSymbol(node: Node): Symbol | undefined;
9863+
resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined;
98639864
}
98649865

98659866
export declare class Type<TType extends ts.Type = ts.Type> {

packages/ts-morph/src/compiler/tools/TypeChecker.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,9 @@ export class TypeChecker {
276276
const symbol = this.compilerObject.getShorthandAssignmentValueSymbol(node.compilerNode);
277277
return symbol ? this.#context.compilerFactory.getSymbol(symbol) : undefined;
278278
}
279+
280+
resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean) {
281+
const symbol = this.compilerObject.resolveName(name, location?.compilerNode, meaning, excludeGlobals);
282+
return symbol ? this.#context.compilerFactory.getSymbol(symbol) : undefined;
283+
}
279284
}

0 commit comments

Comments
 (0)