Skip to content

Commit 1da6921

Browse files
committed
Updated typescript compatibility types according to the latest available API
See microsoft/TypeScript#56932
1 parent 61271b5 commit 1da6921

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/helpers/typescript.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -656,14 +656,13 @@ export function getDeclarationsForExportedValues(exp: ts.ExportAssignment | ts.E
656656
}
657657

658658
export function hasGlobalName(typeChecker: ts.TypeChecker, name: string): boolean {
659-
interface TsInternalEmitResolver {
660-
hasGlobalName(name: string): boolean;
661-
}
662-
663659
interface Ts54CompatTypeChecker extends ts.TypeChecker {
664-
getEmitResolver(): TsInternalEmitResolver;
660+
resolveName(name: string, location: ts.Node | undefined, meaning: ts.SymbolFlags, excludeGlobals: boolean): ts.Symbol | undefined;
665661
}
666662

667-
// see https://github.com/microsoft/TypeScript/issues/46793
668-
return (typeChecker as Ts54CompatTypeChecker).getEmitResolver().hasGlobalName(name);
663+
// this value isn't available in all typescript versions so lets assign its value here instead
664+
const tsSymbolFlagsAll = /* ts.SymbolFlags.All */ -1 as ts.SymbolFlags;
665+
666+
// see https://github.com/microsoft/TypeScript/pull/56932
667+
return (typeChecker as Ts54CompatTypeChecker).resolveName(name, undefined, tsSymbolFlagsAll, false) !== undefined;
669668
}

0 commit comments

Comments
 (0)