Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: TypeChecker.prototype.resolveName #1518

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions deno/ts_morph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9858,6 +9858,7 @@ export declare class TypeChecker {
getTypeArguments(typeReference: Type): Type<ts.Type>[];
/** Gets the shorthand assignment value symbol of the provided node. */
getShorthandAssignmentValueSymbol(node: Node): Symbol | undefined;
resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined;
}

export declare class Type<TType extends ts.Type = ts.Type> {
Expand Down
4 changes: 4 additions & 0 deletions deno/ts_morph.js
Original file line number Diff line number Diff line change
Expand Up @@ -17887,6 +17887,10 @@ class TypeChecker {
const symbol = this.compilerObject.getShorthandAssignmentValueSymbol(node.compilerNode);
return symbol ? this.#context.compilerFactory.getSymbol(symbol) : undefined;
}
resolveName(name, location, meaning, excludeGlobals) {
const symbol = this.compilerObject.resolveName(name, location?.compilerNode, meaning, excludeGlobals);
return symbol ? this.#context.compilerFactory.getSymbol(symbol) : undefined;
}
}

class Program {
Expand Down
1 change: 1 addition & 0 deletions packages/ts-morph/lib/ts-morph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9858,6 +9858,7 @@ export declare class TypeChecker {
getTypeArguments(typeReference: Type): Type<ts.Type>[];
/** Gets the shorthand assignment value symbol of the provided node. */
getShorthandAssignmentValueSymbol(node: Node): Symbol | undefined;
resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined;
}

export declare class Type<TType extends ts.Type = ts.Type> {
Expand Down
5 changes: 5 additions & 0 deletions packages/ts-morph/src/compiler/tools/TypeChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,9 @@ export class TypeChecker {
const symbol = this.compilerObject.getShorthandAssignmentValueSymbol(node.compilerNode);
return symbol ? this.#context.compilerFactory.getSymbol(symbol) : undefined;
}

resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean) {
const symbol = this.compilerObject.resolveName(name, location?.compilerNode, meaning, excludeGlobals);
return symbol ? this.#context.compilerFactory.getSymbol(symbol) : undefined;
}
}