vue icon indicating copy to clipboard operation
vue copied to clipboard

feat(props): allow defining a required prop as null

Open posva opened this issue 5 years ago • 3 comments

Based on #1961. It wasn't possible to specify a required prop of type object and pass null as the value

What kind of change does this PR introduce? (check at least one)

  • [ ] Bugfix
  • [X] Feature
  • [ ] Code style update
  • [ ] Refactor
  • [ ] Build-related changes
  • [ ] Other, please describe:

Does this PR introduce a breaking change? (check one)

  • [ ] Yes
  • [X] No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • [ ] It's submitted to the dev branch for v2.x (or to a previous version branch), not the master branch
  • [ ] When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • [ ] All tests are passing: https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md#development-setup
  • [ ] New/updated tests are included

If adding a new feature, the PR's description includes:

  • [ ] A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

The tests cases reflect what I'm trying to fix. I remember this was pointed out multiple times in the past. We cannot explicitely pass a null prop when the type is Object and the prop is required. This would keep current behaviour but allow having the type null for explicit null values. I want to add more tests and maybe refactor but I remember this was problematic as it could break some validation, so I would like so feedback about types you may use that would break with this

posva avatar Jan 23 '19 09:01 posva