Skip to content

_cvtProperties undefined#412

Open
HighWolf wants to merge 1 commit intomozilla:masterfrom
HighWolf:master
Open

_cvtProperties undefined#412
HighWolf wants to merge 1 commit intomozilla:masterfrom
HighWolf:master

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.

1 participant