Skip to content

[Bug]: TypeScript type arguments in class extends are not stripped from .ripple JS output #813

@RazinShafayet2007

Description

@RazinShafayet2007

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

  1. Create a .ripple file with a class that uses type arguments in an extends clause:
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>
}
  1. Compile or run the file in the Ripple playground or in a Vite app using published ripple@0.3.3.
  2. Inspect the generated client output.
  3. Notice that the emitted JS still contains:export class StringMap extends Map<string, string> {
  4. Open the app in the browser and observe the syntax error:
    Uncaught SyntaxError: Unexpected token '<'

Playground Repro

Repository:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions