Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the current state of JavaScript static type checking?

I know that the Google Closure Compiler does type checking—but are there any alternatives, preferably that aren't so tightly coupled with a library and optimizer?

If not, is there any way to have the Google Closure Compiler only do static analysis?

(By static analysis here, I mean things like defining types for arguments and so on that I can run through something to give me warnings if I make a typo or pass the wrong type.)

like image 644
Aaron Yodaiken Avatar asked Jul 12 '11 23:07

Aaron Yodaiken


People also ask

What is static type checking in JavaScript?

Static type checking JavaScript only supports dynamic type checking, which means type safety is only verified at runtime; it brings the flexibility to the language but allows unexpected errors at runtime. Static type checking is the process of checking type safety based on source code.

Does JavaScript use static typing?

In the JavaScript community, Flow and TypeScript have emerged as the two main options for enabling static type checking: Flow is a static type checker for JavaScript. It is an open-source tool developed by Facebook. TypeScript is a statically typed superset of JavaScript that compiles to plain JavaScript.

What is a static type checker?

Static type checking is the process of verifying the type safety of a program based on analysis of a program's text (source code). If a program passes a static type checker, then the program is guaranteed to satisfy some set of type safety properties for all possible inputs.

What is static type checking in react JS?

Static Type Checking is used to check the type of state, variables and functions in react. In react, there are two ways to implement the Static Type Checking. Flow. TypeScript.


1 Answers

There's Doctor JS, which is a Mozilla project that primarily (as I understand it, at least) does type-checking for JS.

like image 95
gsnedders Avatar answered Sep 26 '22 12:09

gsnedders