-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(types): don't overwrite types of infer fallback #2669
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c3f541f:
|
This fixes my issue. |
Not to celebrate too soon, the nested instrinsics are giving me the error For example:
|
Yeah, there's a myriad of issues going on here. If I can figure out how to narrow keys into a union that extend a type, I can fix it. |
b657651 works for now. I'd like type MathTypes = THREE.Color | MathRepresentation | VectorRepresentation
type MathKeys<P> = { [K in keyof P]-?: P[K] extends MathTypes ? never : K }[keyof P]
type MathType<M> = M extends THREE.Color
? ConstructorParameters<typeof THREE.Color> | THREE.ColorRepresentation
: M extends MathRepresentation
? M extends VectorRepresentation
? M | Parameters<M['set']> | Parameters<M['setScalar']>[0]
: M | Parameters<M['set']>
: {}
type MathProps<P> = {
[K in MathKeys<P>]: MathType<P[K]>
} |
Thanks Cody. I can confirm this fixed the issues I was having. Drei's type issues dropped by a significant amount too. |
Cool, if you can update the issue with a txt or snapshot that would help with withstanding issues. |
Addresses some type regressions with
{}
andchildren
investigated in #2668.