Unfortunately I have to use a library that has errors in the defined types / interfaces. Some fields are missing, some are optional some are wrong etc. I would like to override / extend these types / interfaces declarations.
For example, this is how a interfaces/types looks like in the library:
export declare interface Apple {
color: string
}
export declaration type Bananas = string
I would like to extend it with additional fields or redeclare without changing its names like this:
augmentations.d.ts file :
import { Apple as AppleInterface } from "some_npm_library"
declare module "some_npm_library" {
export declare interface Apple extends AppleInterface {
size: string
}
export declare type Bananas = number
}
Unfortunately, the TS is referring to the library declaration and not to my declarations. Is it possible to redeclare without changing the interface name? What am I doing wrong?