-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
v11: TypeScript infers incorrect type when composing styles/classes #1655
Comments
It seems to relate to this code which has been removed:
And now in the template arguments the |
Thank you for investigating, it will be a great help in fixing this ❤️ |
…ed as the composed component type Fixes emotion-js#1655
@JakeGinnivan thank you for finding a solution for this, I'm not sure I would have found it. Is it ready for a PR into the next branch? |
@frankwallis the fix is already in the current |
@frankwallis oh wait, no I was getting confused with another fix. There was a few additional comments to sort, will get it done today! |
awesome, thanks! |
@JakeGinnivan so this was not yet fixed by #1664? |
@Andarist it just wasn't merged, once v11 gets released again it will |
It got merged in few minutes ago - I'll cut a new release soon, so if the fix is already on next I would prefer to close this issue already. Stay tuned for a new release! |
I can confirm that our build is now working fine with no changes using v11 (we are not using theming). The build time has gone down from ~38 seconds to ~26 seconds which is really awesome, and I think will have a big impact when using VSCode. Thanks for the great work! |
Thank you for checking! |
emotion-js#1664) * Created additional overload to prevent AdditionalProps getting inferred as the composed component type Fixes emotion-js#1655 * Added additional test showing additional props * Update .changeset/lucky-swans-kneel.md Co-Authored-By: Mateusz Burzyński <mateuszburzynski@gmail.com>
Current behavior:
When composing styles the type of the created styled component is inferred to be a union of the created type and any element types referenced in the template literal
To reproduce:
The following code gives a TypeScript error using v11 but not under v10:
The resultant type becomes
HTMLInputElement & HTMLLabelElement
(or similar) and so the onChange handler is not allowedExpected behavior:
In the above code the
Input
component should be inferred to be just HTMLInputElementEnvironment information:
react
version:16.11.0
emotion
version:11.0.0-next.5
The text was updated successfully, but these errors were encountered: