forked from denoland/std
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor std/types (denoland/deno#4713)
- Loading branch information
Showing
14 changed files
with
74 additions
and
33,085 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
# std/types | ||
|
||
Contains types for popular external packages that are compatible with Deno. | ||
Contains type definitions 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"; | ||
```typescript | ||
// @deno-types="https://deno.land/std/types/react/@16.13.1/react.d.ts" | ||
import React from "https://cdn.pika.dev/@pika/react@v16.13.1"; | ||
``` | ||
|
||
or | ||
|
||
```typescript | ||
// @deno-types="https://deno.land/std/types/react/@16.13.1/react.d.ts" | ||
import React from "https://dev.jspm.io/react@16.13.1"; | ||
``` | ||
|
||
#### Notes: | ||
|
||
JSPM transformation of most libraries export everything through the default | ||
namespace, so most of the time it might not be suited to work along with this | ||
definition library. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Types for Facebook's Prop-Types library. | ||
|
||
[![npm version](https://img.shields.io/npm/v/prop-types.svg?style=flat)](https://www.npmjs.com/package/prop-types) | ||
|
||
You can use prop-types to document the intended types of properties passed to | ||
functions and classes. This library is intended for his use alongside Facebook's | ||
React library, but can be used freely for runtime type checking outside of the | ||
React environment. | ||
|
||
### Usage Examples | ||
|
||
```typescript | ||
// @deno-types="https://deno.land/std/types/prop-types/v15.7.2/prop-types.d.ts" | ||
import PropTypes from "https://cdn.pika.dev/prop-types@15.7.2"; | ||
``` |
1 change: 0 additions & 1 deletion
1
types/react/prop-types.d.ts → types/prop-types/v15.7.2/prop-types.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Types for Facebook's React DOM library. | ||
|
||
[![npm version](https://img.shields.io/npm/v/react-dom.svg?style=flat)](https://www.npmjs.com/package/react-dom) | ||
|
||
This package serves as the entry point to the DOM and server renderers for | ||
Facebook's React library. | ||
|
||
### Usage Examples | ||
|
||
```typescript | ||
// @deno-types="https://deno.land/std/types/react-dom/v16.13.1/react-dom.d.ts" | ||
import ReactDOM from "https://cdn.pika.dev/@pika/react-dom@v16.13.1"; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
types/tests/react-dom_test.tsx → ...act-dom/v16.13.1/tests/react-dom_test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Types for Facebook's React library. | ||
|
||
[![npm version](https://img.shields.io/npm/v/react.svg?style=flat)](https://www.npmjs.com/package/react) | ||
|
||
React is a JavaScript library for building user interfaces. | ||
|
||
### Usage Examples | ||
|
||
```typescript | ||
// @deno-types="https://deno.land/std/types/react/v16.13.1/react.d.ts" | ||
import React from "https://cdn.pika.dev/@pika/react@v16.13.1"; | ||
``` |
Oops, something went wrong.