Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiments with more precise option types. impressive sometimes but … #2

Closed
wants to merge 1 commit into from

Conversation

winbuzz2523
Copy link

…two gotchas mean i don't want it in master for now:

let x: number|undefined;
const y = Option.of(x);

=> Inferred to Some<number|undefined> <-- i never want that type!

Need Option.from(x) to make it work.

another one:

List.of(Option.of(5), Option.none())

doesn't compile anymore. It says None is not compatible with Some.

Need List.of<Option> to make it work.

Also generally speaking I'm not sure it brings much apart from simple demos
(and making super nice apidocs) -- in the real world you don't deal with Some
and None much -- pretty quickly it's all Option anyway.

…two gotchas mean i don't want it in master for now:

let x: number|undefined;
const y = Option.of(x);

=> Inferred to Some<number|undefined> <-- i never want that type!

Need Option.from<number>(x) to make it work.

another one:

List.of(Option.of(5), Option.none<number>())

doesn't compile anymore. It says None<number> is not compatible with Some<number>.

Need List.of<Option<number>> to make it work.

Also generally speaking I'm not sure it brings much apart from simple demos
(and making super nice apidocs) -- in the real world you don't deal with Some
and None much -- pretty quickly it's all Option anyway.
@emmanueltouzery
Copy link
Owner

Hmm that's a change I authored on a feature branch of mine. I assume you didn't actually intend to open a PR. Reopen if i'm mistaken.

emmanueltouzery added a commit that referenced this pull request Mar 21, 2018
…n, maxOn, minOn, improving maxOn & minOn since you can now max or min by string not only number anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants