You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tsconfig/it/options/allowJs.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,10 @@ export const seme = 'Cuori';
13
13
Quando lo importi in un file TypeScript ti uscirà un errore:
14
14
15
15
```js twoslash
16
+
// @errors: 2307
17
+
// @filename: carta.js
18
+
module.exports.seme="Cuori";
19
+
// ---cut---
16
20
// @filename: index.ts
17
21
import { seme } from"./carta";
18
22
@@ -22,10 +26,14 @@ console.log(seme);
22
26
Ma verrà importato senza errori con `allowJs` abilitato:
23
27
24
28
```js twoslash
29
+
// @filename: carta.js
30
+
module.exports.seme="Cuori";
31
+
// ---cut---
32
+
// @allowJs
25
33
// @filename: index.ts
26
34
import { seme } from"./carta";
27
35
28
-
console.log(mazzodiCarteDefault);
36
+
console.log(seme);
29
37
```
30
38
31
39
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