Skip to content

Commit ed2b709

Browse files
authored
Fix crash in {#await} on ts (#33)
1 parent e657caf commit ed2b709

File tree

6 files changed

+8651
-1
lines changed

6 files changed

+8651
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
},
3737
"homepage": "https://github.com/ota-meshi/svelte-eslint-parser#readme",
3838
"dependencies": {
39+
"eslint-scope": "^5.1.1",
3940
"eslint-visitor-keys": "^2.0.0",
4041
"espree": "^7.3.1",
4142
"lodash": "^4.17.20"

src/context/script-let.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ export class ScriptLetContext {
360360
range,
361361
})
362362
if (this.ctx.isTypeScript()) {
363-
source += ` as (${typings![index]})`
363+
source += ` : (${typings![index]})`
364364
}
365365
}
366366
const restore = this.appendScript(
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script lang="ts">
2+
let promise:Promise<{a:number}> = new Promise((resolve)=>resolve({a:42}));
3+
</script>
4+
5+
{#await promise}
6+
<p>...waiting</p>
7+
{:then number}
8+
<p>The number is {number.a}</p>
9+
{:catch error}
10+
<p style="color: red">{error.message}</p>
11+
{/await}

0 commit comments

Comments
 (0)