gcanti / docs-ts

A zero-config documentation tool for my TypeScript projects
https://gcanti.github.io/docs-ts/
MIT License
101 stars 17 forks source link

[discussion] Why use ts-morph over tsc? #27

Open waynevanson opened 3 years ago

waynevanson commented 3 years ago

I've hit a bug in the parser, where ts-morph throws TypeError: Cannot read property 'flags' of undefined. I'm unsure why this is the case in my project in particular, but it's not an usually using something like export * as namespace from './file' results in some errors.

I make the assumption that because ts-morph is just a wrapper around the typescript compiler, that ts-morph hasn't been coded to handle newer syntax. If we used the original typescript compiler, we're less likely to get an issue like this. If we do, it'll be easier to fix as it'd be a problem with our code, not the compiler's code.

Why use ts-morph over tsc? Do we gain any benefits using one over the other?

waynevanson commented 3 years ago

I did some debugging and the bug is in ts-morph when it calls typescript, so the error I have is from ts-morph.

IMax153 commented 3 years ago

Hey @waynevanson! I would definitely be open to exploring the use of the typescript compiler directly as opposed to ts-morph.

I ran into quite a few bugs when working on adding in support for a configuration file that were directly related to ts-morph, so I am definitely in favor of seeing if it can be replaced with the typescript compiler directly.

I will experiment with this and get back to you, but please also feel free to post anything that you find here as well!

waynevanson commented 3 years ago

I'll give it a go too! :)