Avoid shipping raw .ts
to node_modules
#1891
Replies: 3 comments 4 replies
-
Adding a link to #983 for reference, but I think it's fine to keep this discussion opened too as it adds a lot of information, e.g. I was personally not aware of this "Problems" tab in VSCode. |
Beta Was this translation helpful? Give feedback.
-
Shipping JS and d.ts should not be too difficult. We would still ship the original TS files in the package since that is needed for stack traces to provide the original position and allow debuggers to step through the original code instead of the transpiled code. @delucis what barriers would those be? The packages I have that include both Astro components and TS files have been working fine and are distributed transpiled. Some Starlight-specific blocker? |
Beta Was this translation helpful? Give feedback.
-
Shouldn't it be solved by ignoring node modules? Something like this:
|
Beta Was this translation helpful? Give feedback.
-
What version of
starlight
are you using?0.23.0
What is your idea?
Currently, Starlight publishes raw
.ts
source to npm.This would replace those with class
.d.ts
and.js
.Why is this feature necessary?
Currently, I cannot edit my docs without getting a large number of extraneous errors that get pulled into my editor:
That behavior may be incorrect in terms of the TS LSP + editor integration since it does not occur when running
tsc
directly asnode_modules
is excluded, but this is just one of many problems that shipping raw.ts
source causes.It is impossible to guarantee your source will be compatible with user tsconfigs, and these errors can manifest in all sorts of obnoxious ways as I've encountered myself dealing with many reports of problems when I tried shipping
.ts
alongside my.d.ts
in ArkType.Hopefully this will be viable soon, but for now, due to fragility and performance issues, shipping
.ts
source should be avoided.In a Discord discussion, @delucis mentioned there were some barriers around integrating
.d.ts
with.astro
files. It would be a huge ROI for me and I'd expect many others to not be constantly contending with related issues, and very quickly for maintainers as well to avoid a deluge of tsconfig-related issues your growing userbase will encounter.Do you have examples of this feature in other projects?
Most projects do not ship raw
.ts
.I've created a well-optimized build + dev config in ArkType's monorepo if that is helpful to refer to, though I suspect most of the challenge will be in the
.astro
integration which I know nothing about. Hoping it's not too thorny 🙏Participation
Beta Was this translation helpful? Give feedback.
All reactions