File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -14609,9 +14609,7 @@ namespace ts {
14609
14609
14610
14610
function checkTypeOfExpression(node: TypeOfExpression): Type {
14611
14611
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)));
14615
14613
}
14616
14614
14617
14615
function checkVoidExpression(node: VoidExpression): Type {
Original file line number Diff line number Diff line change @@ -895,6 +895,14 @@ namespace ts {
895
895
return result ;
896
896
}
897
897
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
+
898
906
/**
899
907
* Calls `callback` for each entry in the map, returning the first truthy result.
900
908
* Use `map.forEach` instead for normal iteration.
You can’t perform that action at this time.
0 commit comments