Skip to content

fix: use getAllInterfaceFields in findInterfaceByDiscriminant for inherited discriminant fields#125

Merged
cs01 merged 2 commits intomainfrom
fix/discriminant-getAllInterfaceFields
Mar 8, 2026
Merged

fix: use getAllInterfaceFields in findInterfaceByDiscriminant for inherited discriminant fields#125
cs01 merged 2 commits intomainfrom
fix/discriminant-getAllInterfaceFields

Conversation

@cs01
Copy link
Owner

@cs01 cs01 commented Mar 8, 2026

Summary

  • findInterfaceByDiscriminant was passing iface.fields (own fields only) to checkInterfaceForDiscriminant
  • This caused discriminant union narrowing to miss interfaces where the discriminant field is inherited from a parent interface (e.g., interface Child extends Parent where Parent has type: 'literal')
  • Fixed to use this.getAllInterfaceFields(iface) which includes all inherited fields
  • Adds test fixture interface-extends-discriminant.ts verifying discriminant field access on interfaces with inheritance

Test plan

  • 432 tests pass
  • Full 3-stage self-hosting passes

🤖 Generated with Claude Code

@cs01 cs01 merged commit 7214a15 into main Mar 8, 2026
12 checks passed
@cs01 cs01 deleted the fix/discriminant-getAllInterfaceFields branch March 9, 2026 04:16
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.

1 participant