type-fest icon indicating copy to clipboard operation
type-fest copied to clipboard

Improve `Simplify` type?

Open sindresorhus opened this issue 3 years ago • 4 comments

I think https://github.com/sindresorhus/type-fest/pull/157/files#diff-520a63fe400b4b92fa3ccc14cabc1d84153987354c3f242deddfaeff0a7deae2 could be useful for others too.

  • [ ] Should it also support array like in https://gist.github.com/ClickerMonkey/a081b990b9b14215141fb6248cef4dc4#file-types-ts-L49-L54 ?
  • [ ] Any other of our types that could benefit from it?
  • [ ] How can we test it? https://github.com/sindresorhus/type-fest/pull/170#issuecomment-745835564

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

sindresorhus avatar Dec 16 '20 08:12 sindresorhus

Is the question here whether or not type-fest should export Simplify? I found this type and was hoping it was exported, since we have components that compose their props as below, and being able to flatten them for the editor would be really useful:

type Props = PropTypes.Position & PropTypes.Animation & {
    componentSpecificProp: string,
    ...,
};

Even in its current state of only accepting object types it would be super useful, so I don't think exporting it should be dependent on adding more functionality.

ianobermiller avatar Jul 29 '21 14:07 ianobermiller

The questions are not blocking. Anyone are free to submit a PR to expose it. 👍

sindresorhus avatar Jul 29 '21 14:07 sindresorhus

Should it also support array like in https://gist.github.com/ClickerMonkey/a081b990b9b14215141fb6248cef4dc4#file-types-ts-L49-L54 ?

If there are no downsides from it, then I think it makes sense 👍 Though maybe await a use case in our code or a request for it? Else we may not even discover if it breaks eventually.

How can we test it?

We would probably have to go some odd route for this, like maybe pull out the language server itself and inspect the output?

voxpelli avatar Sep 22 '21 21:09 voxpelli