You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 28, 2024. It is now read-only.
Describe the bug
The bug occurs when trying to set some value on inner path of Pxth<V | undefined | null> (where V is some generic object type). By default, lodash's set function when executed in the same manner _.set({ a: null }, ['a', 'b'], 42) creates empty object in-place recursively, overriding any primitive value. However, new constructed object is not of type V | undefined | null.
So, Pxth should know which type it can GET and which type it can SET.
To Reproduce
it('...',()=>{typeFormValues={value: {a: string;b: number;}|null;};constvalues: FormValues={value: null,};constpaths=createPxth<FormValues>([]);// This should throw ts error as we are trying to set value on children of nullable object.deepSet(values,paths.value.a,'aaa');console.log(values.value);// logs { a: 'aaa' }});
Expected behavior
TS error should be there when trying to set value on children of nullable object.
Additional context
In addition, this bug is related to another problem:
When initial value differs from real (for example, if server returns null for initial value of text field, however we should not be able to set null manually in text field)