Skip to content

Commit f9137c4

Browse files
authored
fix: print superTypeParameters (#103)
1 parent eca363b commit f9137c4

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

.changeset/itchy-impalas-itch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'esrap': patch
3+
---
4+
5+
fix: print `superTypeParameters`

src/languages/ts/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,13 @@ export default (options = {}) => {
566566
if (node.superClass) {
567567
context.write('extends ');
568568
context.visit(node.superClass);
569+
570+
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
571+
var type_arguments = node.superTypeParameters ?? node.superTypeArguments;
572+
if (type_arguments) {
573+
context.visit(type_arguments);
574+
}
575+
569576
context.write(' ');
570577
}
571578

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class Foo extends Bar<X> {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 3,
3+
"names": [],
4+
"sources": [
5+
"input.js"
6+
],
7+
"sourcesContent": [
8+
"class Foo extends Bar<X> {}\n"
9+
],
10+
"mappings": "MAAM,GAAG,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC,AAAA,CAAC"
11+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class Foo extends Bar<X> {}

0 commit comments

Comments
 (0)