In my project I have the "strictNullChecks": true, compiler option enabled, which produces this error:
ERROR in C:/my-project/node_modules/ng2-sticky-kit/src/ng2-sticky/ng2-sticky.ts (185,55): Argument of type 'null' is not assignable to parameter of type 'string | undefined'.
The code in question is where it calls window.getComputedStyle(element, null). That 2nd parameter is optional, meaning it's type is string | undefined in typescript, but null is being passed in which does not match the expected typedef. I believe you can simply change this line of code to window.getComputedStyle(element) to change no functionality and allow it to be compiled properly
Prior to Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), the [2nd] parameter was required. No other major browser required this parameter be specified if null. Gecko has been changed to match the behavior of other browsers.
In my project I have the
"strictNullChecks": true,
compiler option enabled, which produces this error:The code in question is where it calls
window.getComputedStyle(element, null)
. That 2nd parameter is optional, meaning it's type isstring | undefined
in typescript, butnull
is being passed in which does not match the expected typedef. I believe you can simply change this line of code towindow.getComputedStyle(element)
to change no functionality and allow it to be compiled properlyAccording to the Mozilla documentation for
getComputedStyle
: