How to write wrappers, when I have no information ...
# javascript
t
How to write wrappers, when I have no information about nullability of function parameters and result ?
b
turansky: the safest way is to treat parameters as not null and result as nullable
t
@bashor I mean how I can say, that I know nothing about nullability. Possibly I can use symbol
!
like in cases of Kotlin<->Java interoperability? Symbol
!
in wrappers now marked as error. In my case safest way, which you describe, will work bad. Redundant checks (for result) and nonnullable parameters, which really can be nullable will be a big problem.
b
@turansky feel free to create an issue .
And, please, add your usecases, examples
t
@bashor Which logic used in ts2kt? Safest, which you described above? Or you have some mechanics to calculate nullability?
b
Right now it use nullable information in d.ts, the behaviour is the same as in TypeScript 2.0 compiler with
--strictNullChecks