Typing on props
blocka opened this issue · 3 comments
blocka commented
It's great that my props are recognized, but the props are all type "any", which doesn't help me much.
I see that extend
is generic, and the last property is for props. But I can't make heads or tails of what to do with that.
DanielRosenwasser commented
With Vue 2.5, TypeScript can understand basic prop types like
props: {
foo: String,
bar: Number,
baz: Boolean,
}
mmakrzem commented
So there is no way to specify a prop as being of a custom type? ie:
interface IData {
id: Number;
name: String;
}
props: {
foo: IData
}
DanielRosenwasser commented
You could try
props: {
foo: { default: {} as IData }
}