types: Separate camelCase SVG attributes to compat only (#4994)#4997
types: Separate camelCase SVG attributes to compat only (#4994)#4997gayanMatch wants to merge 4 commits intopreactjs:mainfrom
Conversation
rschristian
left a comment
There was a problem hiding this comment.
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.
- 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