Type 'IImmutableMap<{ a: boolean; b: null; }>' is not assignable to type 'TestAbcType'.
Type 'string | null' is not assignable to type 'null'.
Type 'string' is not assignable to type 'null'.
This is surprising because according to the type definition, b can be a string or null. In this case, b is null and should satisfy the condition of string | null. This code works if it's not wrapped with IImmutableMap, indicating the problem lies with this library.
Migrated from don't! Originally created by @JoshuaLamusga on Thu, 10 Sep 2020 20:24:13 GMT
What happened
With typescript 3.9.7 and immutable-js version 3.8.2, the following code unexpectedly throws an error:
With the error being:
This is surprising because according to the type definition,
b
can be a string or null. In this case, b is null and should satisfy the condition ofstring | null
. This code works if it's not wrapped with IImmutableMap, indicating the problem lies with this library.