Skip to content

Unintentional bugfix?: Type parameters no longer assignable to unions with object and undefined in strict null checks #24013

Closed

Description

TypeScript Version: 2.9.0-dev.20180509

Search Terms:

Code

function f<T>(x: T) {
    const y: object | null | undefined = x;
}

in 2.8 with strictNullChecks on, this compiles (it does not when it is off). In very recent master, however, it is now an error (as it should be?):
image

Playground Link

While I think the error is certainly correct to issue, this change apparently breaks a handful of RWC tests, so is worth looking into.

Activity

  1. added
    Bug
    Breaking Change
    on May 10, 2018
  2. weswigham commented on May 15, 2018

    @weswigham
    MemberAuthor

    Intentional fix by #23806, I just wasn't aware of it. 👍

  3. removed
    Bug
    on May 15, 2018
  4. locked and limited conversation to collaborators on Jul 31, 2018
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

    Breaking Change

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions