-
Notifications
You must be signed in to change notification settings - Fork 103
Traduction de typescript.md
#76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Bruno Lesieur <[email protected]>
src/v2/guide/typescript.md
Outdated
|
||
<p class="tip">**Cette page est en cours de traduction française. Revenez une autre fois pour lire une traduction achevée ou [participez à la traduction française ici](https://github.com/vuejs-fr/vuejs.org).**</p><p>In Vue 2.2 we introduced dist files exposed as ES modules, which will be used by default by webpack 2. Unfortunately, this introduced an unintentional breaking change because with TypeScript + webpack 2, `import Vue = require('vue')` will now return a synthetic ES module object instead of Vue itself.</p> | ||
Dans Vue 2.2 nous avons introduit des fichiers de distribution en tant que modules ES, qui sont utilisés par défaut par webpack 2. Malheureusement, cela a introduit un changement de non retrocompatiblilité non souhaité car avec TypeScript + webpack 2, `import Vue = require('vue')` retourne maintenant un objet module ES synthétique au lieu de Vue lui-même. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qui seront utilisés
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1ère relecture
src/v2/guide/typescript.md
Outdated
|
||
We plan to move all official declarations to use ES-style exports in the future. Please see [Recommended Configuration](#Recommended-Configuration) below on a future-proof setup. | ||
Nous avons prévu de bouger toutes les déclarations officielles d'export dans le style ES dans le futur. S'il vous plait regardez [la configuration recommandée](#Configuration-recommandee) ci-dessous pour une mise en place future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dans le futur => à l'avenir
Veuillez consulter la configuration recommandée ci-dessous qui est parée pour les évolutions futures.
(pas très littéral comme traduction mais je trouve ça beaucoup plus clair que "setup évolutif")
src/v2/guide/typescript.md
Outdated
|
||
A static type system can help prevent many potential runtime errors, especially as applications grow. That's why Vue ships with [official type declarations](https://github.com/vuejs/vue/tree/dev/types) for [TypeScript](https://www.typescriptlang.org/) - not only in Vue core, but also for [vue-router](https://github.com/vuejs/vue-router/tree/dev/types) and [vuex](https://github.com/vuejs/vuex/tree/dev/types) as well. | ||
Un système de typage statique peut aider à prévenir des erreurs d'exécutions potentielles, et tout spécialement pour les applications qui grandissent. C'est pourquoi Vue est fourni avec des déclarations de types officielles]((https://github.com/vuejs/vue/tree/dev/types) pour [TypeScript](https://www.typescriptlang.org/), et pas seulement pour le cœur de Vue, mais aussi pour [vue-router](https://github.com/vuejs/vue-router/tree/dev/types) et [vuex](https://github.com/vuejs/vuex/tree/dev/types). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
particulièrement quand les applications grandissent.
src/v2/guide/typescript.md
Outdated
|
||
Since these are [published on NPM](https://unpkg.com/vue/types/), and the latest TypeScript knows how to resolve type declarations in NPM packages, this means when installed via NPM, you don't need any additional tooling to use TypeScript with Vue. | ||
Puisque ceux-ci sont [publiés sur npm](https://unpkg.com/vue/types/), et que la dernière version de TypeScript sait comment résoudre des déclarations de type dans des packages npm, cela signifie qu'installer ceux-ci via npm ne requiert aucun outil supplémentaire pour les utiliser avec TypeScript dans Vue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pourquoi avoir mis partout npm en minuscules ? Les acronymes sont toujours en majuscules
pour utiliser TypeScript avec Vue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm s'écrit npm comme webpack. Je sais que c'est à l'origine un acronyme, mais NPM est aussi faux que Webpack ou Jquery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je vais PR l'original dans ce sens, comme je l'ai déjà fait avec les itérations de webpack.
src/v2/guide/typescript.md
Outdated
@@ -33,39 +33,39 @@ Since these are [published on NPM](https://unpkg.com/vue/types/), and the latest | |||
} | |||
``` | |||
|
|||
Note the `allowSyntheticDefaultImports` option allows us to use the following: | |||
Notez que l'option `allowSyntheticDefaultImports` nous permet d'utiliser l'import comme cela : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comme ceci
src/v2/guide/typescript.md
Outdated
|
||
``` js | ||
import Vue = require('vue') | ||
``` | ||
|
||
The former (ES module syntax) is recommended because it is consistent with recommended plain ES usage, and in the future we are planning to move all official declarations to use ES-style exports. | ||
La forme ES est la syntaxe recommandée pour l'appel de modules car elle est consistante avec l'utilisation ES. Nous planifions dans le futur de transformer toutes les déclarations avec l'export de style ES. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La premiere (syntaxe de module ES) est recommandée car elle est cohérente avec les recommandations d'usage ES.
dans le futur => à l'avenir
de changer toutes les déclarations officielles pour utiliser les exports dans le style ES.
src/v2/guide/typescript.md
Outdated
"module": "es2015", | ||
"moduleResolution": "node" | ||
} | ||
} | ||
``` | ||
|
||
This tells TypeScript to leave the ES module import statements intact, which in turn allows webpack 2 to take advantage of ES-module-based tree-shaking. | ||
Ceci dit à TypeScript de laisser les instructions d'import de modules ES intacte, ce qui permet à webpack 2 de tirer parti du *tree-shaking* basé sur les modules ES. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ceci demande à
intactes
src/v2/guide/typescript.md
Outdated
|
||
Vue's type definition exports many useful [type declarations](https://github.com/vuejs/vue/blob/dev/types/index.d.ts). For example, to annotate an exported component options object (e.g. in a `.vue` file): | ||
La définition de type de Vue exporte beaucoup de [déclarations de type](https://github.com/vuejs/vue/blob/dev/types/index.d.ts). Par exemple, pour annoter un objet d'options de composant exporté (par ex. dans un fichier `.vue`) on peut faire cela : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exporte de nombreuses déclarations de type utiles
l'objet d'options d'un composant exporté
on peut faire cela => inutile, les deux points se suffisent à eux-même comme dans le texte original
src/v2/guide/typescript.md
Outdated
window.alert(this.message) | ||
} | ||
} | ||
// We need to explicitly annotate the exported options object | ||
// with the MyComponent type | ||
// Nous devons explicitement annoter les objet d'options exportées |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l'objet d'options exporté
|
||
- __TypeScript can't infer all types from Vue's API.__ For example, it doesn't know that the `message` property returned in our `data` function will be added to the `MyComponent` instance. That means if we assigned a number or boolean value to `message`, linters and compilers wouldn't be able to raise an error, complaining that it should be a string. | ||
- __TypeScript ne peut pas déduire tous les types de l'API de Vue__ Par exemple, il ne sait pas que la propriété `message` renvoyée dans notre fonction `data` sera ajoutée à l'instance `MyComponent`. Cela signifie que si nous attribuons un nombre ou une valeur booléenne à `message`, les linters et les compilateurs ne seraient pas en mesure d'émettre une erreur, en pointant le fait qu'il s'agit normalement d'une chaîne de caractères. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
il y a le verbe inférer en français aussi, mais je ne connais personne qui l'utilise ^^ ça me va pour "déduire"
Bravo pour toutes les traductions ces derniers jours @haeresis |
Signed-off-by: Bruno Lesieur <[email protected]>
Merci beaucoup. Ça me fait plaisir. C'est grâce à vos relectures. Merci à toi de toujours répondre présent ! Ça devient bon ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deux petites erreurs et pis c'est tout 😄
src/v2/guide/typescript.md
Outdated
onClick (): void { | ||
window.alert(this.message) | ||
} | ||
} | ||
``` | ||
|
||
With this syntax alternative, our component definition is not only shorter, but TypeScript can also infer the types of `message` and `onClick` without explicit interface declarations. This strategy even allows you to handle types for computed properties, lifecycle hooks, and render functions. For full usage details, see [the vue-class-component docs](https://github.com/vuejs/vue-class-component#vue-class-component). | ||
Avec cette syntaxe alternative, nos définitions de composant ne sont pas seulement plus courte, mais TypeScript peut aussi connaître les types de `message` et `onClick` avec des interfaces de déclarations explicites. Cette stratégie peut même vous permettre de gérer des types pour les propriétés calculées, les hooks de cycle de vie et les fonctions de rendu. Pour une utilisation détaillée de son utilisation, référez-vous à [la documentation de vue-class-component](https://github.com/vuejs/vue-class-component#vue-class-component). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plus courtes
il manque un "s"
Pour une utilisation plus détaillée de son utilisation,
Signed-off-by: Bruno Lesieur <[email protected]>
Merci @forresst ! C'est dans la boite. |
Et le dernier. J'ai un peu galéré car je me sens pas à l'aise avec les termes TypeScript. Votre aide est la bienvenue :)