-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
Release/maintain TypeScript bindings (.d.ts) for ReactJS #2029
Comments
+1 |
1 similar comment
+1 |
|
I think you've misunderstood; and I don't think #759 is related. That's asking for some support for TypeScript constructs in JSX, which indeed will be complicated. I'm not asking for any changes to any code/functionality; only for a TypeScript definition file to be released with React. This is not related to JSX at all; it would just annotate the types so TypeScrip can give code-completion and "type checking" for things like react.DOM.xxx and the methods available in each object. Facebook have already done this with immutable collections; the TypeScript definition is here: |
FWIW, I believe the bindings could be auto-generated if there's sufficient metadata about the types in react. If the docs are auto-generated, then it's possible just a variation of that script; which would then only need running with each release/checkin to keep current? |
Oh ofc. Although it may not be the entire story, it seems that the next release (0.12) will not feature |
I haven't actually tried using TS yet; so I wasn't sure if there were any issues in doing so. I've been bitten recently by poor TS bindings for other projects (like Angular), so since we're prototyping in React, I was trying to raise support for official bindings here in the hope they could be provided (and versioned with React). To be honest; if we choose to use React, we probably wouldn't be against creating/maintaining bindings ourselves; as long as the required data is exposed in some parsable form (though if it is; it'd be nicer for everyone if FB created them ;-)) |
Hey there @DanTup. Typescript is currently not very compatible with React, and it seems the problem needs fixing on both sides of the fence. You could have a look at this project https://github.com/fdecampredon/react-typescript by @fdecampredon. My comment in #759 should also be of interest to you: #759 (comment) I love typescript but I also like to think in Components like React allows you to. The way we are currently progressing is that we are building all views and components in JSX and all stores / logic in TS until we can go full Typescript (which i hope is something like 6-12 months away) |
@abergs Thanks for the info; I'd read through #759, but it seemed to be much bigger than I was asking for (JSX support is certainly complicated, and we're not all that interested in that due to poor tooling support). I hoped it'd be possible to have TS support just for code-completion and type checking in components (ideally with generics so our State/Props could be typed too). It's not a dealbreaker; since as you point out, we could still use TS for the rest of the code; it'd just be nice if we got the benefits of TS everywhere :-) |
@DanTup I'm with you! However the issues linked in my #759 (comment) is very much related to react/TS without JSX |
+1 |
https://github.com/borisyankov/DefinitelyTyped/tree/master/react has up-to-date (unofficial) |
Seems like this is resolved. |
@gaearon I wouldn't say it is solved, if you mean the unofficial typings in DefinitelyTyped with that. IMHO these are a workaround. For example it is very hard to control typings for prereleases of React with DefinitelyTyped. |
What is actionable for the team here? |
I guess we need a statement if the team is interested in including Typescript definitions or not and if they would accept definitions inside a PR what the requirements are. |
I really like React; but I kinda hate JavaScript due to lack of typing. TypeScript looks good; but the 3rd party bindings are truly terrible (constantly breaking, and generally not versioned at all well).
The immutable JS collections released recently by Facebook include TypeScript bindings; which fills us with hope that maybe the same might happen for React. Please, make it so :)
I'm aware JSX won't work with TypeScript; that's no big loss; I prefer pure script, it plays nicer with existing JS tools.
The text was updated successfully, but these errors were encountered: