5 ms·
tsc --noImplicitAny solves that.
by Gaelan 9y ago
tsc --noImplicitAny solves that.
- DanRosenwasser 9y agoOr to go all-in - we have a `--strict` flag that gives you `noImplicitAny`, `strictNullChecks`, `noImplicitThis`, and a mode that always puts you in `"use strict"` mode.
- Gaelan 9y agoAh, cool! The last major project I worked on in TS was still before null and this checking.
- zumu 9y agoI don't understand why `strictNullChecks` is not the default behavior. It being a special compiler option makes me somewhat dubious of TypeScript in general.
- Gaelan 9y agoBackwards compatibility.
- aphexairlines 9y agoI think when he says bypass, he might mean you can explicitly cast to `any`.
- spion 9y agoDynamic language proponents sometimes like to say that static types can't catch all errors and are therefore of little use. Static type proponents sometimes like to say that unsound type systems that leave escape hatches are of little use. The truth is that both are somewhat wrong. Types are a tool. They help catch some errors and help code evolve - even when not completely sound, they still help catch some errors and evolve code. They also don't understand all correct code, so sometimes they get in the way and when that happens, its important to get them out of the way in a manner that doesn't compromise things too much. Nothing is black and white, there are only shades of grey.
- runeks 9y agoIn Haskell you can also explicitly cast to any type a using "error", "undefined" and "throw". But that's just what exceptions are in Haskell. This is fine, as long as it's only used in exceptional cases.