Skip to content

defineModel coerces string to boolean in production build when string | boolean union is used #10676

Closed
@zigomir

Description

@zigomir

Vue version

3.4.21

Link to minimal reproduction

https://play.vuejs.org/#eNqFkslu3DAMhl+F1cUJMLbR5TRwBuiSQwu0CdKiJwG1Y9MTpbKkanGncP3uoWzPZBBkuVH8uXwiObD3xmR9QLZmhautMB4c+mBAVmp7xpl3nG24Ep3R1sMAFlsYobW6g4TSkoP0UXdm8Wd5fMSqJHNVa+U89HAWk0+S5BTyHJy3Qm2jh6sinztTH3p47IysPNILoJjK9mmnG5SE03MGOSlFfhTGVoRJXVqxzW6dVvSXISZzVlO2kGgvjBdEwdkaJiVqlZT675fJ523A1d5f32D9+xH/rdtFH2eXFh3aHjk7aL6yW/SzfP79G+7IPojEHiRFPyNeodMyRMY57ENQDWEfxU20n6dR09x+uPOdR+X2n4qgMXKc4mlMAePgnvr6Pe7b7N2Ux9VIU9yv7YVjWBZayYC01AZbofBrXFCxbPU/XGstsVKbk3gxf4Kw2MyUMJ4+v/BG9JNB5qs0hdkESJd+PljlQCivoYz1SrKhvLy6+FRCPJL7eIudphzQLZQHoHI+0fIIukwc+H8GV9CKHZJ9g2CsvpbYzcXSdAH6GQnWUBiLm2FYgMaxyKNjgs9n+ofX+atHG3dFc6WBZ29es/EO0+omHA==

Steps to reproduce

Make sure to first click on Comp.vue tab to render it first (dunno why this is needed, but it is).
Click on Dev to flip it to Prod in the top nav and see Value: turns to Value: true.

What is expected?

Dev and prod mode should work the same, keeping model value a string.

In other words, type annotation shouldn't coerce model's value.

What is actually happening?

Model turns to boolean in prod mode.

System Info

No response

Any additional comments?

Sorry if this has been reported, I couldn't easily find an issue if it was.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions