Skip to content

Commit

Permalink
feat: update type of $props rune (#510)
Browse files Browse the repository at this point in the history
Co-authored-by: Yosuke Ota <[email protected]>
  • Loading branch information
baseballyama and ota-meshi authored Apr 22, 2024
1 parent 04cf54c commit 9dddc36
Show file tree
Hide file tree
Showing 31 changed files with 5,911 additions and 6,041 deletions.
5 changes: 5 additions & 0 deletions .changeset/smooth-elephants-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte-eslint-parser": patch
---

feat: update type of $props rune
7 changes: 5 additions & 2 deletions explorer-v2/src/lib/MonacoEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,13 @@
{#await loading}
{#if started}
<div class="eslint-editor-monaco-root eslint-editor-monaco-root--wait" in:loadingTypewriter />
<div
class="eslint-editor-monaco-root eslint-editor-monaco-root--wait"
in:loadingTypewriter
></div>
{/if}
{:then}
<div bind:this={rootElement} class="eslint-editor-monaco-root" />
<div bind:this={rootElement} class="eslint-editor-monaco-root"></div>
{/await}
<style>
Expand Down
2 changes: 1 addition & 1 deletion explorer-v2/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
position: relative;
height: calc(100vh - 64px);
}
.main > * {
.main > :global(*) {
position: relative;
width: 100%;
height: 100%;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"version:ci": "env-cmd -e version-ci pnpm run build:meta && changeset version"
},
"peerDependencies": {
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.94"
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.112"
},
"peerDependenciesMeta": {
"svelte": {
Expand Down Expand Up @@ -105,7 +105,7 @@
"prettier-plugin-svelte": "^3.2.2",
"rimraf": "^5.0.5",
"semver": "^7.6.0",
"svelte": "^5.0.0-next.94",
"svelte": "^5.0.0-next.112",
"svelte2tsx": "^0.7.6",
"typescript": "~5.4.4",
"typescript-eslint-parser-for-extra-files": "^0.6.0"
Expand Down
2 changes: 1 addition & 1 deletion src/parser/converts/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export function* convertChildren(
continue;
}

throw new Error(`Unknown type:${(child as any).type}`);
throw new Error(`Unknown type:${child.type}`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/parser/typescript/analyze/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function analyzeRuneVariables(
}
// See https://github.com/sveltejs/svelte/blob/dfc55c18f010f620b966e13eb0ad1f9791b5798f/packages/svelte/types/index.d.ts#L2655
case "$props": {
appendDeclareFunctionVirtualScripts(globalName, ["<T>(): T"]);
appendDeclareFunctionVirtualScripts(globalName, ["(): any"]);
break;
}
// See https://github.com/sveltejs/svelte/blob/dfc55c18f010f620b966e13eb0ad1f9791b5798f/packages/svelte/types/index.d.ts#L2666
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts">
type MyProps = {}
let { a, b, c, ...everythingElse } = $props<MyProps>();
type MyProps = {};
let { a, b, c, ...everythingElse }: MyProps = $props();
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
"ruleId": "no-unused-vars",
"code": "a",
"line": 3,
"column": 11
"column": 9
},
{
"ruleId": "no-unused-vars",
"code": "b",
"line": 3,
"column": 14
"column": 12
},
{
"ruleId": "no-unused-vars",
"code": "c",
"line": 3,
"column": 17
"column": 15
},
{
"ruleId": "no-unused-vars",
"code": "everythingElse",
"line": 3,
"column": 23
"column": 21
}
]
Loading

0 comments on commit 9dddc36

Please sign in to comment.