Every time I type an undefinable variable, I think I typed something wrong:
let a: string | undefined;
Why do I think I did something wrong? It's because I never add undefined type to a union type as above except in variable declarations.
Don't you think it is time, introduce the optional operator to local variable declarations as well?
The above syntax feel very natural and idiomatic typescript for me.
Every time I type an undefinable variable, I think I typed something wrong:
Why do I think I did something wrong? It's because I never add
undefinedtype to a union type as above except in variable declarations.Don't you think it is time, introduce the optional operator to local variable declarations as well?
The above syntax feel very natural and idiomatic typescript for me.