-
Notifications
You must be signed in to change notification settings - Fork 5.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
std: Provide types for React and ReactDOM #4376
Conversation
Introduces `std/types` which is designed to provide types for common libraries that are compatible with Deno.
They are adapted and modifying them to lint them doesn't make sense.
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.
LGTM
Why do types of third-party libraries have to be in std? |
@irustm it is a convenience, because of the popularity of React, especially in the Deno community working on server side rendering with React. There are several type libraries at Definitely Typed ( Eventually, I would hope we would/could solve converting |
Pika CDN serves @types/* for any packages that it can, if no type declarations are shipped with the package itself. React I think is the ONE package that we don't, for dumb implementation reasons on my end. I'll add it to my roadmap to serve React & ReactDOM types as well now that that's a use-case that Deno is interested in. |
Introduces `std/types` which is designed to provide types for common libraries that are compatible with Deno.
Introduces `types` which is designed to provide types for common libraries that are compatible with Deno.
Introduces `types` which is designed to provide types for common libraries that are compatible with Deno.
Introduces `types` which is designed to provide types for common libraries that are compatible with Deno.
Introduces `types` which is designed to provide types for common libraries that are compatible with Deno.
Introduces `types` which is designed to provide types for common libraries that are compatible with Deno.
Introduces `types` which is designed to provide types for common libraries that are compatible with Deno.
Introduces `types` which is designed to provide types for common libraries that are compatible with Deno.
Introduces `types` which is designed to provide types for common libraries that are compatible with Deno.
Fixes #4197
Introduces
std/types
which is designed to provide types for common libraries that are compatible with Deno.Under
strict
mode, JSX is strongly typed. Without a JSX library being in scope of the compiler, the compiler is uncertain of what JSX is actually supported. At the same time, while React works under Deno, there are currently no available sources of React which supply compatible types, meaning that working with JSX under a TSX file does not work.This PR provides types, based on DefinitelyTyped types, that work with Deno.
Once merged, they could be used like this:
This is still not quite ideal, because it would be great if the
X-TypeScript-Types
were set on the source and the compiler hint would no longer be required. @sholladay suggested thatdeno.land/x/
could host a redirect that also set theX-TypeScript-Types
header. I also think @FredKSchott would be interested in this for Pika.