You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript Version: master-build
As originally suggested by @shovon in comment in additional of passing undefined/null in destructing parameter as suggested by the comment, destructing, in general, should never be allow undefined or null Code
// All should be errorvar{}=undefined;var{}=null;var[]=undefined;var[]=null;functionone({}){}functiontwo([]){}functionthree({foo: string,bar: number}){}functionfour([a,b]: number[]){}functionfive({}=undefined){}functionsix([]=undefined){}one(undefined);one(null)two(undefined);two(null);three(undefined);three(null);four(undefined):
four(null);five(undefined);five(null);six(undefined);six(null);// This is okfunctionfoo({}={}){}functionbar([]=[]){}foo(undefined);foo(null);bar(undefined);bar(null);
The text was updated successfully, but these errors were encountered:
All the function calls are already handled with --strictNullChecks. outside --strictNullChecks mode, null and undefined are valid input for these functions, do not see why we should disallow that. this is analogs to var x: {} = undefined, which is allowed.
The first set of var declarations are not flagged. but the empty destructing patters are are esoteric at best. var {a} = undefined is again flagged under --strictNullChecks.
I do not think we should add the concept of nullablity if --strictNullChecks is not set.
TypeScript Version: master-build
As originally suggested by @shovon in comment in additional of passing undefined/null in destructing parameter as suggested by the comment, destructing, in general, should never be allow undefined or null
Code
The text was updated successfully, but these errors were encountered: