Skip to content

Invalid code generated when using double quotes in prop expressions #961

@geigerzaehler

Description

@geigerzaehler

The following Svelte code produces invalid TypeScript code when using svelte-check v1.5.0

<Button on:click={() => null} placeholder={"placeholder value"} />

This is the produced code (from the online REPL)

///<reference types="svelte" />
<></>;function render() {
<><Button  placeholder={"placeholder value"} />{/*Ωignore_startΩ*/new Button({target: __sveltets_any(''), props: {'placeholder':placeholder value}})/*Ωignore_endΩ*/.$on('click', () => null)}
</>
return { props: {}, slots: {}, getters: {}, events: {} }}

export default class extends createSvelte2TsxComponent(__sveltets_partial(__sveltets_with_any_event(render))) {
}

As you can see, the double quotes around "placeholder value" are not preserved and the code becomes invalid. This used to work with svelte-check v1.4.0.

Obviously there’s a workaround and the the code should be written

<Button on:click={() => null} placeholder="placeholder value" />

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