Add explicit assertion on somewhat commonly incorrectly passed argument (#48078)

* Add explicit assertion on somewhat commonly incorrectly passed argument

* PR feedback
This commit is contained in:
Wesley Wigham
2022-03-02 09:13:42 -08:00
committed by GitHub
parent ea0db9e031
commit f82d0cb329

View File

@@ -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;