Skip to content

Instantly share code, notes, and snippets.

@xdesro
Created August 15, 2019 15:43
Show Gist options
  • Save xdesro/27b44085a997c5b793a581ff88f54c75 to your computer and use it in GitHub Desktop.
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.
// @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