MCPcopy Index your code
hub / github.com/nodejs/node / getSwitchClauseTypeOfWitnesses

Function getSwitchClauseTypeOfWitnesses

test/fixtures/snapshot/typescript.js:69838–69853  ·  view source on GitHub ↗
(switchStatement, retainDefault)

Source from the content-addressed store, hash-verified

69836 return links.switchTypes;
69837 }
69838 function getSwitchClauseTypeOfWitnesses(switchStatement, retainDefault) {
69839 var witnesses = [];
69840 for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
69841 var clause = _a[_i];
69842 if (clause.kind === 289 /* SyntaxKind.CaseClause */) {
69843 if (ts.isStringLiteralLike(clause.expression)) {
69844 witnesses.push(clause.expression.text);
69845 continue;
69846 }
69847 return ts.emptyArray;
69848 }
69849 if (retainDefault)
69850 witnesses.push(/*explicitDefaultStatement*/ undefined);
69851 }
69852 return witnesses;
69853 }
69854 function eachTypeContainedIn(source, types) {
69855 return source.flags & 1048576 /* TypeFlags.Union */ ? !ts.forEach(source.types, function (t) { return !ts.contains(types, t); }) : ts.contains(types, source);
69856 }

Callers 2

narrowBySwitchOnTypeOfFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected