-
-
Notifications
You must be signed in to change notification settings - Fork 2k
types: Separate camelCase SVG attributes to compat only (#4994) #4997
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: main
Are you sure you want to change the base?
Conversation
rschristian
left a comment
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.
Thanks for doing this! Few comments:
|
Hi @rschristian ,
|
|
I gave this a test by installing into a separate project and it doesn't seem to be functioning correctly, the JSX namespace is not updated when // When the following line is uncommented, the type error should disappear
// import 'preact/compat';
const fillOpacityTest = <rect fillOpacity="0.5" />;The |
|
Hi @rschristian ,
These changes ensure the JSX namespace is properly updated in both scenarios:
|
|
Thanks! I'll have to test yet, but can you explain the need for the |
|
The jsx-runtime.d.ts files would be needed specifically when:
If you want to test without them first and only add if needed, that's reasonable. The global augmentation might be sufficient if:
Do you want me to remove them and just keep the global augmentation? |
rschristian
left a comment
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.
- jsxImportSource: "preact/compat"
This is not a concern, no one should be doing this and we don't document it anywhere.
Adding a dedicated compat/jsx-runtime.d.ts module makes sense to me as it should cover the situations in which a node module uses only the JSX runtime import from "react" and nothing else. Along those lines though, it's likely that all top-level .d.ts files within compat will need similar re-exporting, so client.d.ts & server.d.ts primariliy.
|
|
Did you try using this? // When the following line is uncommented, the type error should disappear
// import 'preact/compat';
const fillOpacityTest = <rect fillOpacity="0.5" />;Perhaps I'm being daft, but doesn't seem to work as expected, even with the latest changes. |
Summary
strokeWidth,fillOpacity) from core to compat onlystroke-width,fill-opacity)CamelCaseSVGAttributesinterface in compat for React compatibilityCompatJSXnamespace that extends core JSX with camelCase SVG supportTest plan
npm run test:tspassesCloses #4994
Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=132382032