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
Improve react typescript compatibility #2329
base: main
Are you sure you want to change the base?
Conversation
Fixed #1930 |
For clarity, I am trying to get an existing react project working with preact. I encountered a number of typescript incompatibilities as described in #1930 and attempted to fix them with the proposed changes. I added the following in my tsconfig.json:
And in package.json applied a browserify global transform using aliasify to alias react and react-dom to preact/compat. |
Incorporated #2150 (comment) |
I know it's been a while, there are some more types missing in #2414 if you want to add those |
Any chance this could be merged? 👼 |
import { JSXInternal } from '../../src/jsx'; | ||
|
||
export = JSXInternal; | ||
export as namespace JSX; |
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 think this broke typescript before
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.
In what way? I skimmed through the referenced issue but did not understand how this breaks typescript. This file declares the JSX namespace, without which, typescript does not process jsx. This is also the same way react itself exports the JSX namespace
When using
I wasn't using this branch though, but I guess you need to add |
@bvella could you update this branch with the base branch so it can be re-approved and then released? |
Any update on this? Is there a complete workaround with all the changes needed to perform to a Preact project to be able to use typed React libraries in it until it merged? |
I would like to contribute to this effort.. I'm not sure how to do it besides creating a separate PR. Is that ok? |
No description provided.