Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intersection type unexpectedly narrows to never #38263

Closed
NoelAbrahams opened this issue Apr 30, 2020 · 1 comment
Closed

Intersection type unexpectedly narrows to never #38263

NoelAbrahams opened this issue Apr 30, 2020 · 1 comment

Comments

@NoelAbrahams
Copy link

TypeScript Version: 3.9 RC

Search Terms:
intersection never 3.9

Code

enum Foo {

        original = 1,
        modified = 2,
   }

type Original = {

    type: Foo.original;
    title: string;
};

type Modified = {

    type: Foo.modified;
    modification: string;
};

type Bar = Original & Modified;
var x = {} as Bar;

x.title; // Error Property 'title' does not exist on type 'never'

Expected behavior:
No error

Actual behavior:
An error is reported.

Playground Link:

Playground link

Related Issues:
#38162

@NoelAbrahams
Copy link
Author

I see that this is an intentional breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant