Skip to content
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

defineModel's modifiers type is incompatible with runtime value #9945

Closed
sqal opened this issue Dec 29, 2023 · 0 comments
Closed

defineModel's modifiers type is incompatible with runtime value #9945

sqal opened this issue Dec 29, 2023 · 0 comments

Comments

@sqal
Copy link
Contributor

sqal commented Dec 29, 2023

Vue version

3.4

Link to minimal reproduction

https://play.vuejs.org/#__PROD__eNqNUk1PGzEQ/SuWL0mkxFspPaUB0VYcWqkfahEXzGHZnSwGf2k8GyKF/HfGuyQsEUIcVmvPG79579lb+TVGtW5BLuQyVWgiiQTURmFL35xoSUnLU+2FqIJPJK5cqMFelraFqeC1WRnAdC1ORA0r4+FXhpeJ0PhmKkb8dyPxKEZtjIBVmWB0Op580X7PGCwoG5rx9oVM7CY9blZifKiqTDUR2wzkb6f9sugFszzeELhoS4IsNmODvZyyDZ62Mo26S8Gz155HVsFFYwH/RDKsRstFPyFjpbXh4WdXI2S7+3p1C9X9G/W7tMk1Lf8iJMA1aHnAqMQGqIfP//+GDa8PIHtsLXe/A/4DTqrNGvu2b62vWfagr1P7w8WAxNFfpPMNgU97U1lol1rXryVf+Pd3rL/Inav5c9o7TtF0/DNXxqMce+A1Cc/oxd4SxbQoiqr2fIzfh1mj8kCFj64447YCW0/GwawO7myuPqtPRW0SDcsKkpvdYHjgZFXEUDPTwH0m6TLHGYKvAXM2H5t9dGw4/wh6pSGPPySzewKTxRvq

Steps to reproduce

const [modelValue, modifiers] = defineModel<string, 'trim' | 'uppercase'>();

// @ts-expect-error
if (modifiers.trim) {}

What is expected?

modifiers type should be a Record or undefined

What is actually happening?

modifiers type is always a Record, but its runtime value can be undefined. So either fix modifiers type or use an empty object as a fallback?

System Info

No response

Any additional comments?

No response

@github-actions github-actions bot locked and limited conversation to collaborators Jan 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant