"strictFunctionTypes" compiler option leads to error
See original GitHub issueThis is a continuation from this comment from https://github.com/supermacro/neverthrow/issues/36#issuecomment-631706079
Looks like the strictFunctionTypes
compiler option leads to a rather cumbersome type error which looks to have merit.
This SO thread and the official docs on the subject are great resources for explaining what strictFunctionTypes
is, but I personally have not sat down to really think this through to know what the implications for neverthrow
are.
Below is a demonstration where there are type errors when the strictFunctionTypes
is turned on.
Code example: https://repl.it/repls/SparseSaltyPdf
Screenshot:
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
What is the benefit of using '--strictFunctionTypes' in Typescript?
Generally, I assume that all compiler options in the strict family have some great benefits, but in this case, all I see is...
Read more >Error in project with TS 2.6 and strictFunctionTypes #3031
For the second fix option, I guess really we want (this: AsyncAction<T>, state?: T | undefined) => void ?
Read more >Documentation - TypeScript 2.6
TypeScript 2.6 introduces a new strict checking flag, strictFunctionTypes . ... type checking mode, but flagged as an error in strict function types...
Read more >error "Unknown compiler option 'strictFunctionTypes...
I want to create a POS project. when making extension project according to these steps(Create a POS extension package project - Commerce | ......
Read more >How TypeScript's Strict Mode Actually Fixes TypeScript
Each option can be enabled or disabled separately. ... Without strictFunctionTypes , this code will compile, but its types are wrong and can ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the help @paduc!
This issue will remain open even after #41 is merged because I want to grok the subtleties of this
strictFunctionTypes
flag. I am not sure if the flag doesn’t apply to methods because of a limit in the compiler, or whether there’s something fundamentally different between methods and functions such that the statement “parameter positions are checked contravariantly instead of bivariantly.” (from here) doesn’t apply to methods (which it seems to me that it should).Update:
2.3.2
has been released which includes @paduc’s patch:https://github.com/supermacro/neverthrow/pull/41