You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there 👋 , by way of introduction, I help maintain rollup-plugin-typescript2, which is a popular TS Rollup plugin and uses the LanguageService API under-the-hood. As such this is more a LanguageService API / Compiler API internal bug, not necessarily a user-facing one.
(I also previously maintained TSDX, contribute to TypeScript-Website a bunch, tsconfig/bases, etc -- but somehow this is my first issue and PR in TS itself, so hello!)
Per ezolenko/rollup-plugin-typescript2#321 (comment), I had a unit test for our Language Service Host implementation, and it uses getDefaultLibFilePath to implement getDefaultLibFileName, same as shown in the Wiki docs for the Compiler API.
Instead of returning a path with either Windows or Linux path separators, it ended up returning a path with both:
This only occurs on Windows, tests pass on Ubuntu and Mac.
Possibly worth noting, the rest of the test suite passes, this is the only thing that was failing and that I could not fix on my end, as it's actually due to a bug in TS itself, which I totally did not expect (as the amount of time I spent debugging shows).
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
Quick summary:
Hi there 👋 , by way of introduction, I help maintain
rollup-plugin-typescript2
, which is a popular TS Rollup plugin and uses theLanguageService
API under-the-hood. As such this is more aLanguageService
API / Compiler API internal bug, not necessarily a user-facing one.(I also previously maintained TSDX, contribute to
TypeScript-Website
a bunch,tsconfig/bases
, etc -- but somehow this is my first issue and PR in TS itself, so hello!)I was finishing up a unit test suite in ezolenko/rollup-plugin-typescript2#321 when I discovered that
getDefaultLibFilePath
behaves a bit wacky (ezolenko/rollup-plugin-typescript2#321 (comment)) on Windows.Spent a couple hours debugging before checking the TS codebase (I totally did not expect a bug in the TS codebase) and quickly found the issue here.
🔎 Search Terms
getDefaultLibFilePath
andgetDefaultLibFileName
(due to #35318)🕗 Version & Regression Information
getDefaultLibFilePath
This code appears to be at least ~7 years old according to the
blame
.⏯ Playground Link
Playground link with relevant code
This doesn't seem to output anything in the Playground, and as it only occurs on Windows, I'm not sure that a browser will pick it up anyway.
Per my summary above, can see ezolenko/rollup-plugin-typescript2#321 (comment) for a reproduction and I already found the bug in the code here on this line
💻 Code
🙁 Actual behavior
Per ezolenko/rollup-plugin-typescript2#321 (comment), I had a unit test for our Language Service Host implementation, and it uses
getDefaultLibFilePath
to implementgetDefaultLibFileName
, same as shown in the Wiki docs for the Compiler API.Instead of returning a path with either Windows or Linux path separators, it ended up returning a path with both:
This only occurs on Windows, tests pass on Ubuntu and Mac.
Possibly worth noting, the rest of the test suite passes, this is the only thing that was failing and that I could not fix on my end, as it's actually due to a bug in TS itself, which I totally did not expect (as the amount of time I spent debugging shows).
🙂 Expected behavior
Since TS represents paths with forward slash (
/
) internally, I imagine this should output:Instead of back-slashes (
\\
), or worse, mixed path separators, as occurred here.Can see my PR #49051 for a quick fix for this
The text was updated successfully, but these errors were encountered: