* Returns `true` if the intersection of the template literals and string literals is the empty set, eg `get${string}` & "setX", and should reduce to `never`
(types)
| 61505 | * Returns `true` if the intersection of the template literals and string literals is the empty set, eg `get${string}` & "setX", and should reduce to `never` |
| 61506 | */ |
| 61507 | function extractRedundantTemplateLiterals(types) { |
| 61508 | var i = types.length; |
| 61509 | var literals = ts.filter(types, function (t) { return !!(t.flags & 128 /* TypeFlags.StringLiteral */); }); |
| 61510 | while (i > 0) { |
| 61511 | i--; |
| 61512 | var t = types[i]; |
| 61513 | if (!(t.flags & 134217728 /* TypeFlags.TemplateLiteral */)) |
| 61514 | continue; |
| 61515 | for (var _i = 0, literals_1 = literals; _i < literals_1.length; _i++) { |
| 61516 | var t2 = literals_1[_i]; |
| 61517 | if (isTypeSubtypeOf(t2, t)) { |
| 61518 | // eg, ``get${T}` & "getX"` is just `"getX"` |
| 61519 | ts.orderedRemoveItemAt(types, i); |
| 61520 | break; |
| 61521 | } |
| 61522 | else if (isPatternLiteralType(t)) { |
| 61523 | return true; |
| 61524 | } |
| 61525 | } |
| 61526 | } |
| 61527 | return false; |
| 61528 | } |
| 61529 | function eachIsUnionContaining(types, flag) { |
| 61530 | return ts.every(types, function (t) { return !!(t.flags & 1048576 /* TypeFlags.Union */) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); }); |
| 61531 | } |
no test coverage detected