-
Notifications
You must be signed in to change notification settings - Fork 522
Add support for typeof
keyword in type parameters
#1753
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
base: master
Are you sure you want to change the base?
Conversation
typeof
keyword in typestypeof
keyword in type parameters
@WoH can you take a look at this when you get a chance? |
I'll get to it over the weekend! It looks good from slimming the code, but I'll try to play around with it a bit |
}; | ||
|
||
const typeProperties: ts.Symbol[] = this.current.typeChecker.getPropertiesOfType(this.current.typeChecker.getTypeAtLocation(initializer)); | ||
const properties: Tsoa.Property[] = typeProperties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of the property management should already exist in checker based resolutions.
Ideally we can merge them together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on what you mean? Do you mean putting this code in a location that can be shared across other places where we do property management in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is taken from lines 194ff, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, parts of it are taken from another section. Do you want me to extract that to a shared method is my question
Hey, what is the status with this PR? @WoH @pclements12 |
All Submissions:
References Issue
This attempts to fix at least one of the sub issues related to the ability to use Zod's
z.infer
that was identified in #1256#1256 (comment)
Test plan
Adds a test case to the metadata / parameter resolver for
typeof
types as a parameter or return typeAdds an (expensive) unit test for TypeResolver to explicitly enumerate all of the type combinations that the resolver supports in a clean room environment. Open to suggestions on making this more efficient by combining into a single virtual source file, but the context of type right next to test is very valuable imo.
I've also included some types in this test that still fail (currently skipped) and are related to the other issues identified in #1256