summaryrefslogtreecommitdiff
path: root/std/types/README.md
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-03-17 23:28:07 +1100
committerGitHub <noreply@github.com>2020-03-17 13:28:07 +0100
commit9050d36d5763beabb1a642819dd24d61cccb3ffe (patch)
treeb3c88e4c0964a4b3ea54642856a0fcbacd6017f7 /std/types/README.md
parent9833975ef21afced84c6a16724ce13d026f09298 (diff)
std: Provide types for React and ReactDOM (#4376)
Introduces `std/types` which is designed to provide types for common libraries that are compatible with Deno.
Diffstat (limited to 'std/types/README.md')
-rw-r--r--std/types/README.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/std/types/README.md b/std/types/README.md
new file mode 100644
index 000000000..86fa40a2d
--- /dev/null
+++ b/std/types/README.md
@@ -0,0 +1,28 @@
+# std/types
+
+Contains types for popular external packages that are compatible with Deno.
+
+Because Deno only resolves fully qualified file names, type definitions that
+import other type definitions might not work with Deno. Also, when some type
+definition supply some global interfaces, they can conflict with Deno. The types
+located here have been validated to work with Deno.
+
+The types that are currently available:
+
+- `react.d.ts` - For React 16. Sources known to work well for Deno:
+ - Pika CDN: `https://cdn.pika.dev/_/react/v16`
+ - JSPM: `https://dev.jspm.io/react@16`
+- `react-dom.d.ts` - For ReactDOM 16. Sources known to work well for Deno:
+ - Pika CDN: `https://cdn.pika.dev/_/react-dom/v16`
+ - JSPM: `https://dev.jspm.io/react-dom@16`
+
+There are several ways these type definitions can be referenced. Likely the
+"best" way is that the CDN provider provides a header of `X-TypeScript-Types`
+which points to the type definitions. We are working to have this available, but
+currently you would need to use the compiler hint of `@deno-types`. For example
+to import React:
+
+```ts
+// @deno-types="https://deno.land/std/types/react.d.ts"
+import React from "https://cdn.pika.dev/_/react/v16";
+```