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

Function allPropertiesAreAssignableToUsage

test/fixtures/snapshot/typescript.js:157396–157412  ·  view source on GitHub ↗
(type, usage)

Source from the content-addressed store, hash-verified

157394 return [];
157395 }
157396 function allPropertiesAreAssignableToUsage(type, usage) {
157397 if (!usage.properties)
157398 return false;
157399 return !ts.forEachEntry(usage.properties, function (propUsage, name) {
157400 var source = checker.getTypeOfPropertyOfType(type, name);
157401 if (!source) {
157402 return true;
157403 }
157404 if (propUsage.calls) {
157405 var sigs = checker.getSignaturesOfType(source, 0 /* SignatureKind.Call */);
157406 return !sigs.length || !checker.isTypeAssignableTo(source, getFunctionFromCalls(propUsage.calls));
157407 }
157408 else {
157409 return !checker.isTypeAssignableTo(source, combineFromUsage(propUsage));
157410 }
157411 });
157412 }
157413 /**
157414 * inference is limited to
157415 * 1. generic types with a single parameter

Callers 1

Calls 2

getFunctionFromCallsFunction · 0.85
combineFromUsageFunction · 0.85

Tested by

no test coverage detected