From f82d0cb3299c04093e3835bc7e29f5b40475f586 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 2 Mar 2022 09:13:42 -0800 Subject: [PATCH] Add explicit assertion on somewhat commonly incorrectly passed argument (#48078) * Add explicit assertion on somewhat commonly incorrectly passed argument * PR feedback --- src/compiler/moduleNameResolver.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index c63cc791782..da2324cc74e 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -298,6 +298,7 @@ namespace ts { * is assumed to be the same as root directory of the project. */ export function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference, cache?: TypeReferenceDirectiveResolutionCache, resolutionMode?: SourceFile["impliedNodeFormat"]): ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself."); const traceEnabled = isTraceEnabled(options, host); if (redirectedReference) { options = redirectedReference.commandLine.options;