Skip to content

Commit d4867f1

Browse files
authored
Merge pull request #2 from microsoft/main
Update main branch
2 parents 93dd6b4 + a7d0294 commit d4867f1

File tree

9 files changed

+306
-12
lines changed

9 files changed

+306
-12
lines changed

.github/CODEOWNERS

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# See https://github.com/OSS-Docs-Tools/code-owner-self-merge#readme
2+
3+
# Collaborators for Japanese Translation of the Website
4+
docs/playground/ja @sasurau4 @Quramy @Naturalclar @Takepepe [translation] [jp]
5+
docs/tsconfig/ja/**/*.md @sasurau4 @Quramy @Naturalclar @Takepepe [translation] [jp]
6+
docs/typescriptlang/ja/**/*.ts @sasurau4 @Quramy @Naturalclar @Takepepe [translation] [jp]
7+
docs/typescriptlang/ja.ts @sasurau4 @Quramy @Naturalclar @Takepepe [translation] [jp]
8+
docs/documentation/ja/**/*.md @sasurau4 @Quramy @Naturalclar @Takepepe [translation] [jp]
9+
10+
# Collaborators for Portuguese Translation of the Website
11+
docs/playground/pt @khaosdoctor @danilofuchs [translation] [pt]
12+
docs/tsconfig/pt/**/*.md @khaosdoctor @danilofuchs [translation] [pt]
13+
docs/typescriptlang/pt/**/*.ts @khaosdoctor @danilofuchs [translation] [pt]
14+
docs/typescriptlang/pt.ts @khaosdoctor @danilofuchs [translation] [pt]
15+
docs/documentation/pt/**/*.md @khaosdoctor @danilofuchs [translation] [pt]
16+
17+
# Collaborators for Spanish Translation of the Website
18+
docs/playground/es @KingDarBoja [translation] [es]
19+
docs/tsconfig/es/**/*.md @KingDarBoja [translation] [es]
20+
docs/typescriptlang/es/**/*.ts @KingDarBoja [translation] [es]
21+
docs/typescriptlang/es.ts @KingDarBoja [translation] [es]
22+
docs/documentation/es/**/*.md @KingDarBoja [translation] [es]
23+
24+
# Collaborators for Chinese Translation of the Website
25+
docs/playground/zh @Kingwl [translation] [zh]
26+
docs/tsconfig/zh/**/*.md @Kingwl [translation] [zh]
27+
docs/typescriptlang/zh/**/*.ts @Kingwl [translation] [zh]
28+
docs/typescriptlang/zh.ts @Kingwl [translation] [zh]
29+
docs/documentation/zh/**/*.md @Kingwl [translation] [zh]
30+
31+
# Collaborators for Korean Translation of the Website
32+
docs/playground/ko @Bumkeyy [translation] [ko]
33+
docs/tsconfig/ko/**/*.md @Bumkeyy [translation] [ko]
34+
docs/typescriptlang/ko/**/*.ts @Bumkeyy [translation] [ko]
35+
docs/typescriptlang/ko.ts @Bumkeyy [translation] [ko]
36+
docs/documentation/ko/**/*.md @Bumkeyy [translation] [ko]
37+
38+
# Collaborators for Indonesian Translation of the Website
39+
docs/playground/id @jefrydco @nusendra @mazipan @mandaputtra [translation] [id]
40+
docs/tsconfig/id/**/*.md @jefrydco @nusendra @mazipan @mandaputtra [translation] [id]
41+
docs/typescriptlang/id/**/*.ts @jefrydco @nusendra @mazipan @mandaputtra [translation] [id]
42+
docs/typescriptlang/id.ts @jefrydco @nusendra @mazipan @mandaputtra [translation] [id]
43+
docs/documentation/id/**/*.md @jefrydco @nusendra @mazipan @mandaputtra [translation] [id]
44+
45+
# Collaborators for Ukrainian Translation of the Website
46+
docs/playground/uk @AMashoshyna [translation] [uk]
47+
docs/tsconfig/uk/**/*.md @AMashoshyna [translation] [uk]
48+
docs/typescriptlang/uk/**/*.ts @AMashoshyna [translation] [uk]
49+
docs/typescriptlang/uk.ts @AMashoshyna [translation] [uk]
50+
docs/documentation/uk/**/*.md @AMashoshyna [translation] [uk]
51+
52+
# Collaborators for Polish Translation of the Website
53+
docs/playground/pl @msieroslawska @TomWebwalker [translation] [pl]
54+
docs/tsconfig/pl/**/*.md @msieroslawska @TomWebwalker [translation] [pl]
55+
docs/typescriptlang/pl/**/*.ts @msieroslawska @TomWebwalker [translation] [pl]
56+
docs/typescriptlang/pl.ts @msieroslawska @TomWebwalker [translation] [pl]
57+
docs/documentation/pl/**/*.md @msieroslawska @TomWebwalker [translation] [pl]
58+
59+
# Collaborators for Italian Translation of the Website
60+
docs/playground/it @Nabster101 @BassDrop07 @PyGera @oliversalzburg [translation] [it]
61+
docs/tsconfig/it/**/*.md @Nabster101 @BassDrop07 @PyGera @oliversalzburg [translation] [it]
62+
docs/typescriptlang/it/**/*.ts @Nabster101 @BassDrop07 @PyGera @oliversalzburg [translation] [it]
63+
docs/typescriptlang/it.ts @Nabster101 @BassDrop07 @PyGera @oliversalzburg [translation] [it]
64+
docs/documentation/it/**/*.md @Nabster101 @BassDrop07 @PyGera @oliversalzburg [translation] [it]

.github/workflows/codeowners-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Codeowners merging
22
on:
3-
pull_request_target: { types: opened }
3+
pull_request_target: { types: [ opened, synchronize, reopened] }
44
issue_comment: { types: created }
55
pull_request_review: { types: submitted }
66

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
display: "Permetti Import Sintetici Predefiniti"
3+
oneline: "Permette di importare un modulo x da un modulo y’ quando un modulo non ha un’esportazione standard"
4+
---
5+
6+
Quando è impostato a true, `allowSyntheticDefaultImports` permette di scrivere un import così:
7+
8+
```ts
9+
import React from "react";
10+
```
11+
12+
Al posto di:
13+
14+
```ts
15+
import * as React from "react";
16+
```
17+
18+
Quando un modulo **non** specifica esplicitamente un export predefinito.
19+
20+
Per esempio, senza `allowSyntheticDefaultImports` impostato a true:
21+
22+
```ts twoslash
23+
// @errors: 1259 1192
24+
// @checkJs
25+
// @allowJs
26+
// @esModuleInterop: false
27+
// @filename: utilFunctions.js
28+
// @noImplicitAny: false
29+
const getStringLength = (str) => str.length;
30+
31+
module.exports = {
32+
getStringLength,
33+
};
34+
35+
// @filename: index.ts
36+
import utils from "./utilFunctions";
37+
38+
const count = utils.getStringLength("Check JS");
39+
```
40+
41+
Questo codice segnala un errore perché un oggetto `default` che puoi importare non è presente.Anche se sembra che dovrebbe esserci. Per convenienza, se un oggetto `default` non è presente un transpiler come Babel automaticamente lo creerà.
42+
43+
```ts
44+
// @filename: utilFunctions.js
45+
const getStringLength = (str) => str.length;
46+
const allFunctions = {
47+
getStringLength,
48+
};
49+
50+
module.exports = allFunctions;
51+
module.exports.default = allFunctions;
52+
```
53+
54+
Questo flag non apporta cambiamenti al JavaScript emesso da TypeScript, è solo per controllare il tipo. Questa opzione porta il comportamento di TypeScript in linea con Babel emettendo un codice extra in modo di rendere l'uso di un export predefinito più ergonomico.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
display: "Permetti Accesso Globale UMD"
3+
oneline: "Rende tutte le importazioni UMD disponibili globalmente"
4+
---
5+
6+
Quando viene impostato a `true`, il flag `allowUmdGlobalAccess` ti permette ad accedere ai export UMD come globali dentro l'archivio dei moduli. Un file modulo è un file che ha dei imports e/o exports. Senza questo flag per usare un export di un modulo UMD è necessario dichiarare un import.
7+
8+
Un esempio di utilizzo di questo flag è un progetto web dove si conoscono le librerie particolari (come jQuery o Lodash) che saranno sempre disponibili al runtime, ma non puoi accedervi con un'import.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
display: "Permetti Codice Irraggiungibile"
3+
oneline: "Visualizza un errore quando il codice non verrà mai eseguito"
4+
---
5+
6+
Quando:
7+
8+
- `undefined` (predefinito) fornire suggerimenti come avviso agli editor
9+
- `true` il codice irraggiungibile viene ignorato
10+
- `false` visualizza un errore di compilazione quando viene trovato del codice irraggiungibile
11+
12+
Questi avvertimenti sono solo per codice che probabilmente è irraggiungibile a causa del uso di sintassi JavaScript, per esempio:
13+
14+
```ts
15+
function fn(n: number) {
16+
if (n > 5) {
17+
return true;
18+
} else {
19+
return false;
20+
}
21+
return true;
22+
}
23+
```
24+
25+
Con `"allowUnreachableCode": false`:
26+
27+
```ts twoslash
28+
// @errors: 7027
29+
// @allowUnreachableCode: false
30+
function fn(n: number) {
31+
if (n > 5) {
32+
return true;
33+
} else {
34+
return false;
35+
}
36+
return true;
37+
}
38+
```
39+
40+
Ciò non influisce sugli errori sulla base del codice che _sembra_ di essere irraggiungibile a causa dell analisi del tipo.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
display: "Importazione di Aiuti"
3+
oneline: "Permette di importare alcune funzioni ausiliari per il progetto"
4+
5+
---
6+
7+
TypeScript da alcuni suggerimenti per operazioni di livello inferiore come ad esempio estendere classi, spread di array o oggetti, e operazioni asincrone. In modo predefinito, questi suggerimenti vengono dati nei file che usano le operazioni elencate in precedenza. Tuttavia, nel caso in cui lo stesso suggerimento è usato in più moduli diversi, si possono verificare alcuni casi di duplicazione del codice.
8+
9+
Se l'opzione `importHelpers` è attiva, queste funzionalità ausiliari vengono importate dal modulo [tslib](https://www.npmjs.com/package/tslib). Dovrai assicurarti che il modulo `tslib` è in grado di essere importato in runtime. Questo riguarda solo i moduli; I file degli script globali non proveranno ad importare i moduli.
10+
11+
Per esempio, con questo codice TypeScript:
12+
13+
14+
```ts
15+
export function fn(arr: number[]) {
16+
const arr2 = [1, ...arr];
17+
}
18+
```
19+
20+
Attivando [`downlevelIteration`](#downlevelIteration), esso rimane falso:
21+
22+
```ts twoslash
23+
// @showEmit
24+
// @target: ES5
25+
// @downleveliteration
26+
export function fn(arr: number[]) {
27+
const arr2 = [1, ...arr];
28+
}
29+
```
30+
31+
Poi attivando entrambi [`downlevelIteration`](#downlevelIteration) e `importHelpers`:
32+
33+
```ts twoslash
34+
// @showEmit
35+
// @target: ES5
36+
// @downleveliteration
37+
// @importhelpers
38+
// @noErrors
39+
export function fn(arr: number[]) {
40+
const arr2 = [1, ...arr];
41+
}
42+
```
43+
44+
Puoi utilizzare [`noEmitHelpers`](#noEmitHelpers) quando metti a disposizione la tua implementazione di queste funzioni.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
display: "Incrementale"
3+
oneline: "Crea dei file .tsbuildinfo per permettere la compilazione incrementale del progetto"
4+
---
5+
6+
Dice a TypeScript di salvare le informazioni riguardo il grafo del progetto dall'ultima compliazione nei file salvati nel disco.
7+
Questo crea una serie di file `.tsbuildinfo` nella stessa cartella del risultato della compilazione. Essi non vengono usati dal tuo JavaScript durante l'esecuzione e possono essere tranquillamente eliminati. Puoi saperne di più riguardo questa flag nelle [3.4 note di rilascio](/docs/handbook/release-notes/typescript-3-4.html#faster-subsequent-builds-with-the---incremental-flag).
8+
9+
Per scegliere in che cartella vuoi i tuoi file compilati, usa l'opzione di configurazione [`tsBuildInfoFile`](#tsBuildInfoFile).
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
display: "Moduli Isolati"
3+
oneline: "Si assicura che ogni file possa essere compilato in sicurezza senza basarsi sulle altre importazioni"
4+
---
5+
6+
Quando usi TypeScript per produrre codice JavaScript, è usanza comune usare altri transpilers come ad esempio [Babel](https://babeljs.io).
7+
Tuttavia, gli altri transpilers possono operare solo su un singolo file alla volta, questo significa che non possono fare cambiamenti che dipendono dalla comprensione dell'intero progetto.
8+
Questa regola si applica anche al `ts.transpileModule` API di TypeScript che è usata da alcuni strumenti di esecuzione.
9+
10+
Queste limitazioni possono causare problemi di esecuzione con alcune funzionalità di TypeScript come `const enum` e `namespace`.
11+
Impostando la flag `isolatedModules` chiedi a TypeScript di avvisarti se stai scrivendo del codice che non può essere correttamente interpretato da un processo di transpilation su un singolo file.
12+
13+
Esso non cambia la forma del tuo codice e nemmeno la forma del controllo di TypeScript e il processo di emissione.
14+
15+
Alcuni esempi di codice che non funzionano quando `isolatedModules` è abilitato.
16+
17+
#### Esportazione di idententificatori senza valore
18+
19+
In TypeScript, puoi importare un _type_ e di conseguenza esportarlo:
20+
21+
```ts twoslash
22+
// @noErrors
23+
import { tipo, funzione } from "modulo";
24+
25+
funzione();
26+
27+
export { tipo, funzione };
28+
```
29+
30+
Dato che non ci sono valori per `tipo`, l'emissione `export` non proverà ad esportarlo (questo perché ci sarebbe un errore di esecuzione in JavaScript):
31+
32+
```js
33+
export { funzione };
34+
```
35+
36+
I transpilers a singolo file non sanno se `tipo` produce un valore o meno, quindi c'è un errore nell'esportazione di un nome che si riferisce solo ad un tipo.
37+
38+
#### File Non-Moduli
39+
40+
Se `isolatedModules` è impostato, tutti file di implementazione devono essere _modules_ (ciò significa che esso ha alcune forme di `import` / `export`). Un errore appare se nessun file è un modulo:
41+
42+
```ts twoslash
43+
// @errors: 1208
44+
// @isolatedModules
45+
function fn() {}
46+
```
47+
48+
Questa regola non viene applicata ai file `.d.ts`
49+
50+
#### Riferimenti ai membri `const enum`
51+
52+
In TypeScript, quando ti riferisci ad un membro `const enum`, il riferimento viene rimpiazzato dal suo valore attuale nel JavaScript compilato. Cambiando questo TypeScript:
53+
54+
```ts twoslash
55+
declare const enum Numeri {
56+
Zero = 0,
57+
Uno = 1,
58+
}
59+
console.log(Numeri.Zero + Numeri.Uno);
60+
```
61+
62+
Con questo JavaScript:
63+
64+
```ts twoslash
65+
// @showEmit
66+
// @removeComments
67+
declare const enum Numeri {
68+
Zero = 0,
69+
Uno = 1,
70+
}
71+
console.log(Numeri.Zero + Numeri.Uno);
72+
```
73+
74+
Senza la conoscenza del valore di questi membri, gli altri transpilers non possono rimpiazzare il riferimento a `Numeri`, questo comporterebbe un errore di esecuzione se lasciato a se stesso (dal momento in cui non ci sono oggetti di tipo `Numeri` in esecuzione).
75+
A causa di questo, quando `isolatedModules` è impostato, c'è un errore nel riferire un ambiente ad un membro `const enum`.

yarn.lock

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
is-plain-object "^5.0.0"
2727
universal-user-agent "^6.0.0"
2828

29-
"@octokit/openapi-types@^3.2.0":
30-
version "3.2.0"
31-
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-3.2.0.tgz#d62d0ff7147dbf4d218616b2484ee2a5d023055d"
32-
integrity sha512-X7yW/fpzF3uTAE+LbPD3HEeeU+/49o0V4kNA/yv8jQ3BDpFayv/osTOhY1y1mLXljW2bOJcOCSGZo4jFKPJ6Vw==
29+
"@octokit/openapi-types@^3.3.0":
30+
version "3.3.0"
31+
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-3.3.0.tgz#8797af01feb524e3f4978e1c9bf7bc7c18ef9d25"
32+
integrity sha512-s3dd32gagPmKaSLNJ9aPNok7U+tl69YLESf6DgQz5Ml/iipPZtif3GLvWpNXoA6qspFm1LFUZX+C3SqWX/Y/TQ==
3333

3434
"@octokit/plugin-paginate-rest@^1.1.1":
3535
version "1.1.2"
@@ -113,11 +113,11 @@
113113
"@types/node" ">= 8"
114114

115115
"@octokit/types@^6.0.3":
116-
version "6.5.1"
117-
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.5.1.tgz#0f1a016ed2220576e94df6ae2bb6a2db8f44829a"
118-
integrity sha512-meP0U3ker/Nkzfif/q7JAK2LSOnuV+72F8mgfruwVX4iTQBgkShh5LSrdI9F7aC2hF3a/8AePfYh4SLzu1RuxA==
116+
version "6.6.0"
117+
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.6.0.tgz#165d0e7940d5f910b3373f02336c161dcdf097fe"
118+
integrity sha512-nmFoU3HCbw1AmnZU/eto2VvzV06+N7oAqXwMmAHGlNDF+KFykksh/VlAl85xc1P5T7Mw8fKYvXNaImNHCCH/rg==
119119
dependencies:
120-
"@octokit/openapi-types" "^3.2.0"
120+
"@octokit/openapi-types" "^3.3.0"
121121
"@types/node" ">= 8"
122122

123123
"@orta/markdown-translator@^0.4.2":
@@ -549,9 +549,9 @@ cross-spawn@^7.0.1:
549549
which "^2.0.1"
550550

551551
danger@^10.6.0:
552-
version "10.6.0"
553-
resolved "https://registry.yarnpkg.com/danger/-/danger-10.6.0.tgz#6fcb10753143aeb60c139065b952dbe783e8ed14"
554-
integrity sha512-cN9skuxtkgfnV4CQpF20L3Yt3VhMlBvvWAoh2QashDepI420gwcxoCRpxdCF7GP3aVJuh5LuI9ObrDvAxpnCFA==
552+
version "10.6.1"
553+
resolved "https://registry.yarnpkg.com/danger/-/danger-10.6.1.tgz#b19bd8f15f764b13a4bc3c1cb5b3a74e199f93c4"
554+
integrity sha512-uoAhEziWafPq9oCHFFr4d3gMcAmiLaybUT73c1ZEWnATGlwPthGKDOE9DE0TNpr2yMeV9GgpruOD5URivP8LBw==
555555
dependencies:
556556
"@babel/polyfill" "^7.2.5"
557557
"@octokit/rest" "^16.43.1"

0 commit comments

Comments
 (0)