Skip to content

Cannot use TypeScript type annotations in template #525

@shaozi

Description

@shaozi

Describe the bug
When a function is used in a component props, its parameter cannot have a type. in the following code, x={(d: Point) => d.x} shows an error of:

Unexpected tokensvelte(parse-error)
Unexpected tokents(-1)
<Pancake.SvgLine
    data={[...points, { [x]: maxx, [field.key]: 0 }]}
    x={(d: Point) => d.x}
    y={(d) => d.y}
    let:d
    >
       <path class="data" {d} />
</Pancake.SvgLine>

Logs
Please include browser console and server logs around the time this bug occurred.

To Reproduce

  1. create a brand new svelte ts project.
  2. use a function in a prop and add a type to the parameter.
  3. See the error

Version
svelte-preprocess version (Please check you can reproduce the issue with the latest release!)

latest 4.10.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions