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
Vitest seems to be generating a bad code transformation when a class field has the same name as an imported variable. This causes the script to fail.
Reproduction
Sorry for the lack of precision in the reproduction here, but I have successfully logged the bad code.
Original (some bits snipped for clarity):
import{clearTimeout,Timeout,timeout}from"@wikijump/util"import{Gesture,GestureObserver,typeDirection}from"./gesture"exportinterfaceSwipeOpts{// - snip -}constSWIPE_DEFAULT_OPTS: SwipeOpts={// - snip -}exportclassSwipeObserver{/** Swipe recognition configuration. */privatedeclareopts: SwipeOpts/** List of valid swipe directions. */privatedeclaredirections: Direction[]/** Internal {@link GestureObserver} used to get gesture information. */privatedeclareobserver: GestureObserver/** The current {@link Gesture}. */privategesture: Gesture|null=null/** The currently running {@link Timeout}. */privatetimeout: Timeout|null=null/** True if the swipe recognition is running. */privaterunning=false/** True if the current swipe gesture is being ignored. */privateended=false/** The element being tracked for gestures. */declaretarget: HTMLElement// - snip -}
Let me know if you need more details than this. I believe this is related to the import name, but if it turns out to be more subtle than this I can get a proper reproduction going.
Describe the bug
Vitest seems to be generating a bad code transformation when a class field has the same name as an imported variable. This causes the script to fail.
Reproduction
Sorry for the lack of precision in the reproduction here, but I have successfully logged the bad code.
Original (some bits snipped for clarity):
Output that causes a script error:
Pretty sure this:
is the problem.
Let me know if you need more details than this. I believe this is related to the import name, but if it turns out to be more subtle than this I can get a proper reproduction going.
System Info
System: OS: Linux 5.15 Pop!_OS 21.10 CPU: (12) x64 AMD Ryzen 5 5500U with Radeon Graphics Memory: 729.74 MB / 15.05 GB Container: Yes Shell: 5.8 - /usr/bin/zsh Binaries: Node: 17.2.0 - /tmp/fnm_multishells/598310_1640396620386/bin/node npm: 8.1.4 - /tmp/fnm_multishells/598310_1640396620386/bin/npm Browsers: Firefox: 95.0.1
Used Package Manager
pnpm
Logs
Validations
The text was updated successfully, but these errors were encountered: