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

test unionized params #14

Open
KiaraGrouwstra opened this issue Feb 15, 2018 · 1 comment
Open

test unionized params #14

KiaraGrouwstra opened this issue Feb 15, 2018 · 1 comment

Comments

@KiaraGrouwstra
Copy link
Owner

Types aren't values, and keeping types union-safe is a pretty big deal for broader usability. I should actually start testing for that, and ideally documenting it too.

@KiaraGrouwstra
Copy link
Owner Author

Known edge-cases to test for:

  • union types input: the result of a type function should equal include that of the union of the individual inputs (F<A|B> >= F<A>|F<B>, distributivity)?... though things like Indeterminate and its dependents would definitely not satisfy this, nor e.g. IsUnion... where does this discrepancy stem from? UnionHasKey?
    • which union-proof inputs can take never? seemingly all basic operators minus property access are never-proof. somehow & also failed, thought that's fixed since TS 2.5?
  • sub-types: given sub-types of the envisioned input (e.g. 'a' -> 'a' & string), the output should also extend that of the original (for A < B, F<A> < F<B>)
  • super-types: given super-types of the envisioned input, the output should also be a super-type of the original (for A > B, F<A> > F<B>)
  • prototypes: type functions should be tested for input involving methods on Object.prototype -- that is, for objects try having an explicit toString method, for string input, try toString.

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

1 participant