0.1.2 • Published 10 months ago

@doubleedesign/type-checker v0.1.2

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

type-checker

Provides the ability to check which TypeScript type(s) an object is anywhere in your code in a Node development environment.

Example setup

// tsconfig.json
{
    "compilerOptions": {
        "baseUrl": "./",
        "module": "esnext",
        "target": "esnext",
        "moduleResolution": "node",
        // ... more options as you need
    },
    "typechecker": {
        "types": ["Artist", "Album"], // names of the types you want to be able to check against 
        "locations": ["./types.ts"] // where the type definitions are located 
    }
}

Example usage

import { TypeChecker } from '@doubleedesign/type-checker';

const boss: Artist = { name: 'Bruce Springsteen' };
const type: string[] = TypeChecker.getType(boss); // ['Artist']

Notes

  • For performance reasons, this may not be production-ready. So far my main use of it has been for unit testing.
  • This only checks for matching object keys, not that the values are the correct type.

Roadmap/future goals

  • Make it check value types, not just key names.
  • Make it work in the browser.
  • Improve performance.
0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

11 months ago

0.0.9

12 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.1

1 year ago