Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript type definition seems invalid #16

Closed
jeffreykog opened this issue Nov 16, 2021 · 2 comments
Closed

Typescript type definition seems invalid #16

jeffreykog opened this issue Nov 16, 2021 · 2 comments

Comments

@jeffreykog
Copy link

Hi. Thanks for your work on integrating Ableton Link in node.js. The Typescript definitions in this repository seem invalid, as newer TSC's raise some errors while building the typescript code. I'm not able to figure out the correct synax for these as the implementations itself are mostly done in C++, and i have no experience with native node.js bindings. Maybe someone knows how to get the typescript definitions working with newer TSC versions.

The errors are as follows:

node_modules/abletonlink/index.d.ts:2:30 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

2   export const Audio = class AbletonLinkAudio extends AbletonLinkBase {}
                               ~~~~~~~~~~~~~~~~

node_modules/abletonlink/index.d.ts:3:3 - error TS2309: An export assignment cannot be used in a module with other exported elements.

3   export = class AbletonLink extends AbletonLinkBase {}
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/abletonlink/index.d.ts:3:18 - error TS2714: The expression of an export assignment must be an identifier or qualified name in an ambient context.

3   export = class AbletonLink extends AbletonLinkBase {}
                   ~~~~~~~~~~~

node_modules/abletonlink/index.d.ts:9:1 - error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.

9 abstract class AbletonLinkBase {
  ~~~~~~~~

Reproducing is simple:

  1. Create a new blank node.js project ($ npm init)
  2. Install abletonlink and typescript ($ npm install abletonlink typescript)
  3. Add a simple tsconfig.json file:
    {
        "compilerOptions": {
            "target": "es6",
            "module": "commonjs",
            "outDir": "./dist/server",
            "strict": true,
            "sourceMap": true,
            "typeRoots": [
                "node_modules/@types"
            ]
        },
        "exclude": [
            "dist",
            "node_modules"
        ]
    }
    
  4. Run $ tsc
  5. TSC will now return the errors listed above.
@2bbb
Copy link
Owner

2bbb commented Nov 19, 2021

@jeffreykog

thanks for the issue.

maybe the current master (npm ver 0.1.3) is fixed.
please check it!

@jeffreykog
Copy link
Author

Thanks for your quick response! It's fixed now in v0.1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants