Our great sponsors
-
Anywhere that overloads are needed will rely upon type assertions or the unsafety implicit in overloads, for example in fp-ts/function::pipe. It'll come up a lot with objects too when there isn't a preexisting primitive you can compose atop of, as in for example fp-ts-std/Record::pick. Something as generic as @unsplash/sum-types has assertions all over the place, though to be fair that's mostly again a case of struggles interacting with object types.
-
I think this feature might finally be coming in the near future! It's mentioned in the 4.6 iteration plan (https://github.com/microsoft/TypeScript/issues/46858) and a few design meeting notes!
-
Klotho
AWS Cloud-aware infrastructure-from-code toolbox [NEW]. Build cloud backends with Infrastructure-from-Code (IfC), a revolutionary technique for generating and updating cloud infrastructure. Try IfC with AWS and Klotho now (Now open-source)
-
As for the strange behavior around type variance, there are some good and some interesting reasons strictFunctionTypes only applies in limited cases. The original release blog post explains these reasons quite well, using relatively simple terms. To oversimplify, TS can't perfectly represent certain JS cases without significantly sacrificing performance and usability or making massive breaking changes. Interestingly, even strictFunctionTypes, which only affects a small subset of functions, caused 800 compile errors when VSCode enabled it.
Related posts
- Scripting with VSCode Tasks and Typescript
- React intellisense alternating between "x={}" and "y", have posted on their github but not getting a fix :(
- Feature request - inline type aliases
- Setup a modern Jamstack project using Gatsby, TypeScript, Styled Components, and Contentful!
- Visual Studio Code June 2021 (v1.58)