Skip to content

TypeScript types in pug templates get not removed #18

@sschneider-ihre-pvs

Description

@sschneider-ihre-pvs

Describe the bug

Having something like

:filter-by="[keyName as string ?? 'key', valueName as string ?? 'value']"

in a pug template is fine with volar, but vite doesn't seem to expect that kind of thing and compiles it to js as is

"filter-by": [$props.keyName as string ?? 'key', $props.valueName as string ?? 'value'],

which leads to some cryptic error messages like

SyntaxError: missing ] after element list 

Reproduction

Hello World

System Info

System: OS: Windows 10 10.0.19042 CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz Memory: 1.32 GB / 15.75 GB Binaries: Node: 16.14.2 Yarn: 1.22.4 npm: 8.5.0 Browsers: Edge: Spartan (44.19041.1023.0), Chromium (98.0.1108.62) Internet Explorer: 11.0.19041.1 npmPackages: @vitejs/plugin-vue: ^2.3.1 => 2.3.1

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-nice-to-have 🍰Not breaking anything but nice to have (priority)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions