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

Denormalize / Fully resolve a type #1312

Closed
alexpineda opened this issue Aug 12, 2022 · 2 comments
Closed

Denormalize / Fully resolve a type #1312

alexpineda opened this issue Aug 12, 2022 · 2 comments

Comments

@alexpineda
Copy link

I'm exporting little slices of my types to a type definition to be consumed by plugin authors of my software. I'd like these types to be completely denormalized/fully resolved so I don't have to worry about references or other problems (like some files using node libs).

Ideal API;

// ... getSourceFiles etc..
node.getFullyResolvedType();

Which would transform something like:

type A = 1;
type B = A;

to:

type A = 1;
type B = 1;

at which point I can print out node B to a d.t.s file without worrying about type A being visible or worrying about including it (in case of imports).

@lazarljubenovic
Copy link
Contributor

That's not possible in general, e.g. with recursive types. So I doubt there's a pre-made solution for this; you'd have to think about handling these edge cases firstly.

@alexpineda
Copy link
Author

Alright well I haven't solved it yet as I prefer to use the compiler tools rather than re-implementing a lot of logic. Created to #1346 be more specific.

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

No branches or pull requests

2 participants