Skip to content

Commit

Permalink
fix: ignore TypeScript generics on variables (#14509)
Browse files Browse the repository at this point in the history
fixes #14505
  • Loading branch information
dummdidumm authored Dec 2, 2024
1 parent aaea254 commit b72fd2b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wild-islands-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: ignore TypeScript generics on variables
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ const visitors = {
}
return context.visit(node.parameter);
},
TSInstantiationExpression(node, context) {
return context.visit(node.expression);
},
FunctionExpression: remove_this_param,
FunctionDeclaration: remove_this_param,
TSDeclareFunction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
console.log(this);
}
class Foo {
class Foo<T> {
public name: string;
x = 'x' as const;
constructor(name: string) {
Expand All @@ -32,6 +32,8 @@
export function overload(c: any): any {}
export type { Hello };
const TypedFoo = Foo<true>;
</script>

<script>
Expand Down

0 comments on commit b72fd2b

Please sign in to comment.