-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2444 #2417 #2425 #2385 (comment) The snippet is now transformed into a function with the return type so that The default parameter type can be inferred: `const foo = (a: string, b = 1): ReturnType<import('svelte').Snippet> => {}`
- Loading branch information
1 parent
4a9ef5e
commit 0f7bd88
Showing
25 changed files
with
368 additions
and
90 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
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
7 changes: 7 additions & 0 deletions
7
...plugins/typescript/features/diagnostics/fixtures/implicit-snippet.v5/SnippetParent.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,7 @@ | ||
<script lang="ts"> | ||
let { foo }: { | ||
foo: import('svelte').Snippet<[a: '']> | ||
children?: import('svelte').Snippet | ||
required: import('svelte').Snippet | ||
} = $props(); | ||
</script> |
18 changes: 18 additions & 0 deletions
18
...test/plugins/typescript/features/diagnostics/fixtures/implicit-snippet.v5/expectedv2.json
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,18 @@ | ||
[ | ||
{ | ||
"range": { "start": { "line": 4, "character": 1 }, "end": { "line": 4, "character": 14 } }, | ||
"severity": 1, | ||
"source": "ts", | ||
"message": "Property 'required' is missing in type '{ children: () => any; foo: (this: void, a: \"\") => any; }' but required in type '$$ComponentProps'.", | ||
"code": 2741, | ||
"tags": [] | ||
}, | ||
{ | ||
"range": { "start": { "line": 6, "character": 9 }, "end": { "line": 6, "character": 18 } }, | ||
"severity": 1, | ||
"source": "ts", | ||
"message": "This comparison appears to be unintentional because the types '\"\"' and '\"b\"' have no overlap.", | ||
"code": 2367, | ||
"tags": [] | ||
} | ||
] |
11 changes: 11 additions & 0 deletions
11
...er/test/plugins/typescript/features/diagnostics/fixtures/implicit-snippet.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,11 @@ | ||
<script lang="ts"> | ||
import SnippetParent from "./SnippetParent.svelte"; | ||
</script> | ||
|
||
<SnippetParent> | ||
{#snippet foo(a)} | ||
{a === 'b'} | ||
{/snippet} | ||
|
||
{@render foo('')} | ||
</SnippetParent> |
24 changes: 24 additions & 0 deletions
24
...erver/test/plugins/typescript/features/diagnostics/fixtures/snippet-js.v5/expectedv2.json
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,24 @@ | ||
[ | ||
{ | ||
"range": { | ||
"start": { "line": 10, "character": 9 }, | ||
"end": { "line": 10, "character": 18 } | ||
}, | ||
"severity": 1, | ||
"source": "js", | ||
"message": "This comparison appears to be unintentional because the types 'number' and 'string' have no overlap.", | ||
"code": 2367, | ||
"tags": [] | ||
}, | ||
{ | ||
"range": { | ||
"start": { "line": 16, "character": 12 }, | ||
"end": { "line": 16, "character": 15 } | ||
}, | ||
"severity": 1, | ||
"source": "js", | ||
"message": "Argument of type '\"c\"' is not assignable to parameter of type 'TypeA'.", | ||
"code": 2345, | ||
"tags": [] | ||
} | ||
] |
17 changes: 17 additions & 0 deletions
17
...e-server/test/plugins/typescript/features/diagnostics/fixtures/snippet-js.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,17 @@ | ||
<script> | ||
// @ts-check | ||
/** | ||
* @typedef {'a' | 'b'} TypeA | ||
*/ | ||
</script> | ||
|
||
<!--no error--> | ||
{#snippet hi(/**@type {TypeA}*/a, b = 2)} | ||
{a} | ||
{#if b === 'a'} | ||
{b} | ||
{/if} | ||
{/snippet} | ||
|
||
<!--error--> | ||
{@render hi('c', 'd')} |
13 changes: 13 additions & 0 deletions
13
...er/test/plugins/typescript/features/diagnostics/fixtures/snippet-scope.v5/expectedv2.json
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,13 @@ | ||
[ | ||
{ | ||
"range": { | ||
"start": { "line": 15, "character": 9 }, | ||
"end": { "line": 15, "character": 16 } | ||
}, | ||
"severity": 1, | ||
"source": "ts", | ||
"message": "Cannot find name 'nested1'.", | ||
"code": 2304, | ||
"tags": [] | ||
} | ||
] |
16 changes: 16 additions & 0 deletions
16
...erver/test/plugins/typescript/features/diagnostics/fixtures/snippet-scope.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,16 @@ | ||
<script lang="ts"> | ||
// no error | ||
top | ||
</script> | ||
|
||
<!--no error--> | ||
<div> | ||
<!-- {@render nested1()} --> | ||
{#snippet nested1()}{/snippet} | ||
{@render nested1()} | ||
</div> | ||
|
||
{#snippet top()}{/snippet} | ||
|
||
<!--error--> | ||
{@render nested1()} |
20 changes: 20 additions & 0 deletions
20
...ge-server/test/plugins/typescript/features/inlayHints/fixtures/snippet.v5/expectedv2.json
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,20 @@ | ||
[ | ||
{ | ||
"label": [ | ||
{ | ||
"value": "a", | ||
"location": { | ||
"range": { | ||
"start": { "line": 0, "character": 14 }, | ||
"end": { "line": 0, "character": 15 } | ||
}, | ||
"uri": "<workspaceUri>/snippet.v5/input.svelte" | ||
} | ||
}, | ||
{ "value": ":" } | ||
], | ||
"position": { "line": 4, "character": 13 }, | ||
"kind": 2, | ||
"paddingRight": true | ||
} | ||
] |
5 changes: 5 additions & 0 deletions
5
...guage-server/test/plugins/typescript/features/inlayHints/fixtures/snippet.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,5 @@ | ||
{#snippet hi2(a = 1)} | ||
hello world | ||
{/snippet} | ||
|
||
{@render hi2(1)} |
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
Oops, something went wrong.