How does TypeScript extend the declaration file. D.ts?

install konva, with npm install and find that the declaration file konva.d.ts that comes with it does not contain the class Transformer, that you want to extend. Do not want to modify the konva.d.ts file directly in node_module, how to expand it?

Mar.04,2021

you can try this tool dtsmake js to generate d.ts

npm i dtsmake-g

github address


create a new .d.ts file with an arbitrary name. The contents of the file are as follows

declare namespace Konva{
    export class Transformer {
        // 
    }
}
Menu