Skip to content

Make the warning messages more explicit #7764

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

Closed
AlexandreBonneau opened this issue Mar 7, 2018 · 16 comments
Closed

Make the warning messages more explicit #7764

AlexandreBonneau opened this issue Mar 7, 2018 · 16 comments

Comments

@AlexandreBonneau
Copy link
Contributor

What problem does this feature solve?

When seeing warning message like [Vue warn]: Invalid prop: type check failed for prop "value". Expected Number, got String., it would be great if Vue could display the actual values it encountered.

For instance, immediately seeing 2 and '2' would speed up development.

What does the proposed API look like?

No API changes

@ajomadlabs
Copy link

Can I take up this issue

@posva
Copy link
Member

posva commented Mar 8, 2018

Of course!

@ajomadlabs
Copy link

@posuva Since this is first contribution, Can you tell me where to start-off

@phanan
Copy link
Member

phanan commented Mar 8, 2018

@ajomadlabs I'd suggest searching the string for the file and go from there. In this case src/core/util/props.js.

@ajomadlabs
Copy link

@posva Should I replace the 'value' with the actual value that it encountered ? Correct me if I am wrong

@AlexandreBonneau
Copy link
Contributor Author

@ajomadlabs the goal here is to allow the dev to see which value generated that error.
The "value" is the name of the props that failed the test.

I'm guessing the string could be something like:

warn(
      `Invalid prop: type check failed for prop "${name}".` +
      ` Expected ${expectedTypes.map(capitalize).join(', ')}` +
      `, got ${toRawType(value)} with value ${givenValue}.`,
      vm
)

...to be defined to be consistent with other Vue messages.

Also, be sure to display the 'type' of the value by adding quotes if it's a string like '2', and no quotes when it's a number like 2.

@ajomadlabs
Copy link

@AlexandreBonneau Thanks 👍

@dczombera
Copy link

Since nothing has happened for 12 days I was wondering if I could taker over this one as my first contribution? 😊

@ajomadlabs
Copy link

@dczombera I am working on it but I am getting stuck in the middle

@AlexandreBonneau
Copy link
Contributor Author

Do you need any particular help for getting unstuck @ajomadlabs ?
This feature is highly anticipated around here :)

@ajomadlabs
Copy link

@AlexandreBonneau I think I have found it

@AlexandreBonneau
Copy link
Contributor Author

👍
:shipit:

@kotAPI
Copy link

kotAPI commented Apr 3, 2018

Is this issue up for grab? seems like its been a while since any progress has been made.

@iuriialekseev
Copy link
Contributor

@kotAPI, I created PR #7881 for this issue about 12 days ago and it was not closed yet, so I think we are waiting for further decisions of Vue team.

@kotAPI
Copy link

kotAPI commented Apr 4, 2018

Alright, @yuriyalekseyev :)

@pratheekhegde
Copy link

Folks any update on this PR? Would love to have it merged.

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

No branches or pull requests

10 participants