Introduction to the JavaScript static type check tool FLOW _ basic knowledge-js tutorial

Source: Internet
Author: User
This article mainly introduces the JavaScript static type check tool FLOW introduction. If you need it, you can refer to the static type check tool developed by Facebook for JavaScript. Its code is hosted on github and complies with the BSD open-source protocol.

About Flow

It helps us capture Common Errors in JavaScript development without modifying your original code, such as static type conversion and null value reference.
At the same time, Flow adds a static type syntax identifier for JavaScript, so that developers can identify the types in the Code and make them automatically maintained by Flow.
Currently, Flow has the following two features:

1. The Flow type check is optional.

Unless you explicitly tell the Flow to check the type of some files, it will not check the files you do not need to check. That is to say, you can slowly move your code library to Flow and continue to reap the value of continuous growth.
For example, if you select a file to check, Flow will automatically check the type of your code and find out the errors in your code. However, if your code exists in different files, this is too troublesome. But sometimes, if you choose to check some very large libraries, the Flow may not be so accurate. In this case, we can manually use "type annotation" or switch to "weak mode" to restrict its type reference to solve the problem.

2. Flow Type check is online

When checking the code library, Flow will perform a preliminary analysis on it, and then conduct continuous monitoring, type check, and dependency check on subsequent changes in the background. Developers do not need to spend a lot of time compiling. When files are saved in batches, the Flow type check is automatically triggered and the results are persisted for reuse.

Usage and expectation

Flow is a new library produced by Facebook, and a large number of features are still under development. Its long-term goal is to make JavaScript
Development Experience is better, without compromising the most essential things in the language. We want developers to have powerful tools to understand how to maintain their code and reuse and optimize their code more securely. In the early days, we chose open source to give Flow a chance to quickly grow up in front of all developers.

Next, I will introduce some examples to help you quickly understand how Flow works and how to make our work better through Flow.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.