gerich-home / it-depends

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

Typescript lint error - ISubscription is not assignable to type {Function, Function} #70

Closed VanDalkvist closed 8 years ago

VanDalkvist commented 8 years ago

I have typescript lint error in https://github.com/gerich-home/it-depends/blob/master/src/computed.ts#L153 line (ISubscription is not assignable to type {Function, Function}).

self.onChange = function(handler: IComputedValueChangeHandler<T>): ISubscription {

Actually, I don't have experience in TypeScript language. But after a little investigation I found that

export type IComputed<T> = IComputedValue<T> | IWritableComputedValue<T>

line is cause of the error. So, here is union operator with different constructors. So, my question is: Does it depend on version of TypeScript? Do you have an error there like me?

gerich-home commented 8 years ago

I do not have error. My version of global tsc:

>tsc -v
Version 1.8.9

However source are built using local \it-depends\node_modules\typescript module. The version of typescript in \it-depends\node_modules\typescript\package.json is "version": "1.8.7" It should be the same as mine for you when you execute npm install in your local repository.

Union types were introduced in 1.4: https://blogs.msdn.microsoft.com/typescript/2014/11/18/typescript-1-4-sneak-peek-union-types-type-guards-and-more/

VanDalkvist commented 8 years ago

Don't know why I have the error there. I use WebStorm and it has 1.8.7 version of typescript like from local node_modules repository. With VisualStudio typescript comes with 1.0.3.0 version. Weird. I doubt that WebStorm uses 1.0.3.0 version.

VanDalkvist commented 8 years ago

Nevertheless,

> tsc -v
1.0.3.0
gerich-home commented 8 years ago

Try updating typescript. As I rememeber it is done with npm install typescript -g However you should use gulp to build project I think. At the least I do o from VSCode (see https://github.com/gerich-home/it-depends/blob/master/.vscode/launch.json#L8 or https://github.com/gerich-home/it-depends/blob/master/.vscode/tasks.json#L10)

VanDalkvist commented 8 years ago

I've already tried to update. Also I've updated VS typescript but it didn't turn on to the new version. And Of course I use gulp to build. In any case it is environment issue, so, I will close the issue.

VanDalkvist commented 8 years ago

And also I should say that build ts is always successful. So, another sign that it's IDE or environment issue