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

Function isValidBaseType

test/fixtures/snapshot/typescript.js:57272–57283  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

57270 }
57271 // A valid base type is `any`, an object type or intersection of object types.
57272 function isValidBaseType(type) {
57273 if (type.flags & 262144 /* TypeFlags.TypeParameter */) {
57274 var constraint = getBaseConstraintOfType(type);
57275 if (constraint) {
57276 return isValidBaseType(constraint);
57277 }
57278 }
57279 // TODO: Given that we allow type parmeters here now, is this `!isGenericMappedType(type)` check really needed?
57280 // There's no reason a `T` should be allowed while a `Readonly<T>` should not.
57281 return !!(type.flags & (524288 /* TypeFlags.Object */ | 67108864 /* TypeFlags.NonPrimitive */ | 1 /* TypeFlags.Any */) && !isGenericMappedType(type) ||
57282 type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, isValidBaseType));
57283 }
57284 function resolveBaseTypesOfInterface(type) {
57285 type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray;
57286 if (type.symbol.declarations) {

Callers 3

resolveBaseTypesOfClassFunction · 0.85

Calls 3

getBaseConstraintOfTypeFunction · 0.85
isGenericMappedTypeFunction · 0.85
everyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…