JulioWar / jw-bootstrap-switch-ng2

Bootstrap Switch for Angular 2+
https://juliowar.github.io/jw-bootstrap-switch-ng2/
MIT License
43 stars 14 forks source link

TS2322: Type 'null' is not assignable to type 'number'. #15

Closed Qowy closed 6 years ago

Qowy commented 6 years ago

Shouldn't line 71 in directive.ts be:

private _dragStart: any = null; instead of private _dragStart: number = null;

Technically it should probably be private _dragStart?: number = undefined; but declaring it any keeps it in line with _dragEnd

JulioWar commented 6 years ago

Hello @Qowy

Thanks. I will change it. I didn't see it.

JulioWar commented 6 years ago

Just one question @Qowy , When did you see that error? When you are trying to add it in a module? what version of typescript are you using ?

JulioWar commented 6 years ago

update the library and try again. Let me know if you have an issue, if not, please close this issue

Qowy commented 6 years ago

Thank you will try it tomorrow.

I just installed it via npm and set it up in my app.module.ts I got the error during loading of the page (which I think uses webpack)

I am using Typescript 2.5 and I think my typescript configuration enforces strict null checking, which seems to be the default since a few versions ago according to me googling this error.

Qowy commented 6 years ago

Works fine thank you.