Create an object with properties named in the string literal type. Every property has type `any`
(type)
| 68168 | } |
| 68169 | /** Create an object with properties named in the string literal type. Every property has type `any` */ |
| 68170 | function createEmptyObjectTypeFromStringLiteral(type) { |
| 68171 | var members = ts.createSymbolTable(); |
| 68172 | forEachType(type, function (t) { |
| 68173 | if (!(t.flags & 128 /* TypeFlags.StringLiteral */)) { |
| 68174 | return; |
| 68175 | } |
| 68176 | var name = ts.escapeLeadingUnderscores(t.value); |
| 68177 | var literalProp = createSymbol(4 /* SymbolFlags.Property */, name); |
| 68178 | literalProp.type = anyType; |
| 68179 | if (t.symbol) { |
| 68180 | literalProp.declarations = t.symbol.declarations; |
| 68181 | literalProp.valueDeclaration = t.symbol.valueDeclaration; |
| 68182 | } |
| 68183 | members.set(name, literalProp); |
| 68184 | }); |
| 68185 | var indexInfos = type.flags & 4 /* TypeFlags.String */ ? [createIndexInfo(stringType, emptyObjectType, /*isReadonly*/ false)] : ts.emptyArray; |
| 68186 | return createAnonymousType(undefined, members, ts.emptyArray, ts.emptyArray, indexInfos); |
| 68187 | } |
| 68188 | /** |
| 68189 | * Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct |
| 68190 | * an object type with the same set of properties as the source type, where the type of each |
no test coverage detected
searching dependent graphs…