Javascript 使用tsc时从p5.play.js生成d.ts文件时出现问题

Javascript 使用tsc时从p5.play.js生成d.ts文件时出现问题,javascript,typescript,tsc,.d.ts,Javascript,Typescript,Tsc,.d.ts,我想为p5.play.js生成一个d.ts文件,因为没有,而且p5.play.js是一个很大的库,键入它会很痛苦,我对d.ts文件非常陌生,我只知道如何声明函数,p5.play.js也有属性。但是当我使用try来创建它时,它会创建一个带有export{}的空d.ts文件 以下是我尝试过的东西: 我尝试使用tsconfig.json和tsc生成文件,但结果是export{}这是我用于tsc的配置: 是我的src文件夹p5.play.js文件 我尝试将d.ts make与main.js一起使用,并且

我想为p5.play.js生成一个d.ts文件,因为没有,而且p5.play.js是一个很大的库,键入它会很痛苦,我对d.ts文件非常陌生,我只知道如何声明函数,p5.play.js也有属性。但是当我使用try来创建它时,它会创建一个带有
export{}的空d.ts文件

以下是我尝试过的东西:

  • 我尝试使用tsconfig.json和tsc生成文件,但结果是
    export{}这是我用于tsc的配置:
  • 是我的src文件夹p5.play.js文件

  • 我尝试将d.ts make与main.js一起使用,并且再次创建了一个d.ts文件,其中包含:
    export{}这是我的main.js for dts make:
  • 同样在src中,我有p5.play.js

    如果有帮助,这里是dts gen/make的npm
    这里是p5.play.js库:

    我也遇到了与您相同的问题,因此我没有找到预定义的p5.play.d.ts,而是为p5.play创建了自己的文件。该文件位于我的GitHub存储库中,我希望它能帮助您


    链接到文件->

    这有效了非常感谢我已经等了两个月了
    {
      // 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"
      }
    }
    
    require('dts-generator').default({
            name: 'p5.play',
            project: 'src/',
            out: 'p5.play.d.ts'
    });