GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Regression in TypeScript 7: generic inference for a Ref/tuple intersection · Issue #65709 · microsoft/TypeScript

Regression in TypeScript 7: generic inference for a Ref/tuple intersection #65709

New issue
Copy link
New issue
Copy link
Backlog
Backlog
Regression in TypeScript 7: generic inference for a Ref/tuple intersection#65709
Copy link
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bug

Description

@piyota6
Wataru, Shoji (piyota6)
opened on Nov 27, 2026
Issue body actions

🔎 Search Terms

  • ModelRef inference
  • generic inference intersection tuple
  • Ref tuple inference

🕗 Version & Regression Information

  • TypeScript 6.0.3: no error
  • TypeScript 7.0.2: error
  • TypeScript 7.1.0-dev.20261127.1 (latest nightly as of 2026-11-28): error

The issue also reproduces with the latest nightly.

⏯ Playground Link

No response

💻 Code

Run with tsc --ignoreConfig --strict --noEmit repro.ts.

interface Ref<T, S = T> {
  get value(): T;
  set value(value: S);
}

type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G, S> & [
  ModelRef<T, M, G, S>,
  Record<M, true | undefined>,
];

type Item = { name: string };
declare const rows: ModelRef<Item[]>;

type GridRowsTarget<T> = Ref<T[]> | T[];
declare function makeHandler<T>(
  rows: GridRowsTarget<T>,
): (params: { data?: T }) => void;

const remove = makeHandler(rows);
remove({ data: { name: 'example' } });

const explicit = makeHandler<Item>(rows);
explicit({ data: { name: 'example' } });

🙁 Actual behavior

TypeScript 7 reports an error on the remove call:

error TS2322: Type '{ name: string; }' is not assignable to type
'Record<string, true | undefined> | ModelRef<Item[], string, Item[], Item[]> | undefined'.
  Types of property 'name' are incompatible.
    Type 'string' is not assignable to type 'true'.

It appears to infer T from the tuple elements rather than the Ref element type. The call with an explicit <Item> type argument succeeds.

🙂 Expected behavior

As in TypeScript 6.0.3, infer T as Item and accept the call. The explicit type argument demonstrates that the argument is compatible with the Ref<Item[]> branch.

Additional information about the issue

The types are simplified stand-ins for Vue's Ref and ModelRef. The reproduction requires no Vue, SFC tooling, or external dependencies.

Possibly related: #59521, although that issue concerns conditional inference and predates this regression.

Activity

  1. ahejlsberg commented on Nov 28, 2026

    @ahejlsberg
    Anders Hejlsberg (ahejlsberg)
    on Nov 28, 2026
    Member
    More actions

    This is a type ordering issue. The same error is reported by TS 6.0 with the --stableTypeOrdering flag. The issue arises when inferring from ModelRef<Item[]> to Ref<T[]> | T[]. The types are dissimilar enough that only structural inference is possible, and that produces several incompatible candidates. Type ordering then becomes the tie breaker and, with the stable type ordering in TS 7.0 and later, a different candidate is chosen.

  2. Anders Hejlsberg (ahejlsberg)
    added
    Working as IntendedThe behavior described is the intended behavior; this is not a bug
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.