Change guessType
to retain value types if they are known
#22349
Merged
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.
Scope
If configuration parameters are read from any location, where they already have a correct type, e.g. from a
.js
or.yaml
file this information is lost, and can actually lead toguessType
guessing the wrong type, e.g.'number'
for aboolean
value.What's changed:
guessType
to retain the type of unknown value, if they areboolean
,number
orarray
.Potential Risks / Drawbacks
DB_EXCLUDE_TABLES: ['foo', 'bar']
before, but would allow it nowANY_CONFIG_VALUE: true
to equal1
will have a problem now (let's not hope so)Review Notes / Questions
cast.test.ts
that cover all combinations of cast flags and values and test it without mocking all the functions in between? Right now everything is mocked out.Fixes #21744