sindresorhus / type-fest

A collection of essential TypeScript types
Creative Commons Zero v1.0 Universal
14.06k stars 532 forks source link

Opposite of Simplify? #694

Open bombillazo opened 11 months ago

bombillazo commented 11 months ago

Hello, is there a way to "unsimplify" a type so that it is not spread during some intellisense suggestions? For example

type MyType = {
  a: boolean,
  b: string,
  c: string,
  ...
  z: number,
}

type ParamUnion = MyType | TypeA | TypeBy

// do not expand the type definition of MyType when inspecting ParamUnion!
const myFunc = (param1: ParamUnion) => {
  ...
}

Upvote & Fund

Fund with Polar

electrovir commented 5 months ago

I'm here looking for an opposite to Simplify because I want my interface methods to be preserved as methods rather than getting mapped to member variables when I apply type transforms to them, which then triggers ts(2425) for me.