Considering an external (npm) module extmod
exposing the following interface in its declarations file:
interface Options {
somevar?: string;
suboptions?: {
somesubvar?: string;
};
}
How can I add a property somesubvar2
inside suboptions
with module augmentation?
I've tried the following in an extmod.d.ts
file:
declare module 'extmod' {
interface Options {
suboptions?: {
somesubvar2?: string;
};
}
}
But it throws the following errors:
error TS2687: All declarations of 'suboptions' must have identical modifiers.
error TS2717: Subsequent property declarations must have the same type. Property 'suboptions' must be of type '<SNIP>', but here has type '{ somesubvar2: string; }'.