Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,7 @@ namespace ts {
}

function createTypeofType() {
return getUnionType(convertToArray(typeofEQFacts.keys(), getLiteralType));
return getUnionType(arrayFrom(typeofEQFacts.keys(), getLiteralType));
}

// A reserved member name starts with two underscores, but the third character cannot be an underscore
Expand Down Expand Up @@ -10531,12 +10531,8 @@ namespace ts {
}
}

function inferFromParameterTypes(source: Type, target: Type) {
return inferFromTypes(source, target);
}

function inferFromSignature(source: Signature, target: Signature) {
forEachMatchingParameterType(source, target, inferFromParameterTypes);
forEachMatchingParameterType(source, target, inferFromTypes);

if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) {
inferFromTypes(source.typePredicate.type, target.typePredicate.type);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ namespace ts {
case "object":
return {};
default:
return arrayFrom((<CommandLineOptionOfCustomType>option).type.keys())[0];
return (option as CommandLineOptionOfCustomType).type.keys().next().value;
}
}

Expand Down
10 changes: 1 addition & 9 deletions src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -996,14 +996,6 @@ namespace ts {
return result;
}

export function convertToArray<T, U>(iterator: Iterator<T>, f: (value: T) => U) {
const result: U[] = [];
for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) {
result.push(f(value));
}
return result;
}

/**
* Calls `callback` for each entry in the map, returning the first truthy result.
* Use `map.forEach` instead for normal iteration.
Expand Down Expand Up @@ -2527,4 +2519,4 @@ namespace ts {
export function isCheckJsEnabledForFile(sourceFile: SourceFile, compilerOptions: CompilerOptions) {
return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs;
}
}
}