Skip to content

_cvtProperties undefined #412

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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'
        }
    }
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant