Comments (10)
Nah, there's no types yet. You can add if you want!
from audio-decode.
How do you make this work in a typescript project then correctly?
from audio-decode.
{
"compilerOptions": {
"allowJs": true,
"checkJs": false,
}
}
in tsconfig.json
from audio-decode.
i hacked this quick types
declare module 'audio-decode' {
function wav(data: Buffer): Promise<AudioBuffer>;
function mp3(data: Buffer): Promise<AudioBuffer>;
function flac(data: Buffer): Promise<AudioBuffer>;
function opus(data: Buffer): Promise<AudioBuffer>;
function qoa(data: Buffer): Promise<AudioBuffer>;
function oga(data: Buffer): Promise<AudioBuffer>;
}
note: make a file called global.d.ts and put this there.
preferbly in d
folder
from audio-decode.
Added jsdoc. Hope it will suffice
from audio-decode.
@dy it does not suffice. There are no types available, need to generate declaration files (which you should be able to do from the JSDoc you already wrote) or publish them on definitely typed. Let me know if you're looking for help here, I wouldn't mind putting up a PR.
from audio-decode.
Sure, PR is welcomed!
from audio-decode.
@dy unfortunately I won't be using this package anymore but I'm still happy to guide you through it if you want. The gist of it is that you'll need to generate .d.ts
files with tsc
and publish them alongside the .js
files. In your case there's only one file you need to do that for: audio-decode.js
. So, add typescript as a dev dependency, add a simple .tsconfig.json
file that only includes that one file and has stuff like allowJs: true
and declaration: true
, and a prepare
script (for example) that runs tsc
to generate the audio-decode.d.ts
file.
Alternatively, you could always simply maintain the types in a declaration file directly so that you don't need to generate them every time.
In any case, make sure to add a reference to the types in the package.json
. Let me know if I can help with anything.
from audio-decode.
Ok, added. Thanks!
from audio-decode.
Glad I could help!
from audio-decode.
Related Issues (20)
- Flac, alac, aac
- An in-range update of audio-lena is breaking the build 🚨 HOT 1
- An in-range update of audio-play is breaking the build 🚨 HOT 1
- Hangs on decoding local mp3 HOT 1
- Cannot decode mp3 Buffer HOT 3
- wav
- Using with React? HOT 1
- Move to ESM or archive HOT 1
- I cannot import into my TypeScript based project HOT 2
- Cannot detect audio format for some mp3 files. HOT 2
- Failed to resolve entry for package "audio-decode". The package may have incorrect main/module/exports specified in its package.json. HOT 1
- `./browser.js` is mentioned in `package.json`, but there is no such a file HOT 1
- Will m4a format be supported? HOT 1
- Convert ogg files to mp3 HOT 2
- Decoder requires an unload function HOT 1
- Change callback notation? HOT 1
- Asynchronize
- Detect if source need no decoding HOT 1
- Ogg? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audio-decode.