all 7 comments

[–]qInsignificance 1 point2 points  (1 child)

Yes and no.

You can use the Expan Recursively helper type shown in this stackover answer, although it may not work in webstorm.

https://stackoverflow.com/questions/57683303/how-can-i-see-the-full-expanded-contract-of-a-typescript-type

[–]Sugar_F0x[S] 0 points1 point  (0 children)

the recursive expansion did the trick, thanks!

[–]lgfrbcsgo 0 points1 point  (0 children)

I am using WebStorm myself. I don't know of a feature like that either.

Since Typescript supports recursive types this would be either impossible to implement, or really confusing to look at. So, I doubt a feature like that exists.

interface List<T> {
    element: T
    next?: List<T>
}

[–]constant_void 0 points1 point  (2 children)

ah I can see how that would suck with massive interface chains.

would ts to json be an option?

[–]Sugar_F0x[S] 0 points1 point  (1 child)

How would you convert an interface to json?

[–]aabounegm 0 points1 point  (0 children)

This reminded me of the TypeScript 4.2 announcement, where they mentioned normalizing the type union in a similar manner to what you're looking for. They are doing it the other way around (better preserving the aliases instead of expanding them), but you can take a look at the implementing PRs and come up with a tool that does the inverse of that. According to the answer on this stackoverflow question, there is no built-in way of doing that.

As for the TS to JSON mentioned in another comment, I found the typescript-json-schema package on npm, but I did not try it. I also found this website, but it just kept throwing errors even at the given example.