I wanted to generate a d.ts file for p5.play.js as there aren't any and since p5.play.js is a big library typing it out would be a pain and I am very new to d.ts files show I only know how to declare function and p5.play.js has properties as well. But when I use try to create it, it creates an empty d.ts file with export {};
Here are the things I have tried:
export {};
and here is the config I used for tsc:{
// Change this to match your project
"include": ["src/"],
"compilerOptions": {
// Tells TypeScript to read JS files, as
// normally they are ignored as source files
"allowJs": true,
// Generate d.ts files
"declaration": true,
// This compiler run should
// only output d.ts files
"emitDeclarationOnly": true,
// Types should go into this directory.
// Removing this would place the .d.ts files
// next to the .js files
"outDir": "dist"
}
}
and is the src folder I had p5.play.js file
export {};
and here is my main.js for dts make:require('dts-generator').default({
name: 'p5.play',
project: 'src/',
out: 'p5.play.d.ts'
});
again in the src, I had p5.play.js.
If it helps here is the npm for dts gen/make https://www.npmjs.com/package/dts-generator And Here is the p5.play.js library: https://github.com/molleindustria/p5.play/blob/master/lib/p5.play.js
I also had the same problem as you so instead of finding a predefined p5.play.d.ts, I created my own file for p5.play. The file is in my GitHub repository and I hope it helps you!!
Link to the file -> https://github.com/VisualCode44/Definition-File