I have a type in an external library that looks like this:
export declare type CreateProductInput = {
title: string;
}
I want this type to have another attribute so tried to add to it in my own index.d.ts
file:
I have tried the following:
export declare type CreateProductInput = {
subtitle: string;
}
But that did not work. I also tried the following:
declare module '@path/to/library/type/file' {
declare interface CreateProductInput {
subtitle: string;
}
}
However, doing this overwrites the type completely and I no longer have access to the title
field.
Can one merge types like this? Basically, I want to modify the original type by adding another property to it.