Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
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!
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
- Filtering TypeScript value types
- 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!