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

fix consecutive narrow inference, nested pipes #971

Merged
merged 7 commits into from
May 24, 2024
Merged

fix consecutive narrow inference, nested pipes #971

merged 7 commits into from
May 24, 2024

Conversation

ssalbdivad
Copy link
Member

@ssalbdivad ssalbdivad commented May 24, 2024

// Now correctly throws ParseError: Intersection of <3 and >5 results in an unsatisfiable type
const t = type("number>5").pipe(type("number<3"))

// Previously returned a Disjoint object
  • Mention the actual value when describing an intersection error:
const evenGreaterThan5 = type({ value: "number%2>5" })
const out = evenGreaterThan5(3)
if (out instanceof type.errors) {
	/*
    value 3 must be...
      • a multiple of 2
      • at most 5
    */
	console.log(out.summary)
}

// was previously "value must be..."

Thanks @TizzySaurus for reporting the last two on our Discord!

@ssalbdivad ssalbdivad changed the title fix: consecutive narrowing inference, nested pipes fix consecutive narrow inference, nested pipes May 24, 2024
@ssalbdivad ssalbdivad merged commit 79c2b27 into main May 24, 2024
6 checks passed
@ssalbdivad ssalbdivad deleted the dev-15 branch May 24, 2024 21:57
@github-actions github-actions bot mentioned this pull request May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done (merged or closed)
Development

Successfully merging this pull request may close these issues.

None yet

1 participant