I have javascript library with types from npm/@types.
I need to make two fixes to @types which applies only in case of my application, so I can't merge them into DefinitelyTyped repository.
I need to:
remove one of fields from interface. Example:
// before changes:
interface A {
a?:string;
b?:string;
c?:string;
}
// after changes:
interface A {
a?:string;
c?:string;
}
add more types to one field in interface. Example:
// before changes:
interface B {
a?: C;
}
// after changes:
interface B {
a?: C | D;
}
Also I still want to download main @types definitions from external repository.
What is the best way to achieve this?
This can be solved using the following method.
import { A as AContract, B as BContract, C, D } from './contracts.ts';
// Removes 'b' property from A interface.
interface A extends Omit<AContract, 'b'> { }
interface B extends BContract {
a?: C | D;
}