vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
https://vuejs.org/
MIT License
47.36k stars 8.28k forks source link

props typings regression in v3.5.0-alpha.1 #10842

Closed cexbrayat closed 5 months ago

cexbrayat commented 5 months ago

Vue version

3.5.0-alpha.1

Link to minimal reproduction

https://play.vuejs.org/#eNqNkk1PGzEQhv+K5QsXYpdCe4jSirbKoZUKCDhaQtbukBj8Jc/sEinKf2d2N4QNX+Jmzzvv+H1mdy1/5azaBuRUzrAqLpNAoCb/NNGFnAqJtZiXksp/QLQLEBtxW1IQBy3ApLXe1ZbgwMSZHtzs4wtByJ4Fvgkx2/NHG+CHkdkiPqRSGykqz2cuQdfGd82umR6NkIdyyDIJNqs7TJHTrrvRZiugkVPRV7raKfPoGlpKyePEZtepRi6JMk61rurIQ2rwri0qAumYg37Dc/g0b4z6iVHj9tMTdfRVfde1Q9oTFGBgq5HdIxsTNwxJWKV46xYvEKsUsvNQzjO5FPdRrffp4V9fo9LALnK1hOr+jfodrgaCiwIIpWWenUa2LIAGeX51Bis+78SQ6sZv6d8RLwGTb7qMQ9vvJtYce9TXp/3bfzEXF9c4XxFEfILqgvbb6Pt57Q38+QAdqbiKrre/yWvUZ5xjdTLa8k0LpXuTF3ysvqkvE+vz0qojuXkE5l0Fxw==

Steps to reproduce

Using a component from an external library like vee-validate throws compilation errors with strictTemplates enabled, as the props type is always inferred to be never.

This may be an issue with vue-tsc or vee-validate itself, but it's only happening with Vue v3.5.

<script setup>
import { ErrorMessage } from 'vee-validate'
</script>

<template>
  <ErrorMessage name="password" class="error" />
</template>

What is expected?

Should compile.

What is actually happening?

Throws with:

error TS2345: Argument of type '{ name: string; class: string; }' is not assignable to parameter of type 'never'.

21       <ErrorMessage name="password" class="error" />

System Info

System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 2.02 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.1 - ~/.volta/tools/image/node/18.20.1/bin/node
    Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
    npm: 9.7.1 - ~/.volta/tools/image/npm/9.7.1/bin/npm
    pnpm: 9.0.6 - ~/.volta/bin/pnpm
  Browsers:
    Chrome: 124.0.6367.91
    Safari: 17.4.1
  npmPackages:
    vue: 3.5.0-alpha.1 => 3.5.0-alpha.1

Any additional comments?

This does not happen with v3.4 (as you can see in the playground repro)

yyx990803 commented 5 months ago

closed via c146186