diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 514e8f401a9f6..bc2f859f8ecb9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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 @@ -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); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 178578ec4521b..5da7e83655fe5 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1290,7 +1290,7 @@ namespace ts { case "object": return {}; default: - return arrayFrom((option).type.keys())[0]; + return (option as CommandLineOptionOfCustomType).type.keys().next().value; } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 2eae414db66e9..5c7536a825ed6 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -996,14 +996,6 @@ namespace ts { return result; } - export function convertToArray(iterator: Iterator, 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. @@ -2527,4 +2519,4 @@ namespace ts { export function isCheckJsEnabledForFile(sourceFile: SourceFile, compilerOptions: CompilerOptions) { return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; } -} \ No newline at end of file +}