Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5cef627

Browse filesBrowse files
author
Andy
authored
Remove duplicate helper function (microsoft#23001)
1 parent e3f02b5 commit 5cef627
Copy full SHA for 5cef627

2 files changed

+5-10Lines changed: 5 additions & 10 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/compiler/core.ts‎

Copy file name to clipboardExpand all lines: src/compiler/core.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2909,7 +2909,7 @@ namespace ts {
29092909
return value;
29102910
}
29112911

2912-
export function assertEachDefined<T, A extends ReadonlyArray<T>>(value: A, message: string): A {
2912+
export function assertEachDefined<T, A extends ReadonlyArray<T>>(value: A, message?: string): A {
29132913
for (const v of value) {
29142914
assertDefined(v, message);
29152915
}
Collapse file

‎src/compiler/program.ts‎

Copy file name to clipboardExpand all lines: src/compiler/program.ts
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ namespace ts {
546546
let resolveModuleNamesWorker: (moduleNames: string[], containingFile: string, reusedNames?: string[]) => ResolvedModuleFull[];
547547
const hasInvalidatedResolution = host.hasInvalidatedResolution || returnFalse;
548548
if (host.resolveModuleNames) {
549-
resolveModuleNamesWorker = (moduleNames, containingFile, reusedNames) => host.resolveModuleNames(checkAllDefined(moduleNames), containingFile, reusedNames).map(resolved => {
549+
resolveModuleNamesWorker = (moduleNames, containingFile, reusedNames) => host.resolveModuleNames(Debug.assertEachDefined(moduleNames), containingFile, reusedNames).map(resolved => {
550550
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
551551
if (!resolved || (resolved as ResolvedModuleFull).extension !== undefined) {
552552
return resolved as ResolvedModuleFull;
@@ -559,16 +559,16 @@ namespace ts {
559559
else {
560560
moduleResolutionCache = createModuleResolutionCache(currentDirectory, x => host.getCanonicalFileName(x));
561561
const loader = (moduleName: string, containingFile: string) => resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule;
562-
resolveModuleNamesWorker = (moduleNames, containingFile) => loadWithLocalCache(checkAllDefined(moduleNames), containingFile, loader);
562+
resolveModuleNamesWorker = (moduleNames, containingFile) => loadWithLocalCache(Debug.assertEachDefined(moduleNames), containingFile, loader);
563563
}
564564

565565
let resolveTypeReferenceDirectiveNamesWorker: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[];
566566
if (host.resolveTypeReferenceDirectives) {
567-
resolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile) => host.resolveTypeReferenceDirectives(checkAllDefined(typeDirectiveNames), containingFile);
567+
resolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile) => host.resolveTypeReferenceDirectives(Debug.assertEachDefined(typeDirectiveNames), containingFile);
568568
}
569569
else {
570570
const loader = (typesRef: string, containingFile: string) => resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective;
571-
resolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile) => loadWithLocalCache(checkAllDefined(typeReferenceDirectiveNames), containingFile, loader);
571+
resolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile) => loadWithLocalCache(Debug.assertEachDefined(typeReferenceDirectiveNames), containingFile, loader);
572572
}
573573

574574
// Map from a stringified PackageId to the source file with that id.
@@ -2428,11 +2428,6 @@ namespace ts {
24282428
}
24292429
}
24302430

2431-
function checkAllDefined(names: string[]): string[] {
2432-
Debug.assert(names.every(name => name !== undefined), "A name is undefined.", () => JSON.stringify(names));
2433-
return names;
2434-
}
2435-
24362431
function getModuleNames({ imports, moduleAugmentations }: SourceFile): string[] {
24372432
const res = imports.map(i => i.text);
24382433
for (const aug of moduleAugmentations) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.