Is there a way to disable
When I write code, I often use a null type check instead of an empty string check. However, TypeScript shows an error stating 'Type 'string' is not assignable to type 'null'.ts(2322)'. If I try to follow TypeScript's suggestion and set the string as undefined or empty, it leads to a cascade of errors throughout the code, such as:</p>
<pre><code>Variable 'value2' is used before being assigned.ts(2454)
Is there a specific flag or option I can use to deactivate this error?
Here is an example of the code:
function check(value: string, value2: string = null) { // error here
if (value2==null) {
//
}
}
Another example:
var value: string = null; // error here
Additionally, I am looking to disable the following error:
Argument of type 'string | null' is not assignable to parameter of type 'string'.
Type 'null' is not assignable to type 'string'.ts(2345)
Is there a TypeScript compilation option that can help with this?