-
Notifications
You must be signed in to change notification settings - Fork 13k
Description
A project often depends on other libraries which come with their own .d.ts
files. For example:
Library: lib_a.d.ts
declare function foo(name: string): string;
When my project turns on strictNullChecks
it is not clear to me if the lib_a.d.ts
can be trusted. Because if it was compiled without strictNullChecks
than my project should interpret it as:
Library: lib_a.d.ts
declare function foo(name: string|null|undefined): string|null|undefined;
but if it was compiled with strictNullChecks
than the lib_a.d.ts
should be trusted as is.
In real life there are often many library dependencies, and I would like to turn on strictNullChecks
in my project before I have to wait that all of the third party libraries are ready.
Straw-man syntax would be:
Library: lib_a.d.ts
/// <compiler-options strictNullChecks: true>
declare function foo(name: string): string;
The TS compiler would than adjusted the types on the fly as it reads the libraries because it knows with what options they have been compiled.