File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14609,9 +14609,7 @@ namespace ts {
1460914609
1461014610 function checkTypeOfExpression(node: TypeOfExpression): Type {
1461114611 checkExpression(node.expression);
14612- const types: Type[] = [];
14613- typeofEQFacts.forEach((_, s) => types.push(getLiteralTypeForText(TypeFlags.StringLiteral, s)));
14614- return getUnionType(types);
14612+ return getUnionType(arrayFromMap(typeofEQFacts.keys(), s => getLiteralTypeForText(TypeFlags.StringLiteral, s)));
1461514613 }
1461614614
1461714615 function checkVoidExpression(node: VoidExpression): Type {
Original file line number Diff line number Diff line change @@ -895,6 +895,14 @@ namespace ts {
895895 return result ;
896896 }
897897
898+ export function arrayFromMap < T , U > ( iterator : Iterator < T > , f : ( value : T ) => U ) {
899+ const result : U [ ] = [ ] ;
900+ for ( let { value, done } = iterator . next ( ) ; ! done ; { value, done } = iterator . next ( ) ) {
901+ result . push ( f ( value ) ) ;
902+ }
903+ return result ;
904+ }
905+
898906 /**
899907 * Calls `callback` for each entry in the map, returning the first truthy result.
900908 * Use `map.forEach` instead for normal iteration.
You can’t perform that action at this time.
0 commit comments