TypeScript Checking Without TypeScript
This repository demonstrates using @ts-check
and JSDoc within a JavaScript file to catch type errors.
AKA: Using TypeScript to type check JavaScript!
Usage
Clone this repository. Install its dependencies. See the errors in src/index.js
. Fix them. Run tests (npm test
). Now you get why @ts-check
and JSDoc
work together to assist you in writing safer code! 💅🏾
Within the src/
and build/
finished files are added if you get confused. Otherwise fixing issues within index.js
and making tests pass should take little time.
Setup
-
Clone:
git clone git@github.com:yowainwright/ts-check-without-ts.git
- Within
jest.config.js
, remove these lines:'/src/index.js', // @here remove this line to test changes '/src/__tests__/index.js', // @here remove this line to test changes
- Within
src/index.js
remove this line/* eslint-disable */