Skip to content

Commit 9912253

Browse files
committed
allowJs fix
1 parent 68637f8 commit 9912253

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/tsconfig/it/options/allowJs.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export const seme = 'Cuori';
1313
Quando lo importi in un file TypeScript ti uscirà un errore:
1414

1515
```js twoslash
16+
// @errors: 2307
17+
// @filename: carta.js
18+
module.exports.seme = "Cuori";
19+
// ---cut---
1620
// @filename: index.ts
1721
import { seme } from "./carta";
1822

@@ -22,10 +26,14 @@ console.log(seme);
2226
Ma verrà importato senza errori con `allowJs` abilitato:
2327

2428
```js twoslash
29+
// @filename: carta.js
30+
module.exports.seme = "Cuori";
31+
// ---cut---
32+
// @allowJs
2533
// @filename: index.ts
2634
import { seme } from "./carta";
2735

28-
console.log(mazzodiCarteDefault);
36+
console.log(seme);
2937
```
3038

3139
Questa opzione può essere usata come metodo per aggiungere file TypeScript in progetti JS permettendo ai file `.ts` e `.tsx` di coesistere con i file JavaScript esistenti.

0 commit comments

Comments
 (0)