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

Intersect interfaces, but "union" properties #328

Closed
fregante opened this issue Nov 26, 2021 · 2 comments
Closed

Intersect interfaces, but "union" properties #328

fregante opened this issue Nov 26, 2021 · 2 comments

Comments

@fregante
Copy link
Collaborator

This is what I'm looking for

interface MyNum {
	id: number;
}
interface MyStr {
	id: string;
	title: string;
}

type Type = SmartIntersect<MyNum, MyStr>; // {id: number | string, title: string}

but this is what we got:

type Type = MyNum | MyStr; // {id: number } | {id: string, title: string}
type Type = MyNum & MyStr; // {id: never, title: string }

Do you think this is already possible?

@sindresorhus
Copy link
Owner

Sounds similar to #173.

@fregante
Copy link
Collaborator Author

Yup 👌

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

2 participants