-
Notifications
You must be signed in to change notification settings - Fork 514
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
Add support for typeof
keyword in type parameters
#1753
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 |
@@ -0,0 +1,512 @@ | |||
import { expect } from 'chai'; |
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.
I'd prefer if you could integrate the tests in this file with the existing tests
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.
Spec Generators Tests most likely
}; | ||
|
||
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.
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