Open Frantab opened 2 months ago
/cc @so1ve
V = ...
is not associated with T
. It can be any other type.
Ok, I see the problem. I tried to write it differently in TS: Ts playground
Then I tried it in my IDE and it works for the component itself so when I pass InputType.String
, will tell me I need to pass string | null in prop modelValue. In the Githubissues.
Vue version
3.4.32
Link to minimal reproduction
https://play.vuejs.org/#eNqdVE1v2zAM/SusL3aBxsawnTK7RbcGWId+BG3Qy7yDazOpOlk2JDlNkeW/j5Js10mDFuvFsMhH6vGR1No7retw2aA39mKVS1ZrUKib+jgVrKwrqWENEuewgbmsSvAJ6veuc1E3unWEkT2ZXP7XQbC1zp5r7FOEkaajMqhU5JVQGpYZbxASc1Pw6ZAcceTIEA06aCxrnmmkE0B8MBqBSdjRfagaXsAzcg76IdMgmvIeJTAFotKQKcUWIrvnCLoCpSUTC/hLIIKPRi6jq2M5KqsCeZJ6lk7qwdgQpXNfQ3hr48kVUWQcDYh5R55WVM2cLcJHVQkSdG2Sp15elTXjKK9rzaja1BuD9Rhfxnn19NPatGzwqLPnD5j/2WN/VCtjS72pRIVySSx7n87kArVzT26vcEX/vZNKazih33DeoKp4Yzg62LdGFER7gLNsz21nSYWZmqw0CtUVZYga5MbiScUGv79R+gvdz+EXG5eKDanYj9HuSALPxIK6oSkPLFCgZDkdZ0DFoCjUy6gdwR0N0x5HeOVm46QbknYQxnvBrtkE3p6aMQhcGl2GO2Ka3GgsthblP/YgimB6cz29pQihUc6zHGEqq1o5wQySSBKUVOq2prb+BAqcM4EWHdvvcWB2yCa9vD6bXFBWF2EH/K5dNhd2aUzx3SDk7HR22gVgwbTZnS6mKzP+Mbu8sCVNOJYo9C/fLo3/+ziwhKm1wWHXbEntk2Jwe+gW/iBJnKQn4LQOdiGHpLZvFOrGiiYhEPhkIX1+NofAihEanSChtLst77EAVOJAh/b5uMftkejArzgT4/Z6S592xMpYUA3upgE9mhRKZdkTf0Cu8H0aW8P2ERq9Y/v6TsPNe+9rwZb2h37ZzsO4NQ7tK0iwyIW8eg/NeIda0SLjyq4BksaDTbBatCuZgO8a4Ns+t7tHVqeHsVIJ3uYflE9Dxw==
Steps to reproduce
enum Type { Number = 'number', String = 'string', }
What is expected?
V should be generic based on the given T
What is actually happening?
V is never resolved inside vue component nor when using the component
System Info
Any additional comments?
When defining model as
const modelValue = defineModel<T extends Type.Number ? number | null : T extends Type.String ? string | null : never>();
than when using the component, type is calculated from the generic T.