Skip to content

Type inference failure in defineProps when using generic type aliases for function props #13240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Yiximail opened this issue Apr 25, 2025 · 0 comments · May be fixed by #13245
Open

Type inference failure in defineProps when using generic type aliases for function props #13240

Yiximail opened this issue Apr 25, 2025 · 0 comments · May be fixed by #13245
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler scope: sfc

Comments

@Yiximail
Copy link

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNqdU8tu2zAQ/BWCl9hAareSTqqsoI8UaA910PbIiyyvHKYUSZCU48DQv3dJRrGMWDn0InB2ZpdDcnSkn7Re7DugOS0ctFpUDkomCSm2fB8WuPyiWk2WZyhv5IcVo/hl1IMkgCSCNIA0giyADEGcUCzj5GI52g+hrQ3XjlhwnSaikjvsc5ZRZHmrlXEkbNwY1ZKrxdIDb/zqI5O1ktYR9EJWZDYnq5I0lbAwYpJJJp1ksldMsYwm0RK9RnOobPhu8WCVxPs7+tMxWqMxLsCsteM4idGcBMZzlRDq8UeoOdPB9VCv76H+e6H+YA++xuidAQtmD4y+cK4yO3CRvv39Ew64fiFbte0Eqt8gf4FVovMeo+xzJ7doe6QLbr+Hu+dy98feHhxIOxzKG/XKPugZxbfwbzJ19JPddJGFPiZ7vMXhHS8GkFj3JACD0GI3l+82yjnV5iR5r/FihkD6PB2P4f37fojXOZNMMukkk50x/xFb96SBfOukzxHHrpzIrt2ACZnaKCWgkpiqQZYU6/IkXU+ofCqDOM4qkRoiq43SFulH7u6/QlN1wtmZ976Fhku483Tx/CB4WTe5H4T9EScRjwdHIr3J37IfRVnszkKhL2fzkIrTZvnzrzSKN255sZperGavqj548/FfSft/9JKE/g==

Steps to reproduce

When defining props using defineProps with function types that utilize generic type aliases, the compiled prop type incorrectly becomes null instead of Function. This occurs specifically when using:

Generic type aliases (Fun2 in reproduction)

Type aliases referencing generic types (Fun4 in reproduction)

Image

Can see that fn2 and fn4 are null in type

What is expected?

All default function should be Function type

What is actually happening?

Image
fn2 and fn4 both became boolean

System Info

Any additional comments?

No response

@edison1105 edison1105 added scope: compiler scope: sfc 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler scope: sfc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants