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

Function getWidenedTypeOfObjectLiteral

test/fixtures/snapshot/typescript.js:67818–67835  ·  view source on GitHub ↗
(type, context)

Source from the content-addressed store, hash-verified

67816 return result;
67817 }
67818 function getWidenedTypeOfObjectLiteral(type, context) {
67819 var members = ts.createSymbolTable();
67820 for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) {
67821 var prop = _a[_i];
67822 members.set(prop.escapedName, getWidenedProperty(prop, context));
67823 }
67824 if (context) {
67825 for (var _b = 0, _c = getPropertiesOfContext(context); _b < _c.length; _b++) {
67826 var prop = _c[_b];
67827 if (!members.has(prop.escapedName)) {
67828 members.set(prop.escapedName, getUndefinedProperty(prop));
67829 }
67830 }
67831 }
67832 var result = createAnonymousType(type.symbol, members, ts.emptyArray, ts.emptyArray, ts.sameMap(getIndexInfosOfType(type), function (info) { return createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly); }));
67833 result.objectFlags |= (ts.getObjectFlags(type) & (4096 /* ObjectFlags.JSLiteral */ | 262144 /* ObjectFlags.NonInferrableType */)); // Retain js literal flag through widening
67834 return result;
67835 }
67836 function getWidenedType(type) {
67837 return getWidenedTypeWithContext(type, /*context*/ undefined);
67838 }

Callers 1

Calls 10

getWidenedPropertyFunction · 0.85
getPropertiesOfContextFunction · 0.85
getUndefinedPropertyFunction · 0.85
createAnonymousTypeFunction · 0.85
getIndexInfosOfTypeFunction · 0.85
createIndexInfoFunction · 0.85
getWidenedTypeFunction · 0.85
hasMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected