(type, text)
| 71102 | return caseType.flags & 131072 /* TypeFlags.Never */ ? defaultType : getUnionType([caseType, defaultType]); |
| 71103 | } |
| 71104 | function getImpliedTypeFromTypeofGuard(type, text) { |
| 71105 | switch (text) { |
| 71106 | case "function": |
| 71107 | return type.flags & 1 /* TypeFlags.Any */ ? type : globalFunctionType; |
| 71108 | case "object": |
| 71109 | return type.flags & 2 /* TypeFlags.Unknown */ ? getUnionType([nonPrimitiveType, nullType]) : type; |
| 71110 | default: |
| 71111 | return typeofTypesByName.get(text); |
| 71112 | } |
| 71113 | } |
| 71114 | // When narrowing a union type by a `typeof` guard using type-facts alone, constituent types that are |
| 71115 | // super-types of the implied guard will be retained in the final type: this is because type-facts only |
| 71116 | // filter. Instead, we would like to replace those union constituents with the more precise type implied by |
no test coverage detected
searching dependent graphs…