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

Setting "Date" type as props will infer to string in the setup function #2668

Closed
Zcating opened this issue Nov 25, 2020 · 5 comments · Fixed by #2676
Closed

Setting "Date" type as props will infer to string in the setup function #2668

Zcating opened this issue Nov 25, 2020 · 5 comments · Fixed by #2676
Labels
has PR A pull request has already been submitted to solve the issue has workaround A workaround has been found to avoid the problem scope: types

Comments

@Zcating
Copy link
Contributor

Zcating commented Nov 25, 2020

Version

3.0.2

Reproduction link

https://codesandbox.io/s/laughing-galois-gh0q4

Steps to reproduce

define props

{
  props: {
    date: Date
  },
  setup(props) {
    // string type
    props.date 
  }

What is expected?

props.date should be Date type

What is actually happening?

props.date is string type

@posva
Copy link
Member

posva commented Nov 25, 2020

As a workaround you can do date: Date as PropType<Date>,

@posva posva added the has workaround A workaround has been found to avoid the problem label Nov 25, 2020
@posva posva added the has PR A pull request has already been submitted to solve the issue label Nov 27, 2020
@Alanscut

This comment has been minimized.

@posva

This comment has been minimized.

@Alanscut

This comment has been minimized.

@vandelpavel
Copy link

vandelpavel commented Dec 28, 2020

I had the same problem and the workaround worked for me but i'm still interested on why that happen.
Just saw related issue #2676

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has PR A pull request has already been submitted to solve the issue has workaround A workaround has been found to avoid the problem scope: types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants