ts-check-without-ts

This repository demonstrates using ts-check within a JavaScript repository, aka, TypeScript checking without TypeScript

Usage no npm install needed!

<script type="module">
  import tsCheckWithoutTs from 'https://cdn.skypack.dev/ts-check-without-ts';
</script>

README

TypeScript Checking Without TypeScript

CircleCI Greenkeeper badge

This repository demonstrates using @ts-check and JSDoc within a JavaScript file to catch type errors.

AKA: Using TypeScript to type check JavaScript!

Visual Example


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

  1. Clone: git clone git@github.com:yowainwright/ts-check-without-ts.git
  2. 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
    
  3. Within src/index.js remove this line /* eslint-disable */