Created
August 15, 2019 15:43
-
-
Save xdesro/27b44085a997c5b793a581ff88f54c75 to your computer and use it in GitHub Desktop.
In VSCode, you can add `// @ts-check` to the beginning of a vanilla JS file to enable type-checking on the file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @ts-check | |
/** | |
* @return {String} | |
*/ | |
const someFunc = () => { | |
return 4; // err in VSCode: "Type '4' is not assignable to type 'String' | |
} | |
someFunc('test'); // err in VSCode: "Expected 0 args but got 1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment