Simple Flow Typing for Unit #17878
AugustNagro started this conversation in Feature Requests
Replies: 0 comments 3 replies
-
WDYT @sjrd? |
BetaWas this translation helpful?Give feedback.
0 replies
-
Oh I'm all for it, of course. I was already suggesting this when we started discussing flow typing for |
BetaWas this translation helpful?Give feedback.
0 replies
-
I spent some time looking at this PR, creating a class Unitables.scala & started updating all relevant places. But it seems like a bigger refactoring & codebase knowledge than I have the bandwidth for is required. Sorry guys. |
BetaWas this translation helpful?Give feedback.
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It is really cool that Scala 3 supports flow-sensitive typing for null.
It would also be helpful to have flow-typing for Unit. In Scala.js Unit maps to JavaScript undefined, and often when modeling npm library types you will have fields that may be undefined.
For example this works in Scala 3:
But not this:
The current solution in Scala.js is to use js.UndefOr, but I think it may be nicer to use Scala 3 union types.
If this is something that could be accepted with a PR I could try my hand at implementing.
BetaWas this translation helpful?Give feedback.
All reactions