3 ms·
No, object is not a nullable type. For your code to work, you'd need to run it with strictNullChecks disabled. That's probably what you're doing, since it's th
by whatever_dude 10y ago
No, object is not a nullable type.
For your code to work, you'd need to run it with strictNullChecks disabled. That's probably what you're doing, since it's the default.
- mohamedhegazy 10y agoWithout `--strictNullChecks`, both `undefined` and `null` are in the domain of all types.
- dsp1234 10y agosince it's the default. It's not the default for the command line compiler. Also, all types (except Any/null/undefined) are non-nullable under that option, so that's not what makes object special (it's the no primitive types that is important). >tsc test.ts >tsc test.ts --strictNullChecks > test.ts(3,1): error TS2322: Type 'null' is not assignable to type 'object'.
- whatever_dude 10y ago> you'd need to run it with strictNullChecks disabled. That's probably what you're doing, since it's the default I think you misinterpreted my reply. I meant the default is off. That's what your code shows.
- dsp1234 10y agoI did, sorry about that.