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

fix: check for object type when recursing into a property #31

Merged
merged 4 commits into from
Mar 31, 2022

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Mar 31, 2022

When an intermediate value is false or something else, we have an issue when using getValue.

E.g. build.stats is either false or { excludeAssets: [] }, then if we did get('build.stats.excludeAssets') this would currently fail with the message:

TypeError: Cannot use 'in' operator to search for 'excludeAssets' in false
 ❯ getValue node_modules/untyped/dist/chunks/utils.mjs:46:15
 ❯ _resolveSchema node_modules/untyped/dist/index.mjs:23:38
 ❯ _resolveSchema node_modules/untyped/dist/index.mjs:39:32
 ❯ _resolveSchema node_modules/untyped/dist/index.mjs:39:32
 ❯ _resolveSchema node_modules/untyped/dist/index.mjs:39:32
 ❯ resolveSchema node_modules/untyped/dist/index.mjs:5:18
 ❯ applyDefaults node_modules/untyped/dist/index.mjs:66:3

@danielroe danielroe requested a review from pi0 March 31, 2022 12:00
@danielroe danielroe self-assigned this Mar 31, 2022
@danielroe danielroe marked this pull request as draft March 31, 2022 12:04
@danielroe danielroe marked this pull request as ready for review March 31, 2022 12:31
@pi0
Copy link
Member

pi0 commented Mar 31, 2022

Do you mind also adding failing test?

@pi0 pi0 merged commit 13bd920 into main Mar 31, 2022
@pi0 pi0 deleted the fix/nested-get-value branch March 31, 2022 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants