Skip to content

Unexpected error: Declaration or statement expected #1097

@ebeloded

Description

@ebeloded

Describe the bug
Svelte-check reports an error for the following code:

<script lang="ts">
import { readable } from 'svelte/store'
const uid = readable('')
const getWorkspaces = (uid: string) => readable([uid])

$: workspaces = getWorkspaces($uid)// Error: "Declaration or statement expected"

$: console.log({ workspaces: $workspaces })
</script>

This is a regression introduced in svelte-check 2.2 as it doesn't appear with svelte-check 2.1.
Adding a semicolon at the end of the line hides the issue:

$: workspaces = getWorkspaces($uid); // with semicolon error goes away

Screenshots
image

System (please complete the following information):

  • OS: [Mac OS]
  • IDE: [VSCode]
  • Plugin/Package: ["Svelte for VSCode", svelte-check]

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions