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

feat: support arbitrary length unions #166

Merged

Conversation

ForbesLindesay
Copy link
Contributor

I had to separate out "RuntypeBase" which only includes the actual validation methods from "Runtype" which includes all the helper methods. This is because internally we frequently treat Runtype as "covariant" i.e. if I was expecting a Runtype<string> it's ok to give me a Runtype<'hello world'>. TypeScript historically hasn't cared that much about variance, but over time it is getting strickter and the helper methods are often invariant.

BREAKING CHANGE: the various Union2, Union3, ... types have all been replaced with a single Union type that takes a tuple of Runtype validators.

I had to separate out "RuntypeBase" which only includes the actual validation methods from "Runtype" which includes all the helper methods. This is because internally we frequently treat Runtype as "covariant" i.e. if I was expecting a `Runtype<string>` it's ok to give me a `Runtype<'hello world'>`. TypeScript historically hasn't cared that much about variance, but over time it is getting strickter and the helper methods are often invariant.

BREAKING CHANGE: the various `Union2`, `Union3`, ... types have all been replaced with a single `Union` type that takes a tuple of Runtype validators.
@coveralls
Copy link
Collaborator

coveralls commented Sep 4, 2020

Coverage Status

Coverage increased (+0.001%) to 99.204% when pulling c293065 on ForbesLindesay:feat/upstream/arbitrary-length-unions into b3b433c on pelotom:master.

@joual
Copy link

joual commented Dec 22, 2020

What is needed to get this merged?

@yuhr
Copy link
Collaborator

yuhr commented Mar 14, 2021

Please don't include changes that are only relevant to your fork release. This package is not funtypes. We can't merge because of it no matter how much the PR includes substantial improvements.

@yuhr

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants