Simple Flow Typing for Unit #17878
AugustNagro
started this conversation in
Feature Requests
Replies: 0 comments 3 replies
-
WDYT @sjrd? |
Beta Was 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 |
Beta Was 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. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.
Beta Was this translation helpful? Give feedback.
All reactions