-
Notifications
You must be signed in to change notification settings - Fork 266
Labels
bugSomething isn't workingSomething isn't working
Description
Issue Category
Compilation Bug
Bug Description
While working on #812, I found a related compiler bug. TypeScript type arguments in class extends clauses are leaking into JavaScript output for .ripple files. For example, class StringMap extends Map<string, string> {} is emitted with <string, string> still present, which produces invalid JavaScript and causes a browser syntax error like Unexpected token '<'.
Reproduction Steps
- Create a
.ripplefile with a class that uses type arguments in anextendsclause:
export class StringMap extends Map<string, string> {
constructor() {
super();
}
}
export component App() {
const map = new StringMap();
map.set('hello', 'world');
<div>{map.get('hello')}</div>
}
- Compile or run the file in the Ripple playground or in a Vite app using published ripple@0.3.3.
- Inspect the generated client output.
- Notice that the emitted JS still contains:export class StringMap extends Map<string, string> {
- Open the app in the browser and observe the syntax error:
Uncaught SyntaxError: Unexpected token '<'
Playground Repro
Repository:
- https://github.com/RazinShafayet2007/ripple-type-args-repro
Run locally:
git clone https://github.com/RazinShafayet2007/ripple-type-args-repro.git
cd ripple-type-args-repro
pnpm install
pnpm check:compiled
pnpm dev
Then:
- inspect the compiled output from pnpm check:compiled
- open the dev server in the browser
- observe the Unexpected token '<' error in the console
Environment
- OS: [Ubuntu 22.04.5 LTS]
- Browser: [Chrome 142.0.7444.134]
- Ripple Version: [0.3.3]
- Node Version: [22.17.1]Additional Context
I found this while working on #812, which was another case of TypeScript-only class syntax leaking into emitted JavaScript for .ripple files. This looks like a related compiler emit bug, but for type arguments in class extends clauses instead of implements.
Checklist
- I've searched for existing issues
- I'm willing to help implement a fix
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working