-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Function that returns Preact component causes TypeScript “private name” error #947
Comments
PR would be awesome for this, I have no idea what's going on haha. |
@developit haha, same 😓 I’m still getting to the bottom of this, but if/when I do I’ll beam you a PR. |
@meyer We just merged some exciting updates to the TypeScript typings into master. Can check if these changes fixed your problem? 🎉 |
@marvinhagemeister will do! |
@marvinhagemeister I finally got a second to take a look, and it looks like my original issue has been fixed with the updated types. Thanks! |
@meyer That's awesome! We're currently in the process of cutting a new release 🎉 |
I've opened a request to fix issues like these in TypeScript by bringing declaration files to parity with language features. microsoft/TypeScript#35822 |
I maintain a library for React and Preact. The library consists of a function that returns a class component. With React plus
@types/react
, each instance of the factory receives a generic instance of the ReactComponent
interface with my additions. With Preact, the TypeScript compiler complains about a private name:It’d be super neat if Preact’s
Component
type definition behaved the same way that React’sComponent
type definition did in this regard.The relevant bits of the factory function:
Output type defs from the React version:
For Preact, I have to manually define a
JsxstyleComponent
type.The referenced functions live here:
I’m still wrapping my head around TypeScript but I’m going to do some digging/reading so I can whip up a PR.
The text was updated successfully, but these errors were encountered: