gerich-home / it-depends

Lightweight dependency tracking library for JavaScript
http://it-depends-js.github.io/
Other
1 stars 2 forks source link

Publish typings to https://github.com/typings/registry #57

Open gerich-home opened 8 years ago

gerich-home commented 8 years ago

Typings are generated during the build now. We need to publish them to the https://github.com/typings/registry so that it will be possible to run typings install it-depends, then edit your tsconfig.json in the following way:

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "noImplicitAny": false,
        "sourceMap": false
    },
    "files": [
        "index.ts",
        "typings/main.d.ts"
    ]
}

and get compile error

index.ts(6,36): error TS2345: Argument of type '() => number' is not assignable to parameter of type 'ICalculator<string>'.
  Type 'number' is not assignable to type 'string'.

when running tsc for the following index.ts file:

import * as itDepends from 'it-depends'

var x = itDepends.value<number>(1);
x.onChange(()=>x.write(2));

var y = itDepends.computed<string>(()=>{
    return x();
});

I tried to install typings from local filesystem and they work great! Just run smth like typings install it-depends=file:..\it-depends\out\definitions\it-depends.d.ts --save and it will generate typing file similar to this: https://gist.github.com/gerich-home/c23f5c81c1d5bd0c39df6cba5d68029c

We just need to automate it for release process.