question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"strictFunctionTypes" compiler option leads to error

See original GitHub issue

This 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:

Screen Shot 2020-05-21 at 10 16 01 AM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
supermacrocommented, May 22, 2020

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).

1reaction
supermacrocommented, May 27, 2020

Update: 2.3.2 has been released which includes @paduc’s patch:

https://github.com/supermacro/neverthrow/pull/41

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found