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

Typescript: 'Function' type of PropType introduced in 0.5.0 is annoying when using Vetur #291

Closed
gertqin opened this issue Mar 25, 2020 · 4 comments · Fixed by #352
Closed

Comments

@gertqin
Copy link

gertqin commented Mar 25, 2020

When using Vetur's template interpolation service, object props cannot be used directly in the template from 0.5.0, without getting syntax errors:

ss

Exposing the user through setup, i.e.

export default defineComponent({
  props: {
    user: Object as PropType<IUser>,
  },
  setup(props) {
    return { user: props.user as IUser }
  }
});

works for Vetur, but then the console will print warnings:

[Vue warn]: The setup binding property "user" is already declared as a prop.
@jaryn-kubik
Copy link

jaryn-kubik commented Mar 26, 2020

This isn't just a problem with Vetur by the way, if you wanna use the prop in setup, you'll run into the same problem.
It seems to work fine when using the full prop notation:
{type: Object as PropType<IUser>} instead of just Object as PropType<IUser>

@LinusBorg
Copy link
Member

@ktsn this sounds like a problem for your Type skills ... Got an idea?

@ktsn
Copy link
Member

ktsn commented Apr 1, 2020

This might be a bug of TypeScript... I've filed an issue on the repo. microsoft/TypeScript#37734

@ktsn
Copy link
Member

ktsn commented Apr 2, 2020

This is actually something we can fix in our code. PR #301

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants