Skip to content

Commit aeddedc

Browse files
committed
update esmoduleinterop advice with Daniel rosenwasser
1 parent b4f7640 commit aeddedc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import * as React from 'react';
5555
import * as ReactDOM from 'react-dom';
5656
```
5757

58-
In [TypeScript 2.7+](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html), you can run Typescript with `--esModuleInterop` (or [add `"esModuleInterop": true` to tsconfig](https://stackoverflow.com/questions/48785451/is-there-a-way-to-use-esmoduleinterop-in-tsconfig-as-opposed-to-it-being-a-fla)) to import like in regular jsx:
58+
In [TypeScript 2.7+](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html), you can run Typescript with `--allowSyntheticDefaultImports` (or add `"allowSyntheticDefaultImports": true` to tsconfig) to import like in regular jsx:
5959

6060
```tsx
6161
import React from 'react';
@@ -66,7 +66,9 @@ import ReactDOM from 'react-dom';
6666

6767
<summary>Explanation</summary>
6868

69-
This is not yet written. Please PR or [File an issue](https://github.com/sw-yx/react-typescript-cheatsheet/issues/new) with your suggestions!
69+
Why not `esModuleInterop`? [Daniel Rosenwasser](https://twitter.com/drosenwasser/status/1003097042653073408) has said that it's better for webpack/parcel. For more discussion check out <https://github.com/wmonk/create-react-app-typescript/issues/214>
70+
71+
Please PR or [File an issue](https://github.com/sw-yx/react-typescript-cheatsheet/issues/new) with your suggestions!
7072
</details>
7173

7274

0 commit comments

Comments
 (0)