Skip to content

Commit

Permalink
Add test for expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Feb 7, 2023
1 parent 2112dec commit 98129c4
Show file tree
Hide file tree
Showing 5 changed files with 805 additions and 175 deletions.
2 changes: 1 addition & 1 deletion packages/babel-parser/src/plugins/typescript/index.ts
Expand Up @@ -666,7 +666,7 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>

tsParseConstModifier = this.tsParseModifiers.bind(this, {
allowedModifiers: ["const"],
// for better error recover
// for better error recovery
disallowedModifiers: ["in", "out"],
errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions,
});
Expand Down
Expand Up @@ -4,12 +4,20 @@ function c<T, const U>() {}
declare function d<const T>();
<const T>() => {};
<const T extends U>() => {};
(function <const T>() {});
(function <const T extends U>() {});
(function <T, const U>() {});

class A<const T> {}
class B<const T extends U> {}
class C<T, const U> {}
class D<in const T> {}
class E<const in T> {}
(class <const T> {});
(class <const T extends U> {});
(class <T, const U> {});
(class <in const T> {});
(class <const in T> {});

interface I<const T> {}
interface J<const T extends U> {}
Expand Down

0 comments on commit 98129c4

Please sign in to comment.