Skip to content

Reject unknown properties in Match.when object patterns#6436

Draft
coyaSONG wants to merge 1 commit into
Effect-TS:v3from
coyaSONG:agent/fix-match-excess-properties
Draft

Reject unknown properties in Match.when object patterns#6436
coyaSONG wants to merge 1 commit into
Effect-TS:v3from
coyaSONG:agent/fix-match-excess-properties

Conversation

@coyaSONG

Copy link
Copy Markdown
Contributor

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Match.when inferred object patterns through a generic parameter, which bypassed TypeScript's fresh-object excess-property check. A stale property could therefore keep compiling after the matched value type renamed that property, even though the branch could no longer match at runtime.

This adds an object-pattern key guard that accepts keys present on any object variant of the matched input while leaving predicates, refinements, and array patterns unchanged. The regression test covers the reported nullable tagged-union case.

Related

Validation

  • pnpm test-types Match.tst.ts — 32 tests, 97 assertions, and 11 expected diagnostics passed
  • pnpm test packages/effect/test/Match.test.ts — 62 tests passed
  • pnpm lint-fix
  • pnpm lint
  • pnpm check
  • pnpm build
  • pnpm docgen; the affected packages/effect docgen was rerun on the final source
  • git diff --check

AI assistance

OpenAI Codex assisted with issue screening, implementation, and validation. No human review is claimed.

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jul 16, 2026
@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: db1bbb7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
effect Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@IMax153 IMax153 added the 3.0 Used for issues, pull requests, etc. that are relevant for the `v3` branch targeting Effect v3. label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.0 Used for issues, pull requests, etc. that are relevant for the `v3` branch targeting Effect v3.

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

2 participants