Skip to content

Conversation

@yuhr
Copy link
Member

@yuhr yuhr commented Jan 12, 2025

#442 sometimes produced unsound type inference, such as in case where properties with the same name might be parsed into different values.

const P = Object({ n: String.withParser(() => 1 as const) })
const N = Object({ n: String.withParser(parseInt) })
const PN = P.and(N)
assertEquals(PN.parse({ n: "42" }).n, 1)
// `n` is infered as `1`, but `undefined` actually.

I can't imagine any viable solution to this, so reverting.

@coveralls
Copy link
Collaborator

coveralls commented Jan 12, 2025

Pull Request Test Coverage Report for Build 12805693408

Details

  • 13 of 13 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.4%) to 93.939%

Totals Coverage Status
Change from base Build 12725608463: 0.4%
Covered Lines: 1519
Relevant Lines: 1606

💛 - Coveralls

@yuhr yuhr force-pushed the fix/parser-union-intersect branch from 04ad36b to ff78342 Compare January 16, 2025 09:16
@yuhr yuhr merged commit 68590bb into master Jan 16, 2025
1 check passed
@yuhr yuhr deleted the fix/parser-union-intersect branch January 16, 2025 09:18
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.

3 participants