-
-
Notifications
You must be signed in to change notification settings - Fork 506
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
Conversation
source/merge.d.ts
Outdated
@@ -1,5 +1,9 @@ | |||
import {Except} from './except'; | |||
|
|||
type ImproveIntersectionHoverReadabilityShallow<T> = T extends Record<string, unknown> ? { [K in keyof T]: T[K] } : T; |
There was a problem hiding this comment.
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
@mmkal Do you know of any way to test this? To ensure it doesn't regress in the future. |
This is blocked by https://github.com/sindresorhus/type-fest/pull/157/files#diff-520a63fe400b4b92fa3ccc14cabc1d84153987354c3f242deddfaeff0a7deae2, which introduces such a type. |
@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. |
@papb Can you update to use https://github.com/sindresorhus/type-fest/blob/master/source/simplify.d.ts ? |
Consider this example:
Before this PR:
After this PR: