MCPcopy Create free account
hub / github.com/nodejs/node / reduceAddAsTypeOnlyValues

Function reduceAddAsTypeOnlyValues

test/fixtures/snapshot/typescript.js:152987–152995  ·  view source on GitHub ↗
(prevValue, newValue)

Source from the content-addressed store, hash-verified

152985 ts.Debug.assertNever(fix, "fix wasn't never - got kind ".concat(fix.kind));
152986 }
152987 function reduceAddAsTypeOnlyValues(prevValue, newValue) {
152988 // `NotAllowed` overrides `Required` because one addition of a new import might be required to be type-only
152989 // because of `--importsNotUsedAsValues=error`, but if a second addition of the same import is `NotAllowed`
152990 // to be type-only, the reason the first one was `Required` - the unused runtime dependency - is now moot.
152991 // Alternatively, if one addition is `Required` because it has no value meaning under `--preserveValueImports`
152992 // and `--isolatedModules`, it should be impossible for another addition to be `NotAllowed` since that would
152993 // mean a type is being referenced in a value location.
152994 return Math.max(prevValue !== null && prevValue !== void 0 ? prevValue : 0, newValue);
152995 }
152996 function getNewImportEntry(moduleSpecifier, importKind, useRequire, addAsTypeOnly) {
152997 // A default import that requires type-only makes the whole import type-only.
152998 // (We could add `default` as a named import, but that style seems undesirable.)

Callers 1

addImportFunction · 0.85

Calls 1

maxMethod · 0.45

Tested by

no test coverage detected