I have a javascript library which has a type definition file here: https://github.com/tyranid-org/tyranid/blob/master/tyranid.d.ts which is exposed via the typings property in my package.json file.
a basic version of the definition file:
export default Tyr;
declare namespace Tyr {
interface Document {
$save(): Promise<Document>;
}
}
I would like to extend the Document interface in a completely separate typescript library: https://github.com/CrossLead/tyranid-gracl which imports tyranid along with its typings, by adding a $newMethod() method to the document interface. Can this be done?
I've tried the following in a separate declaration file in the second repo, but it doesn't work:
import Tyr from 'tyranid';
declare namespace Tyr {
interface Document {
$newMethod(): number;
}
}
I can modify both declarations if necessary -- its very possible I am not writing the original type definition file for tyranid correctly. Thanks!