microsoft/TypeScript-Vue-Starter

Typing on props

blocka opened this issue · 3 comments

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.

With Vue 2.5, TypeScript can understand basic prop types like

props: {
  foo: String,
  bar: Number,
  baz: Boolean,
}

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
}

You could try

props: {
  foo: { default: {} as IData }
}