Skip to content

Argument of any no longer matches <T>(x: T) => T in overload set #39208

Description

Based on code from knockout on DT:

interface Punch {
    <T>(value: T): T;
    <T = any>(value: null): T | null
}
function x(p: Punch) {
  var wat = p<number>(5 as any)
  var wit = p<number>('hi')
  var wot = p<number>(5)
}

Expected behavior:

wat: number, wit: number, wot: number

Actual behavior:

wat: number | null, wit: number | null, wot: number

Activity

  1. sandersn commented on Jun 23, 2020

    @sandersn
    MemberAuthor

    Looks like it only repros when the second overload's parameter type is null; I tried never and { random, object, properties } and the first overload gets chosen.

  2. sandersn commented on Jun 23, 2020

    @sandersn
    MemberAuthor

    Works on nightly from 06/15; fails on nightly from 06/20; we failed to publish 16,17,18,19.

  3. sandersn commented on Jun 23, 2020

    @sandersn
    MemberAuthor

    Bisecting shows the cause to be #35282. Doesn't really make sense though.

  4. sandersn commented on Jun 23, 2020

    @sandersn
    MemberAuthor

    Turns out 905 lines changed in the checker, so it's probably a minor transliteration error.

  5. 3 remaining items

  6. RyanCavanaugh commented on Feb 4, 2022

    @RyanCavanaugh
    Member

    Doesn't appear to be any user-encountered impact from this

  7. locked as resolved and limited conversation to collaborators on Oct 21, 2025
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

    BugA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestone

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions