-
-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support
generics
attribute for JSDoc (#2624)
- Loading branch information
1 parent
3f2da5d
commit 646f2e6
Showing
8 changed files
with
74 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/svelte2tsx/test/svelte2tsx/samples/generics-attribute.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
///<reference types="svelte" /> | ||
;function render</*Ωignore_startΩ*/A, B extends keyof A, C extends boolean>/*Ωignore_endΩ*/() { | ||
|
||
/** @typedef {{ a: A; b: B; c: C }} $$ComponentProps *//** @type {$$ComponentProps} */ | ||
const { a, b, c } = $props(); | ||
|
||
function getA() { | ||
return a; | ||
} | ||
; | ||
async () => {}; | ||
return { props: /** @type {$$ComponentProps} */({}), exports: /** @type {{getA: typeof getA}} */ ({}), bindings: __sveltets_$$bindings(''), slots: {}, events: {} }} | ||
class __sveltets_Render<A,B extends keyof A,C extends boolean> { | ||
props(): ReturnType<typeof render<A,B,C>>['props'] { return null as any; } | ||
events(): ReturnType<typeof render<A,B,C>>['events'] { return null as any; } | ||
slots(): ReturnType<typeof render<A,B,C>>['slots'] { return null as any; } | ||
bindings() { return __sveltets_$$bindings(''); } | ||
exports() { return render<A,B,C>().exports; } | ||
} | ||
|
||
interface $$IsomorphicComponent { | ||
new <A,B extends keyof A,C extends boolean>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<A,B,C>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<A,B,C>['props']>, ReturnType<__sveltets_Render<A,B,C>['events']>, ReturnType<__sveltets_Render<A,B,C>['slots']>> & { $$bindings?: ReturnType<__sveltets_Render<A,B,C>['bindings']> } & ReturnType<__sveltets_Render<A,B,C>['exports']>; | ||
<A,B extends keyof A,C extends boolean>(internal: unknown, props: ReturnType<__sveltets_Render<A,B,C>['props']> & {}): ReturnType<__sveltets_Render<A,B,C>['exports']>; | ||
z_$$bindings?: ReturnType<__sveltets_Render<any,any,any>['bindings']>; | ||
} | ||
const Input__SvelteComponent_: $$IsomorphicComponent = null as any; | ||
/*Ωignore_startΩ*/type Input__SvelteComponent_<A,B extends keyof A,C extends boolean> = InstanceType<typeof Input__SvelteComponent_<A,B,C>>; | ||
/*Ωignore_endΩ*/export default Input__SvelteComponent_; |
8 changes: 8 additions & 0 deletions
8
packages/svelte2tsx/test/svelte2tsx/samples/generics-attribute.v5/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script generics="A, B extends keyof A, C extends boolean"> | ||
/** @type {{ a: A; b: B; c: C }} */ | ||
const { a, b, c } = $props(); | ||
export function getA() { | ||
return a; | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.