Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: inspect-js/hasOwn
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.3
Choose a base ref
...
head repository: inspect-js/hasOwn
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.4
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on May 28, 2026

  1. Configuration menu
    Copy the full SHA
    91f6247 View commit details
    Browse the repository at this point in the history
  2. [types] drop the dead key-narrowing overload

    `cc03a09` added a key-narrowing overload `(o, p) => p is K & keyof O` alongside the original object-narrowing one
    `(o, p) => o is O & Record<K, V>`, intending the latter to remain available as the "common case" fallback.
    
    In practice the two overloads have identical parameter signatures,
    so TypeScript's overload resolution always picks whichever is declared first,
    leaving the other unreachable.
    With key-narrowing first, the common `hasOwn(value, 'x')` pattern stopped narrowing `value`,
    forcing callers to either cast or redundantly write `'x' in value` purely for narrowing.
    
    Drop the key-narrowing overload entirely - it's dead code as long as object-narrowing is also present, regardless of order.
    Add `test/types.js` to lock in the object-narrowing behavior (including the `undefined`-removal side effect) so a future overload-add can't silently regress it.
    ljharb committed May 28, 2026
    Configuration menu
    Copy the full SHA
    fdab00e View commit details
    Browse the repository at this point in the history
  3. v2.0.4

    ljharb committed May 28, 2026
    Configuration menu
    Copy the full SHA
    97f3a85 View commit details
    Browse the repository at this point in the history
Loading