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

Improve readability of Merge result #170

Merged
merged 1 commit into from Jan 3, 2021
Merged

Improve readability of Merge result #170

merged 1 commit into from Jan 3, 2021

Conversation

papb
Copy link
Contributor

@papb papb commented Dec 15, 2020

Consider this example:

type Foo = { foo: string };
type Bar = { bar: string };

type Merged = Merge<Foo, Bar>;

Before this PR:

image

After this PR:

image

@@ -1,5 +1,9 @@
import {Except} from './except';

type ImproveIntersectionHoverReadabilityShallow<T> = T extends Record<string, unknown> ? { [K in keyof T]: T[K] } : T;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like https://gist.github.com/ClickerMonkey/a081b990b9b14215141fb6248cef4dc4#file-types-ts-L49-L54 Maybe we should do it like that one and call it Simplify? I think it might be useful for other types too, so can you move it to https://github.com/sindresorhus/type-fest/blob/master/source/utilities.d.ts

@sindresorhus
Copy link
Owner

@mmkal Do you know of any way to test this? To ensure it doesn't regress in the future.

@sindresorhus
Copy link
Owner

@sindresorhus sindresorhus mentioned this pull request Dec 16, 2020
3 tasks
@mmkal
Copy link
Contributor

mmkal commented Dec 16, 2020

@sindresorhus I can't think of a way to do it without using the compiler API, but maybe that would be appropriate given this library is specifically for types.

@sindresorhus
Copy link
Owner

@papb Can you update to use https://github.com/sindresorhus/type-fest/blob/master/source/simplify.d.ts ?

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

Successfully merging this pull request may close these issues.

None yet

3 participants