Giter Site home page Giter Site logo

Comments (5)

dfober avatar dfober commented on June 15, 2024

Related to this topic:
the html examples (from the test folder) make reference to Faust2WebAudio, which is not declared anywhere, apart from the webpack config file. You have first to find it (outside the dist and src folders), and next to look at src/index.ts to discover that it's a kind of namespace that covers the Faust and FaustAudioWorkletNode imports (if I'm right).
And of course, typescript complains about Faust2WebAudio type...

from faust2webaudio.

Fr0stbyteR avatar Fr0stbyteR commented on June 15, 2024

Hi @dfober
Actually, the dist/index.d.ts will be detected and used automatically when the package is installed as a NPM package:

import { Faust, FaustAudioWorkletNode, FaustScriptProcessorNode } from "faust2webaudio"; 

Here, as the src/ folder is also included in the NPM package, the imported types will be resolved. And no need to re-declare the Faust interface, which is redundant and harder to maintain.
It is also possible, I believe, to generate an .d.ts file that contains all the types by tsc --emitDeclarationOnly. But I don't feel necessary...

For the second question. The package is now wrapped as an UMD module, which means it will detect current environment and make the module work for. If the module is included in a <script />, It will expose Faust2WebAudio as its namespace (defined in webpack.config.js), if it is imported in a Node.js dev environment, There will be nothing exposed.

from faust2webaudio.

dfober avatar dfober commented on June 15, 2024

I'll try the import strategy. However, it doesn't solve my main problem: looking at the package, it's quite impossible to figure out what are the available types, classes et methods, unless I browse all the source code.
Note also that I don't use webpack, only typescript.

from faust2webaudio.

Fr0stbyteR avatar Fr0stbyteR commented on June 15, 2024

I tried: tsc ./src/index.ts --emitDeclarationOnly -d --target ES6 will generate .d.ts file for each ts file.

from faust2webaudio.

dfober avatar dfober commented on June 15, 2024

Yes, I already tried...
Thanks

from faust2webaudio.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.