- Published on
Disable Type Checking for Entire File in TypeScript
- Authors
- Name
- Ashik Nesin
- @AshikNesin
Similar to ignoring a line in TypeScript by adding the // @ts-ignore
directive before a line, You can also ignore an entire file itself by using the // @ts-nocheck
directive by adding that at the top of the file.
// @ts-nocheck
By adding it at the top of the file, it'll not type-checking all the code in the file So essentially, this code will execute similarly to Javascript without verifying the variable typescript
It is not recommended to use this unless for a rapid prototype or migrating from JavaScript to TypeScript.
Because it removes the type safety which is the main reason why many of us use TypeScript in the first place.
Note: It is available only in latest versions of TypeScript
Happy disabling rules!