eshaz/wasm-audio-decoders

Typescript build error after bumping mpg123-decoder to 0.4.11

jimchen5209 opened this issue · 5 comments

Typescript build error after bumping mpg123-decoder from 0.4.10 to 0.4.11

Typescript version: 5.3.2

Error log:

node_modules/mpg123-decoder/types.d.ts:29:3 - error TS2666: Exports and export assignments are not permitted in module augmentations.

29   export { DecodeError }
     ~~~~~~


Found 1 error in node_modules/mpg123-decoder/types.d.ts:29

My current tsconfig.json

{
    "compilerOptions": {
        "target": "ES2018",
        "module": "commonjs",
        "lib": [
            "es5",
            "es2015",
            "es2016",
            "es2017",
            "es2018"
        ],
        "allowJs": true,
        "sourceMap": true,
        "outDir": "./dist",
        "removeComments": true,
        "strict": true,
        "strictNullChecks": true,
        "strictFunctionTypes": true,
        "strictPropertyInitialization": true,
        "noImplicitThis": true,
        "noUnusedLocals": true,
        "noImplicitReturns": true,
        "moduleResolution": "node",
        "esModuleInterop": true,
        "newLine": "LF"
    },
    "include": [
        "src/**/*"
    ]
}
eshaz commented

@jimchen5209 I've created a branch that should fix this issue. Could you try pulling in the code under this branch and linking it to your project to validate that everything is working now?

https://github.com/eshaz/wasm-audio-decoders/tree/typescript-fixes

To test out the changes for mpg123-decoder, clone this repo, checkout the branch above, edit your package.json file like below to use the local code as your dependency, then run npm i.

"dependencies": {
-  "mpg123-decoder": "0.4.11"
+  "mpg123-decoder": "file:[path-to-wasm-audio-decoders]/src/mpg123-decoder"
}

Threw another error, seems to be a dependency's declaration file not being detected

node_modules/mpg123-decoder/types.d.ts:1:29 - error TS7016: Could not find a declaration file for module '@wasm-audio-decoders/common'. '[path-to-my-project]/node_modules/@wasm-audio-decoders/common/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/wasm-audio-decoders__common` if it exists or add a new declaration (.d.ts) file containing `declare module '@wasm-audio-decoders/common';`

1 import { DecodeError } from "@wasm-audio-decoders/common";
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/mpg123-decoder/types.d.ts:1
eshaz commented

I pushed another fix to that branch. Could pull in the changes and try it again?

Tested and no build error thrown.

eshaz commented

Excellent, thanks for reporting and helping test this. I'll publish new releases with these fixes.