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

_cvtProperties undefined #412

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

_cvtProperties undefined #412

wants to merge 1 commit into from

Conversation

HighWolf
Copy link

@HighWolf HighWolf commented Jan 5, 2023

_cvtProperties do not exist on final path of schema

The default value for FOO.BAR.BAZ is stored in _schema._cvtProperties at: FOO._cvtProperties.BAR._cvtProperties.BAZ.default

TypeError: Cannot read properties of undefined (reading <k>)
    at node_modules\convict\src\main.js:371:52
    at Array.forEach (<anonymous>)
    at overlay (node_modules\convict\src\main.js:363:21)
    at node_modules\convict\src\main.js:371:7
    at Array.forEach (<anonymous>)
    at overlay (node_modules\convict\src\main.js:363:21)
    at node_modules\convict\src\main.js:371:7
    at Array.forEach (<anonymous>)
    at overlay (node_modules\convict\src\main.js:363:21)
    at node_modules\convict\src\main.js:609:11

_cvtProperties do not exist on final path of schema

The default value for FOO.BAR.BAZ is stored in `_schema._cvtProperties` at:
FOO._cvtProperties.BAR._cvtProperties.BAZ.default

TypeError: Cannot read properties of undefined (reading <k>)
    at node_modules\convict\src\main.js:371:52
    at Array.forEach (<anonymous>)
    at overlay (node_modules\convict\src\main.js:363:21)
    at node_modules\convict\src\main.js:371:7
    at Array.forEach (<anonymous>)
    at overlay (node_modules\convict\src\main.js:363:21)
    at node_modules\convict\src\main.js:371:7
    at Array.forEach (<anonymous>)
    at overlay (node_modules\convict\src\main.js:363:21)
    at node_modules\convict\src\main.js:609:11
@HighWolf
Copy link
Author

HighWolf commented Jan 20, 2023

The problem occurs when creating a schema from a dynamic type:

type TInitialSetup<T> = {
    [key: string]: T;
}
<SchemaObj<TInitialSetup<TValueUnit>>>{
    nullable: false,
    format: initialSetupValidator,
    default: {
        high: {
            value: 1
        },
        width: {
            value: 1,
            unit: 'cm'
        }
    }
}

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.

None yet

1 participant