gcanti / gcanti/docs-ts

[discussion] Why use ts-morph over tsc?

Open
#27 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
105
Forks
18
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Read the parser implementation that currently uses ts-morph and review the reported `export * as namespace from './file'` failure. Compare the project's use of ts-morph with the TypeScript compiler API, then determine whether a concrete migration or parser fix is wanted; done requires a decided direction and an agreed scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.