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

Unable to support TS 5.0 tsconfig extends array #6918

Closed
1 task
unional opened this issue Apr 27, 2023 · 7 comments · Fixed by #8798
Closed
1 task

Unable to support TS 5.0 tsconfig extends array #6918

unional opened this issue Apr 27, 2023 · 7 comments · Fixed by #8798
Assignees
Labels
- P2: nice to have Not breaking anything but nice to have (priority) feat: typescript Related to TypeScript (scope)

Comments

@unional
Copy link

unional commented Apr 27, 2023

What version of astro are you using?

2.3.1

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Windows

What browser are you using?

Chrome

Describe the Bug

tsconfig-resolver does not support extends with array, which is a feature in TypeScript 5.0

// tsconfig.json
{
  "extends: ["astro/tsconfigs/strict", "another-config"]
}

It errors with:

The "path" argument must be of type string. Received an instance of Array

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-3dbiun?file=tsconfig.json

Participation

  • I am willing to submit a pull request for this issue.
@bluwy
Copy link
Member

bluwy commented Apr 27, 2023

Not sure if there's anything we can do since it needs to be supported by https://github.com/ifiokjr/tsconfig-resolver, which doesn't seem to have recent activity. Another option is to use https://github.com/dominikg/tsconfck or https://github.com/aleclarson/vite-tsconfig-paths

@Princesseuh
Copy link
Member

We should probably migrate to tsconfck anyway, tsconfig-resolver is unmaintained and has some issues we needed workaround for in the past

@bluwy bluwy added - P2: nice to have Not breaking anything but nice to have (priority) feat: typescript Related to TypeScript (scope) labels Apr 27, 2023
@Princesseuh Princesseuh self-assigned this May 12, 2023
@Princesseuh
Copy link
Member

Blocked by dominikg/tsconfck#87, I started working on a PR for it in this fork, but since this is kinda low priority for us, I'll circle back to it later unless someone is interested in tackling it.

@MichaelDeBoey
Copy link

@Princesseuh I would be interested to get your jsconfig.json support merged into tsfonck for the reasons mentioned in dominikg/tsconfck#87 👀

@firxworx
Copy link

After having wasted a chunk of time on an obtuse error where I could get Nx + Astro 3 to build on my workstation and not with Dockerfile and finally tracing it to this... My issue: I extended multiple tsconfigs (!!)

I haven't checked but it sort of smells to me like there might be a bit of "find an npm package for anything and everything" at play with that one where dependencies get created on a single maintainer packages that appear abandoned to save a few lines of code.

Taking a peek at tsconfig-resolver's source (https://www.npmjs.com/package/tsconfig-resolver?activeTab=code), it seems like a good chunk of tsconfig-resolver effectively duplicates what Astro already has in its own codebase as a core part of its functionality plus in existing Astro packages I already see other deps on well-used libraries like fast-glob etc.

Perhaps this sort of thing could be more standardized between the official plugins.

https://www.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2Ftfugj4n3l6ez.png
(the classic Heaviest Objects In The Universe meme re node_modules) :D

@Princesseuh
Copy link
Member

After having wasted a chunk of time on an obtuse error where I could get Nx + Astro 3 to build on my workstation and not with Dockerfile and finally tracing it to this... My issue: I extended multiple tsconfigs (!!)

I haven't checked but it sort of smells to me like there might be a bit of "find an npm package for anything and everything" at play with that one where dependencies get created on a single maintainer packages that appear abandoned to save a few lines of code.

Taking a peek at tsconfig-resolver's source (https://www.npmjs.com/package/tsconfig-resolver?activeTab=code), it seems like a good chunk of tsconfig-resolver effectively duplicates what Astro already has in its own codebase as a core part of its functionality plus in existing Astro packages I already see other deps on well-used libraries like fast-glob etc.

Perhaps this sort of thing could be more standardized between the official plugins.

https://www.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2Ftfugj4n3l6ez.png
(the classic Heaviest Objects In The Universe meme re node_modules) :D

I wish it was the case, but resolving and parsing js/tsconfig.json fully is actually not that easy 😅 The logic around extends especially is a bit tricky since it's a custom Node-like resolution specific to TypeScript

There's a reason every framework tend to use a library / depend on TypeScript's native methods for that. If you don't implement it to the T, you risk having a different understanding of the TypeScript config in different contexts.

@Princesseuh Princesseuh self-assigned this Oct 1, 2023
@so1ve
Copy link
Contributor

so1ve commented Oct 2, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority) feat: typescript Related to TypeScript (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants