Oh man...I wish I could answer any "why" question about JS/TS...but all I know is that the TS transpiler doesn't complain when I do something like that without the | null 😂
I believe that setting an object type to null is fine, but undefined / unknown would cause an error.
-1
u/ef02 Jun 20 '21
The
| nullis unnecessary in TypeScript, but other than that, it seems fine.