-
Notifications
You must be signed in to change notification settings - Fork 130
Translate to FR: TypeScript for new programmers #148
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
Translate to FR: TypeScript for new programmers #148
Conversation
Thanks for the PR! This section of the codebase is owned by @ManuSquall and @Ascor8522 - if they write a comment saying "LGTM" then it will be merged. |
Translation of TS for the New Programmer.mdtitle: TypeScript for new programmers oneline: Learn TypeScript from scratchCongratulations, you chose TypeScript as your first language — already a good decision! You may have already heard that TypeScript is a "variant" of JavaScript. A Brief History of JavaScriptJavaScript (also known as ECMAScript) was originally a simple scripting language for browsers. Web browser developers responded to this growth in frequency of use by optimizing runtime environments (dynamic compilation) and expanding the scope of what was possible with JS (by adding APIs). This contributed to an even more widespread use among web developers. In addition, JS has become popular enough to be used outside of browsers, as Node.js has marked the implementation of JS in a server-side environment. To summarize, this language was originally created to meet simple needs, and then evolved to support the execution of millions of rows.
Most languages would throw an error in these situations. Some do it at compilation — before anything is executed. TypeScript: a static type checkerWe were saying that some languages would prohibit the execution of erroneous code. TypeScript checks for errors in a program before execution, and does this based on the value types, it is a static verifier. // @errors: 2551
const obj = { width: 10, height: 15 };
const area = obj.width * obj.heigth; A typical JavaScript overlayWhat does JavaScript have to do with TypeScript? SyntaxTypeScript is a Wrapper JavaScript: a legal JS syntax is therefore a legal TS syntax. // @errors: 1005
let a = (4 TypeScript does not necessarily consider JavaScript code to be invalid. TypesHowever, TypeScript is an overlay Typed. This means that TS adds rules governing how different types of values can be used. Another example is this JavaScript code that you can launch in your browser. He goes display a value: console.log(4 / []); This program - whose syntax is correct - displays // @errors: 2363
console.log(4 / []); You may want to Oh, really divide a number by an array, maybe just to see the result, but most of the time you've made a mistake. When migrating JavaScript code to a TypeScript file, you may see type errors depending on the way it was written. Runtime behaviorTypeScript is also a language that preserves the runtime behavior of JavaScript. This means that if you move code from JavaScript to TypeScript, it is guaranteed to run in the same way, even if TS thinks it has type-related errors. Maintaining runtime behavior is one of the fundamental principles of TypeScript because it means that you can easily switch between the two languages without worrying about subtle differences that would prevent your program from launching. Deleting typesRoughly speaking, once the TypeScript compiler finishes checking the code, it Clears the types to leave the resulting code. It also means that TypeScript, based on the types present in the code, never alters the behavior of the program. To summarize, even though you may have type errors during compilation, the type system does not affect how your program runs. Finally, TypeScript does not provide any additional libraries. Interestingly, it is possible to specify which version of JavaScript TypeScript should target when compiling. This affects the final code, which may or may not contain polyfills (code that redefines existing features in one version of JavaScript but absent in another). Learn JavaScript and TypeScriptAn often asked question is "Do I have to learn TypeScript or JavaScript", to which it is answered that it is not possible to learn TS without learning JS. TypeScript has the same syntax, and behaves the same way as JavaScript, so you'll be able to use everything you learn with JavaScript, in TypeScript. There are many, A lot resources available to learn JavaScript. These resources should not be ignored if you want to learn TypeScript. For example, there are about 20 times more StackOverflow questions tagged If you're looking for something like "how to sort an array into TypeScript," remember: TypeScript is JavaScript with a compile type checker. The way you sort an array in JavaScript is the same as in TypeScript. TimelineIt was a brief summary of the syntaxes and tools used in the everyday TypeScript. From there, you can:
|
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.
Thank you for the PR and the translation 🥳🥳🥳 j
Just highlited some typos to fix
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.
Looks good
LGTM |
Merging because @ManuSquall is a code-owner of all the changes - thanks! |
No description provided.