Skip to content

Commit

Permalink
Add jsxImportSourceTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed May 1, 2024
1 parent 1238de7 commit 108979c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions runtime/manual/advanced/jsx_dom/jsx.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,32 @@ You would then need to pass the `--import-map` option on the command line (along
with the `--config` option is using a config file) or set the `deno.importMap`
option (and `deno.config` option) in your IDE.

### `jsxImportSourceTypes`

In certain cases, a library may not provide types. To specify the types, you can
use the `@jsxImportSourceTypes` pragma:

```jsx
/** @jsxImportSource npm:react@^18.3 */
/** @jsxImportSourceTypes npm:@types/react@^18.3 */

export function Hello() {
return <div>Hello!</div>;
}
```

Or specify via the `jsxImportSourceTypes` compiler option in a _deno.json_:

```json
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "npm:react@^18.3",
"jsxImportSourceTypes": "npm:@types/react@^18.3"
}
}
```

### Current limitations

There are two current limitations of the support of the JSX import source:
Expand Down

0 comments on commit 108979c

Please sign in to comment.