New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mapped type: Record<'foo', string>
#653
Comments
Record does not give me the properties, so I haven't had time to address this. |
I've found this (to try in the const type = this.current.typeChecker.getTypeFromTypeNode(this.referencer);
const typeChecker = this.current.typeChecker
for (const property of type.getProperties()) {
const propertyType = typeChecker.getTypeOfSymbolAtLocation(property, this.typeNode);
console.log({
name: property.name,
declarationsCount: property.declarations && property.declarations.length,
typeName: typeChecker.typeToString(propertyType),
typeDeclarations: propertyType.symbol && propertyType.symbol.declarations && propertyType.symbol.declarations.length,
typeResolved: new TypeResolver(this.current.typeChecker.typeToTypeNode(propertyType)!, this.current, this.typeNode, this.context, this.referencer).resolve(),
})
} which prints this: {
name: 'record-foo',
declarationsCount: undefined,
typeName: '{ data: string; }',
typeDeclarations: 1,
typeResolved: {
additionalProperties: undefined,
dataType: 'nestedObjectLiteral',
properties: [ [Object] ]
}
}
{
name: 'record-bar',
declarationsCount: undefined,
typeName: '{ data: string; }',
typeDeclarations: 1,
typeResolved: {
additionalProperties: undefined,
dataType: 'nestedObjectLiteral',
properties: [ [Object] ]
}
} for: class TestModel {
record?: Record<'record-foo' | 'record-bar', { data: string }>
} EDIT: I've been able to find a way to make things works, but it need some duplications, you can check here master...Kiwup:record |
I'm trying to use
Record<'id', string>;
.I've seen #505 and it seems that it's known that
Record<>
aren't supported, but I wanted to have some update on this.Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
Thank you
The text was updated successfully, but these errors were encountered: