From 6bb859fed581855951b3ae744c08d1c5fb497d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Quang=20H=E1=BB=AFu?= Date: Thu, 16 Sep 2021 02:45:07 +0700 Subject: [PATCH 1/2] static-type-checking.md translate --- content/docs/static-type-checking.md | 185 ++++++++++++++------------- 1 file changed, 96 insertions(+), 89 deletions(-) diff --git a/content/docs/static-type-checking.md b/content/docs/static-type-checking.md index 24af2d2a5..0f7f531ac 100644 --- a/content/docs/static-type-checking.md +++ b/content/docs/static-type-checking.md @@ -4,39 +4,39 @@ title: Static Type Checking permalink: docs/static-type-checking.html --- -Static type checkers like [Flow](https://flow.org/) and [TypeScript](https://www.typescriptlang.org/) identify certain types of problems before you even run your code. They can also improve developer workflow by adding features like auto-completion. For this reason, we recommend using Flow or TypeScript instead of `PropTypes` for larger code bases. +Trình kiểm tra kiểu tĩnh(static) như [Flow](https://flow.org/) và [TypeScript](https://www.typescriptlang.org/) xác định một số loại vấn đề nhất định trước khi bạn chạy code của mình. Chúng cũng có thể cải thiện quy trình làm việc của nhà phát triển bằng cách thêm các tính năng như tự động hoàn thành(auto-completion). Do vậy, chúng tôi khuyên bạn nên sử dụng Flow hoặc TypeScript thay vì `PropTypes` khi bạn code một dự án lớn. ## Flow {#flow} -[Flow](https://flow.org/) is a static type checker for your JavaScript code. It is developed at Facebook and is often used with React. It lets you annotate the variables, functions, and React components with a special type syntax, and catch mistakes early. You can read an [introduction to Flow](https://flow.org/en/docs/getting-started/) to learn its basics. +[Flow](https://flow.org/) là một trình kiểm tra kiểu tĩnh cho mã JavaScript của bạn. Nó được phát triển tại Facebook và thường được sử dụng với React. It lets you annotate the variables, functions, and React components with a special type syntax, and catch mistakes early. Bạn có thể đọc [introduction to Flow](https://flow.org/en/docs/getting-started/) để tìm hiểu những điều cơ bản. -To use Flow, you need to: +Để dùng Flow, bạn cần chuẩn bị: -* Add Flow to your project as a dependency. -* Ensure that Flow syntax is stripped from the compiled code. -* Add type annotations and run Flow to check them. +* Thêm Flow vào project của bạn với vai trò như yếu tố dependency. +* Đảm bảo rằng cú pháp Flow được loại bỏ khỏi mã đã biên dịch. +* Thêm chú thích loại và chạy Flow để kiểm tra chúng. -We will explain these steps below in detail. +Chúng tôi sẽ giải thích chi tiết các bước này bên dưới. -### Adding Flow to a Project {#adding-flow-to-a-project} +### Thêm Flow vào Project {#adding-flow-to-a-project} -First, navigate to your project directory in the terminal. You will need to run the following command: +Đầu tiên, điều hướng project của bạn trong Terminal. Sau đó, bạn sẽ chạy các lệnh sau: -If you use [Yarn](https://yarnpkg.com/), run: +Nếu bạn dùng [Yarn](https://yarnpkg.com/): ```bash yarn add --dev flow-bin ``` -If you use [npm](https://www.npmjs.com/), run: +Nếu bạn dùng [npm](https://www.npmjs.com/): ```bash npm install --save-dev flow-bin ``` -This command installs the latest version of Flow into your project. +Lệnh này cài đặt phiên bản Flow mới nhất vào project của bạn. -Now, add `flow` to the `"scripts"` section of your `package.json` to be able to use this from the terminal: +Bây giờ, thêm `flow` vào phần `"scripts"` trong `package.json` của bạn để có thể sử dụng nó trong Terminal: ```js{4} { @@ -49,53 +49,54 @@ Now, add `flow` to the `"scripts"` section of your `package.json` to be able to } ``` -Finally, run one of the following commands: +Cuối cùng, chạy một trong các lệnh sau: -If you use [Yarn](https://yarnpkg.com/), run: +Nếu bạn dùng [Yarn](https://yarnpkg.com/): ```bash yarn run flow init ``` -If you use [npm](https://www.npmjs.com/), run: +Nếu bạn dùng [npm](https://www.npmjs.com/): ```bash npm run flow init ``` -This command will create a Flow configuration file that you will need to commit. +Lệnh này sẽ tạo một tệp cấu hình Flow mà bạn sẽ cần phải commit. -### Stripping Flow Syntax from the Compiled Code {#stripping-flow-syntax-from-the-compiled-code} +### Tách Flow Syntax ra khỏi Compiled Code {#stripping-flow-syntax-from-the-compiled-code} -Flow extends the JavaScript language with a special syntax for type annotations. However, browsers aren't aware of this syntax, so we need to make sure it doesn't end up in the compiled JavaScript bundle that is sent to the browser. +Flow mở rộng ngôn ngữ JavaScript với một cú pháp đặc biệt cho các kiểu chú thích(annotations). Tuy nhiên, các trình duyệt không biết cú pháp này, +vì vậy chúng tôi cần đảm bảo rằng nó không nằm trong gói JavaScript đã biên dịch được gửi đến trình duyệt. -The exact way to do this depends on the tools you use to compile JavaScript. +Cách chính xác để làm điều này phụ thuộc vào các công cụ bạn sử dụng để biên dịch JavaScript. -#### Create React App {#create-react-app} +#### Tạo React App {#create-react-app} -If your project was set up using [Create React App](https://github.com/facebookincubator/create-react-app), congratulations! The Flow annotations are already being stripped by default so you don't need to do anything else in this step. +Nếu project của bạn được tạo bằng cách [Create React App](https://github.com/facebookincubator/create-react-app), chúc mừng! Chú thích(annotations ) của Flow đã bị loại bỏ theo mặc định, vì vậy bạn không cần phải làm bất kỳ điều gì khác trong bước này. #### Babel {#babel} ->Note: +>Lưu ý: > ->These instructions are *not* for Create React App users. Even though Create React App uses Babel under the hood, it is already configured to understand Flow. Only follow this step if you *don't* use Create React App. +>Những hướng dẫn này *không* dành cho những người dùng Create React App. Mặc dù Create React App sử dụng Babel, nó đã được cấu hình để hiểu Flow. Chỉ làm theo bước này nếu bạn không sử dụng Create React App. -If you manually configured Babel for your project, you will need to install a special preset for Flow. +Nếu bạn định cấu hình Babel theo cách thủ công cho project mình, you will need to install a special preset for Flow. -If you use Yarn, run: +Nếu bạn dùng Yarn: ```bash yarn add --dev @babel/preset-flow ``` -If you use npm, run: +Nếu bạn dùng npm: ```bash npm install --save-dev @babel/preset-flow ``` -Then add the `flow` preset to your [Babel configuration](https://babeljs.io/docs/usage/babelrc/). For example, if you configure Babel through `.babelrc` file, it could look like this: +Sau đó thêm `flow` preset cho [Babel configuration](https://babeljs.io/docs/usage/babelrc/) của bạn. Ví dụ: nếu bạn định cấu hình Babel thông qua file `.babelrc`, nó có thể sẽ giống thế này: ```js{3} { @@ -106,50 +107,50 @@ Then add the `flow` preset to your [Babel configuration](https://babeljs.io/docs } ``` -This will let you use the Flow syntax in your code. +Điều này sẽ cho phép bạn sử dụng Flow Syntax trong code của mình. ->Note: +>Lưu ý: > ->Flow does not require the `react` preset, but they are often used together. Flow itself understands JSX syntax out of the box. +>Flow không yêu cầu `react` preset, nhưng chúng thường được sử dụng cùng nhau. Bản thân Flow hiểu cú pháp JSX. #### Other Build Setups {#other-build-setups} -If you don't use either Create React App or Babel, you can use [flow-remove-types](https://github.com/flowtype/flow-remove-types) to strip the type annotations. +Nếu bạn không sử dụng Create React App hoặc Babel, bạn có thể sử dụng [flow-remove-types](https://github.com/flowtype/flow-remove-types) để loại bỏ các loại chú thích(the type annotations). -### Running Flow {#running-flow} +### Chạy Flow {#running-flow} -If you followed the instructions above, you should be able to run Flow for the first time. +Nếu bạn đã làm theo các hướng dẫn ở trên, bạn sẽ chạy được Flow. ```bash yarn flow ``` -If you use npm, run: +Nếu bạn dùng npm: ```bash npm run flow ``` -You should see a message like: +Bạn sẽ thấy một thông báo như sau: ``` No errors! ✨ Done in 0.17s. ``` -### Adding Flow Type Annotations {#adding-flow-type-annotations} +### Thêm các loại chú thích Flow(Flow Type Annotations){#adding-flow-type-annotations} -By default, Flow only checks the files that include this annotation: +Theo mặc định, Flow chỉ kiểm tra các tệp bao gồm chú thích(annotation) này: ```js // @flow ``` -Typically it is placed at the top of a file. Try adding it to some files in your project and run `yarn flow` or `npm run flow` to see if Flow already found any issues. +Thông thường, nó được đặt ở đầu tệp. Hãy thử thêm nó vào một số tệp trong project của bạn và chạy `yarn flow` hoặc `npm run flow` để xem Flow đã tìm thấy bất kỳ vấn đề nào chưa. -There is also [an option](https://flow.org/en/docs/config/options/#toc-all-boolean) to force Flow to check *all* files regardless of the annotation. This can be too noisy for existing projects, but is reasonable for a new project if you want to fully type it with Flow. +Ngoài ra còn có [một tùy chọn](https://flow.org/en/docs/config/options/#toc-all-boolean) để buộc Flow kiểm tra *tất cả* các file bất kể chú thích(annotation) là gì. Điều này có thể sẽ hơi bất tiện đối với các project đang làm dở, nhưng hợp lý đối với các project mới nếu bạn muốn nhập đầy đủ nó bằng Flow. -Now you're all set! We recommend to check out the following resources to learn more about Flow: +Giờ tất cả mọi thứ đã sẵn sàng! Chúng tôi khuyên bạn nên đọc thêm các tài liệu để hiểu thêm về Flow: * [Flow Documentation: Type Annotations](https://flow.org/en/docs/types/) * [Flow Documentation: Editors](https://flow.org/en/docs/editors/) @@ -158,49 +159,49 @@ Now you're all set! We recommend to check out the following resources to learn m ## TypeScript {#typescript} -[TypeScript](https://www.typescriptlang.org/) is a programming language developed by Microsoft. It is a typed superset of JavaScript, and includes its own compiler. Being a typed language, TypeScript can catch errors and bugs at build time, long before your app goes live. You can learn more about using TypeScript with React [here](https://github.com/Microsoft/TypeScript-React-Starter#typescript-react-starter). +[TypeScript](https://www.typescriptlang.org/) là một ngôn ngữ lập trình được phát triển bởi Microsoft. Nó là một tập hợp siêu cú pháp nghiêm ngặt của JavaScript và thêm tính năng kiểu tĩnh tùy chọn vào ngôn ngữ. Là một ngôn ngữ được đánh máy, TypeScript có thể bắt lỗi và lỗi tại thời điểm xây dựng, rất lâu trước khi ứng dụng của bạn hoạt động. Bạn có thể tìm hiểu thêm về cách sử dụng TypeScript với React tại [đây](https://github.com/Microsoft/TypeScript-React-Starter#typescript-react-starter). -To use TypeScript, you need to: -* Add TypeScript as a dependency to your project -* Configure the TypeScript compiler options -* Use the right file extensions -* Add definitions for libraries you use +Để dùng TypeScript, bạn cần chuẩn bị: +* Thêm TypeScript vào project của bạn với vai trò như yếu tố dependency. +* Cấu hình lại cấu hình TypeScript. +* Sử dụng thêm các extension phù hợp. +* Định nghĩa các thư viện mà bạn đang dùng. -Let's go over these in detail. +Giờ chúng ta sẽ đi vào chi tiết. -### Using TypeScript with Create React App {#using-typescript-with-create-react-app} +### Sử dụng TypeScript với Create React App {#using-typescript-with-create-react-app} -Create React App supports TypeScript out of the box. +Create React App sẽ hỗ trợ TypeScript. -To create a **new project** with TypeScript support, run: +Để tạo một **project mới** với sự hỗ trợ của TypeScript, ta dùng lệnh: ```bash npx create-react-app my-app --template typescript ``` -You can also add it to an **existing Create React App project**, [as documented here](https://facebook.github.io/create-react-app/docs/adding-typescript). +Bạn cũng có thể thêm nó vào một **Create React App project sẵn có**, [như trong tài liệu này](https://facebook.github.io/create-react-app/docs/adding-typescript). ->Note: +>Lưu ý: > ->If you use Create React App, you can **skip the rest of this page**. It describes the manual setup which doesn't apply to Create React App users. +>Nếu bạn sử dụng Create React App, bạn có thể **bỏ qua phần còn lại của trang này**. Nó mô tả cách thiết lập thủ công không áp dụng cho Create React App. -### Adding TypeScript to a Project {#adding-typescript-to-a-project} -It all begins with running one command in your terminal. +### Thêm TypeScript vào một Project {#adding-typescript-to-a-project} +Tất cả bắt đầu bằng việc chạy một lệnh trong terminal. -If you use [Yarn](https://yarnpkg.com/), run: +Nếu bạn dùng [Yarn](https://yarnpkg.com/): ```bash yarn add --dev typescript ``` -If you use [npm](https://www.npmjs.com/), run: +Nếu bạn dùng [npm](https://www.npmjs.com/): ```bash npm install --save-dev typescript ``` -Congrats! You've installed the latest version of TypeScript into your project. Installing TypeScript gives us access to the `tsc` command. Before configuration, let's add `tsc` to the "scripts" section in our `package.json`: +Chúc mừng! Bạn đã cài được phiên bản TypeScript mới nhất vào project của mình. Khi cài xong TypeScript chúng ta sẽ dùng được lệnh `tsc`. Trước khi cài đặt cấu hình, hãy thêm `tsc` vào phần "scripts" trong `package.json`: ```js{4} { @@ -213,27 +214,27 @@ Congrats! You've installed the latest version of TypeScript into your project. I } ``` -### Configuring the TypeScript Compiler {#configuring-the-typescript-compiler} -The compiler is of no help to us until we tell it what to do. In TypeScript, these rules are defined in a special file called `tsconfig.json`. To generate this file: +### Cấu hình TypeScript {#configuring-the-typescript-compiler} +Trình biên dịch không giúp ích gì cho chúng ta cho đến khi chúng ta yêu cầu nó phải làm gì. Trong TypeScript, các quy tắc này được định nghĩa trong một tệp đặc biệt có tên là `tsconfig.json`. Để tạo tệp này, ta dùng một trong các lệnh sau: -If you use [Yarn](https://yarnpkg.com/), run: +Nếu bạn dùng [Yarn](https://yarnpkg.com/): ```bash yarn run tsc --init ``` -If you use [npm](https://www.npmjs.com/), run: +Nếu bạn dùng [npm](https://www.npmjs.com/): ```bash npx tsc --init ``` -Looking at the now generated `tsconfig.json`, you can see that there are many options you can use to configure the compiler. For a detailed description of all the options, check [here](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html). +Nhìn vào `tsconfig.json` đã được tạo xong, bạn có thể thấy rằng có nhiều tùy chọn bạn có thể sử dụng để cấu hình trình biên dịch. Để biết mô tả chi tiết về tất cả các tùy chọn, hãy kiểm tra tại [đây](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html). -Of the many options, we'll look at `rootDir` and `outDir`. In its true fashion, the compiler will take in typescript files and generate javascript files. However we don't want to get confused with our source files and the generated output. +Trong số nhiều tùy chọn, chúng ta sẽ xem xét `rootDir` và `outDir`. Theo đúng nghĩa của nó, trình biên dịch sẽ nhận các tệp typescript và tạo ra các tệp javascript. Tuy nhiên, chúng tôi không muốn nhầm lẫn với các tệp nguồn(source file) và đầu ra được tạo. -We'll address this in two steps: -* Firstly, let's arrange our project structure like this. We'll place all our source code in the `src` directory. +Vấn đề này sẽ được giải quyết trong hai bước: +* Đầu tiên, hãy sắp xếp cấu trúc dự án(project structure) của chúng ta như thế này. Chúng tôi sẽ đặt tất cả source code của chúng tôi trong thư mục `src`. ``` ├── package.json @@ -242,7 +243,7 @@ We'll address this in two steps: └── tsconfig.json ``` -* Next, we'll tell the compiler where our source code is and where the output should go. +* Tiếp theo, chúng ta sẽ cho trình biên dịch biết source code của chúng ta ở đâu và đầu ra sẽ đi đâu. ```js{6,7} // tsconfig.json @@ -257,18 +258,18 @@ We'll address this in two steps: } ``` -Great! Now when we run our build script the compiler will output the generated javascript to the `build` folder. The [TypeScript React Starter](https://github.com/Microsoft/TypeScript-React-Starter/blob/main/tsconfig.json) provides a `tsconfig.json` with a good set of rules to get you started. +Tuyệt vời! Bây giờ khi chúng ta chạy tập lệnh xây dựng của mình, trình biên dịch sẽ xuất javascript đã tạo vào thư mục `build` folder. [TypeScript React Starter](https://github.com/Microsoft/TypeScript-React-Starter/blob/main/tsconfig.json) cung cấp `tsconfig.json` với một bộ quy tắc tốt để giúp bạn bắt đầu. -Generally, you don't want to keep the generated javascript in your source control, so be sure to add the build folder to your `.gitignore`. +Để javascript đã tạo không nằm trong bộ điều khiển(source control), hãy thêm `.gitignore` để khắc phục điều này. -### File extensions {#file-extensions} -In React, you most likely write your components in a `.js` file. In TypeScript we have 2 file extensions: +### Các file extension {#file-extensions} +Trong React, bạn có thể viết các component trong file `.js`. Trong TypeScript, chúng ta có 2 file extension: -`.ts` is the default file extension while `.tsx` is a special extension used for files which contain `JSX`. +`.ts` là file extension mặc định trong khi `.tsx` phần mở rộng đặc biệt được sử dụng cho các file có chứa `JSX`. -### Running TypeScript {#running-typescript} +### Chạy TypeScript {#running-typescript} -If you followed the instructions above, you should be able to run TypeScript for the first time. +Nếu bạn làm theo các hướng dẫn ở trên, bạn sẽ thấy TypeScript chạy thành công. ```bash yarn build @@ -280,17 +281,19 @@ If you use npm, run: npm run build ``` -If you see no output, it means that it completed successfully. +Nếu bạn không thấy output, có nghĩa là nó đã thành công. ### Type Definitions {#type-definitions} -To be able to show errors and hints from other packages, the compiler relies on declaration files. A declaration file provides all the type information about a library. This enables us to use javascript libraries like those on npm in our project. +Để có thể hiển thị lỗi và gợi ý từ các package khác, trình biên dịch dựa vào các tệp khai báo. Tệp khai báo cung cấp tất cả các loại thông tin về một thư viện. Điều này cho phép chúng ta sử dụng các thư viện javascript như các thư viện trên npm trong project của chúng ta. -There are two main ways to get declarations for a library: +Có hai cách chính để lấy các khai báo cho một thư viện: -__Bundled__ - The library bundles its own declaration file. This is great for us, since all we need to do is install the library, and we can use it right away. To check if a library has bundled types, look for an `index.d.ts` file in the project. Some libraries will have it specified in their `package.json` under the `typings` or `types` field. +__Bundled__ - Thư viện đóng gói tệp khai báo của riêng nó. Điều này rất tốt cho chúng ta, vì tất cả những gì chúng ta cần làm là cài đặt thư viện và chúng ta có thể sử dụng nó ngay lập tức. Để kiểm tra xem một thư viện có các bundled type chưa, hãy tìm file `index.d.ts` trong project. Một số thư viện sẽ có nó sẵn ở trong file `package.json` dưới `typings` hoặc trường `types`. -__[DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped)__ - DefinitelyTyped is a huge repository of declarations for libraries that don't bundle a declaration file. The declarations are crowd-sourced and managed by Microsoft and open source contributors. React for example doesn't bundle its own declaration file. Instead we can get it from DefinitelyTyped. To do so enter this command in your terminal. +__[DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped)__ - DefinitelyTyped là một kho lưu trữ khổng lồ các khai báo dành cho các thư viện không đóng gói tệp khai báo. Các khai báo có nguồn gốc từ cộng đồng +và được quản lý bởi Microsoft và những người đóng góp nguồn mở. Ví dụ: React không gói tệp khai báo của riêng nó. +Thay vào đó, chúng ta có thể lấy nó từ DefinitelyTyped. Để làm như vậy, hãy nhập lệnh này vào terminal của bạn. ```bash # yarn @@ -300,8 +303,10 @@ yarn add --dev @types/react npm i --save-dev @types/react ``` -__Local Declarations__ -Sometimes the package that you want to use doesn't bundle declarations nor is it available on DefinitelyTyped. In that case, we can have a local declaration file. To do this, create a `declarations.d.ts` file in the root of your source directory. A simple declaration could look like this: +__Khai báo cục bộ__ +Đôi khi package mà bạn muốn sử dụng không gói các khai báo cũng như không có sẵn trên DefinitelyTyped. Trong trường hợp đó, +chúng ta có thể có một tệp khai báo cục bộ. Để thực hiện việc này, hãy tạo tệp `declarations.d.ts` trong thư mục gốc(root) của thư +mục nguồn(source directory) của bạn. Một khai báo đơn giản có thể trông như thế này: ```typescript declare module 'querystring' { @@ -310,7 +315,7 @@ declare module 'querystring' { } ``` -You are now ready to code! We recommend to check out the following resources to learn more about TypeScript: +Giờ bạn hoàn toàn có thể bắt đầu code được rồi! Chúng tôi khuyên hãy đọc thêm các tài liệu sau để hiểu TypeScript hơn: * [TypeScript Documentation: Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html) * [TypeScript Documentation: Migrating from JavaScript](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html) @@ -318,16 +323,18 @@ You are now ready to code! We recommend to check out the following resources to ## ReScript {#rescript} -[ReScript](https://rescript-lang.org/) is a typed language that compiles to JavaScript. Some of its core features are guaranteed 100% type coverage, first-class JSX support and [dedicated React bindings](https://rescript-lang.org/docs/react/latest/introduction) to allow integration in existing JS / TS React codebases. +[ReScript](https://rescript-lang.org/) là một ngôn ngữ được đánh máy biên dịch sang JavaScript. Một số tính năng cốt lõi của nó được đảm bảo phạm vi phủ sóng 100%, +hỗ trợ JSX tốt nhất và [các ràng buộc React chuyên dụng](https://rescript-lang.org/docs/react/latest/introduction) để cho phép tích hợp trong các cơ sở mã JS / TS React hiện có. + -You can find more infos on integrating ReScript in your existing JS / React codebase [here](https://rescript-lang.org/docs/manual/latest/installation#integrate-into-an-existing-js-project). +Bạn có thể tìm thêm thông tin về cách tích hợp ReScript trong cơ sở mã JS / React hiện có của mình tại [đây](https://rescript-lang.org/docs/manual/latest/installation#integrate-into-an-existing-js-project). ## Kotlin {#kotlin} -[Kotlin](https://kotlinlang.org/) is a statically typed language developed by JetBrains. Its target platforms include the JVM, Android, LLVM, and [JavaScript](https://kotlinlang.org/docs/reference/js-overview.html). +[Kotlin](https://kotlinlang.org/) là một ngôn ngữ gõ tĩnh được phát triển bởi JetBrains. Các nền tảng mục tiêu của nó bao gồm JVM, Android, LLVM và [JavaScript](https://kotlinlang.org/docs/reference/js-overview.html). -JetBrains develops and maintains several tools specifically for the React community: [React bindings](https://github.com/JetBrains/kotlin-wrappers) as well as [Create React Kotlin App](https://github.com/JetBrains/create-react-kotlin-app). The latter helps you start building React apps with Kotlin with no build configuration. +JetBrains phát triển và duy trì một số công cụ dành riêng cho cộng đồng React: [React bindings](https://github.com/JetBrains/kotlin-wrappers) cũng như [Create React Kotlin App](https://github.com/JetBrains/create-react-kotlin-app). Phần sau giúp bạn bắt đầu xây dựng ứng dụng React với Kotlin mà không cần cấu hình xây dựng. -## Other Languages {#other-languages} +## Các ngôn ngữ khác {#other-languages} -Note there are other statically typed languages that compile to JavaScript and are thus React compatible. For example, [F#/Fable](https://fable.io/) with [elmish-react](https://elmish.github.io/react). Check out their respective sites for more information, and feel free to add more statically typed languages that work with React to this page! +Lưu ý rằng có những ngôn ngữ được nhập tĩnh khác sẽ biên dịch sang JavaScript và do đó tương thích với React. Ví dụ, [F#/Fable](https://fable.io/) với [elmish-react](https://elmish.github.io/react). Kiểm tra các trang web tương ứng của họ để biết thêm thông tin và có thể tự do thêm các ngôn ngữ được nhập tĩnh khác hoạt động với React vào trang này! From 248c2fc9e11f40a7df369ccb7e36747d0a3fb659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Quang=20H=E1=BB=AFu?= Date: Thu, 16 Sep 2021 13:14:56 +0700 Subject: [PATCH 2/2] static-type-checking.md translate --- content/docs/static-type-checking.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/static-type-checking.md b/content/docs/static-type-checking.md index 0f7f531ac..08e23b51d 100644 --- a/content/docs/static-type-checking.md +++ b/content/docs/static-type-checking.md @@ -146,7 +146,7 @@ Theo mặc định, Flow chỉ kiểm tra các tệp bao gồm chú thích(annot // @flow ``` -Thông thường, nó được đặt ở đầu tệp. Hãy thử thêm nó vào một số tệp trong project của bạn và chạy `yarn flow` hoặc `npm run flow` để xem Flow đã tìm thấy bất kỳ vấn đề nào chưa. +Thông thường, nó được đặt ở đầu file. Hãy thử thêm nó vào một số tệp trong project của bạn và chạy `yarn flow` hoặc `npm run flow` để xem Flow đã tìm thấy bất kỳ vấn đề nào chưa. Ngoài ra còn có [một tùy chọn](https://flow.org/en/docs/config/options/#toc-all-boolean) để buộc Flow kiểm tra *tất cả* các file bất kể chú thích(annotation) là gì. Điều này có thể sẽ hơi bất tiện đối với các project đang làm dở, nhưng hợp lý đối với các project mới nếu bạn muốn nhập đầy đủ nó bằng Flow.