Closed Raynos closed 10 years ago
Ah, the old nullable issue. I was taking the B?
nullable syntax from C#. You're quite right that it is confusing to use similar looking syntax for both optional labels and optional values. I'm happy to use type combinators to make it more explicitly nullable like you have here.
An optional type can either have an optional label or be an optional type.
Let's compare
There is a difference between an optional type and an optional label.
An optional label means the argument is optional.
i.e.
foo2(A, C)
is valid.An optional type means the type
B
is nullablei.e.
foo(A, null, C)
is valid.Most of the time when you think optional what you really mean is an optional argument.
It's recommended that if you truly want a nullable type you be more explicit about it. i.e.
foo3 : (A, B | null, C) => void
This PR removes optional types completely and tells you to use optional labels.
cc @jden @Matt-Esch