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

heterogeneous array #39

Open
acthp opened this issue May 17, 2015 · 1 comment
Open

heterogeneous array #39

acthp opened this issue May 17, 2015 · 1 comment

Comments

@acthp
Copy link

acthp commented May 17, 2015

Is there a way to specify an array with items having different types? E.g. for data

['square' 1 1 4 4]
['circle' 1 1 3]

the schema should match either array of string 'square' + four numbers, or array of string 'circle' + three numbers. It should not match array of 'circle' + four numbers, or 'square' with three.

I haven't found a recursive Array declaration, only Array (match class only), Array.of (match homogeneous elements), and Array.like (exact match).

@bcherny
Copy link

bcherny commented Oct 19, 2015

👍 👍 👍

it sounds like you're looking for typed tuples. i need something similar - union types. eg.

{
  foo: Array.of(String),
  bar: Array.of(Number),
  baz: Array.of(String.or(Number))
}

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

No branches or pull requests

2 participants