fix(BFormCheckbox): Fixes #1822 - Prevent empty string being cast to true #1831
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the PR
Fix #1822 (Empty string as entry in options array of BFormCheckboxGroup returned as true in v-model) by inlining the
string | booleanpart of theCheckboxValuetype in thedefinePropsofBFormCheckboxGroup.vue.According the the vue docs, the way to disable the boolean casting rule in this case is to make sure
stringcomes beforebooleanin the type union. Changing the type definition inCheckBoxTypes.tswasn't sufficient because the compiler-sfc doesn't crawl external files, so prepended thestring | booleanpart of the union inline in the place that compiler-sfc uses. This is somewhat ugly, but I believe it is better than the alternatives that I considered:CheckboxValueinBFormCheckboxGroup.vueCheckboxTypes.tstoBFormCheckboxGroup.vueand then makeindex.tsin types refer to those definitionsSmall replication
See #1822
PR checklist
What kind of change does this PR introduce? (check at least one)
fix(...)feat(...)fix(...)docs(...)The PR fulfills these requirements:
CHANGELOGis generated from these messages, and determines the next version type. Pull requests that do not follow conventional commits or do not have an override will be denied