In this Hasty Treat, Scott and Wes talk about the Typescript\xa0strict
\xa0flag \u2014 what it does and why you might use it.
Sanity.io\xa0is a real-time headless CMS with a fully customizable Content Studio built in React. Get a Sanity powered site up and running in minutes at\xa0sanity.io/create. Get an awesome supercharged free developer plan on\xa0sanity.io/syntax.
LogRocket - SponsorLogRocket lets you replay what users do on your site, helping you reproduce bugs and fix issues faster. It\u2019s an exception tracker, a session re-player and a performance monitor. Get 14 days free at\xa0logrocket.com/syntax.
Show Notes02:50 - What is it?
03:26 -\xa0noImplicitAny
any
\xa0type in TypeScript is exactly that - it can be anything.infer
\xa0the type. When it can\u2019t it will be\xa0any
.any
, but if that is the case, you must explicitly type it as\xa0any
.any
\xa0- it might be a mistake, or you forgot to type it. Risky! 06:01 -\xa0noImplicitThis
this
\xa0- it can\u2019t be implicitly inferred. 06:47 -\xa0strictFunctionTypes
07:44 -\xa0alwaysStrict
var
\xa0variables. 09:25 -\xa0strictNullChecks
strictNullChecks
\xa0makes you check that it\u2019s there - like an if statement. 11:18 -\xa0strictBindCallApply
12:38 -\xa0strictPropertyInitialization
13:37 -\xa0useUnknownInCatchVariables