Install Docker. https://docs.docker.com/install/
Clone this repository and then run:
./install.sh
./bin/run.sh [JS-FILE] [TYPESCRIPT-MODULE-NAME] [OUTPUT_DIRECTORY]
You can use the example provided in this repo under example/calculator.js
.
./bin/run.sh examples/example.js calculator /tmp/ts-declaration-file-generator-service
You will find the declaration file under /tmp/ts-declaration-file/calculator/index.d.ts
:
cat /tmp/ts-declaration-file-generator-service/calculator/index.d.ts
export = Calculator;
declare class Calculator {
constructor();
sum(a: number, b: number): number;
}
declare namespace Calculator {
}