I get a typescript compilation error when I try to pass in a key with dot-notation to the onDidChange
method. This seems to happen because the type of key the onDidChange method is expecting is keyof <StoreType>
. This doesn't include the nested object properties.
Requesting to add an overload that takes a key of type string
. Just like the get
or set
.
Thanks!
interface Config {
foo: Foo;
};
interface Foo {
bar: string;
};
export const defaults: Config = {
foo: {
bar: "foobar"
}
};
const store = new Store<Config>({
defaults,
});
// ERROR - Argument of type '"foo.bar"' is not assignable to parameter of type 'keyof Config'.
store.onDidChange('foo.bar', (nVal, oVal) => {
console.log(nVal, oVal);
});
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too