Skip to content

Unable to Use Models in Typescript Project #682

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

Closed
1 task done
kyledecot opened this issue Nov 23, 2021 · 3 comments · Fixed by #684
Closed
1 task done

Unable to Use Models in Typescript Project #682

kyledecot opened this issue Nov 23, 2021 · 3 comments · Fixed by #684
Assignees
Labels
area-core Related to some core parts of alphaTab platform-javascript Related to the JavaScript version of alphaTab state-accepted This is a valid topic to work on.

Comments

@kyledecot
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Attempting to use one of the models exported as model results in Cannot find namespace 'model'.ts(2503).

Expected Behavior

No typescript errors.

Steps To Reproduce

import { Service } from "typedi";
import { Settings, importer, model } from "@coderline/alphatab";

@Service()
export class AlphaTabService {
  getScoreByBuffer(buffer: Buffer): model.Score { // Cannot find namespace 'model'.ts(2503)
    const settings = new Settings();

    return importer.ScoreLoader.loadScoreFromBytes(
      new Uint8Array(buffer),
      settings
    );
  }
}

Link to jsFiddle, CodePen, Project

No response

Found in Version

1.3-alpha

Platform

Node.js

Environment

- **OS**: MacOS 12.0.1 (21A559)
- **Browser**: N/A
- **.net Version**: N/A

Anything else?

Screen Shot 2021-11-23 at 9 38 24 AM

@Danielku15
Copy link
Member

Danielku15 commented Nov 27, 2021

Can you also share your tsconfig.json? model is indeed no namespace but an exported object. I wonder why the import of it can fail.

It's also funny that your environment does not complain about importer but for model it does 🤔

@Danielku15 Danielku15 added area-core Related to some core parts of alphaTab platform-javascript Related to the JavaScript version of alphaTab state-accepted This is a valid topic to work on. labels Nov 27, 2021
@Danielku15
Copy link
Member

I think I found a good way to workaround the previous issues. Give it a try with 1.3.0-alpha.135 and let me know if it works for you.

@kyledecot
Copy link
Contributor Author

kyledecot commented Nov 29, 2021

👋 Thanks for the quick turnaround on this @Danielku15. I'm currently on vacation but I'll give this a shot / report back later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core Related to some core parts of alphaTab platform-javascript Related to the JavaScript version of alphaTab state-accepted This is a valid topic to work on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants