Skip to content

in operator on T & object narrows to neverΒ #50639

Closed

Description

Bug Report

πŸ”Ž Search Terms

  • in operator
  • generic
  • intersection
  • object
  • never

πŸ•— Version & Regression Information

  • This changed between versions 4.7 and 4.8

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

const f3 = <A,>(value: A) => {
    if (
        typeof value === "object" &&
        value !== null &&
        "prop" in value
    ) {
        value;
        // ^?
        // TS 4.7: `A`
        // TS 4.8: `never`
        // Expected: `A & object`
    }
};

πŸ™ Actual behavior

See above.

πŸ™‚ Expected behavior

See above.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions