0.0.1 • Published 9 years ago

types-assert-loader v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

types-assert loader for webpack

Using types-assert in browser.

Install

$ npm i types-assert-loader -D

How To Use

webpack.config.

{
  module: {
    loaders: [
      { test: /\.ts$/, loader: "types-assert" }
    ]
  }
}

Using TypeScript type definition files.

type.ts

interface Interface1 {
  stringProp: string;
  numProp: number;
}
import { assert } from 'types-assert/assert';
import { Interface1 } from './type.ts';
  
const obj1 = {
  stringProp: "hoge",
  numProp: "2"
};
 
assert(obj1, Interface1);
// => throw Error!! 

License

MIT

0.0.1

9 years ago