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

Declaration Errors in assets.d.ts #53

Closed
ericdrobinson opened this issue Jun 29, 2019 · 0 comments · Fixed by #51
Closed

Declaration Errors in assets.d.ts #53

ericdrobinson opened this issue Jun 29, 2019 · 0 comments · Fixed by #51
Assignees
Labels
bug Something isn't working

Comments

@ericdrobinson
Copy link

If you convert the jsconfig.json file to a tsconfig.json file, set strict: true, and then open the assets.d.ts file (in VSCode, at least), you are presented with the following errors:

  • A 'declare' modifier cannot be used in an already ambient context. ts(1038) [119, 5]
  • A 'declare' modifier cannot be used in an already ambient context. ts(1038) [155, 5]

These refer to the fact that the colors and characterStyles classes are declared inside an already declared module.

Removing those declare statements results in further errors related to the definition of the static class. As both the colors and characterStyles "classes" are actually interfaces that allow you to access information (you never have an "instance" of those "classes"), they should simply be converted to interfaces and the static keyword removed from all function definitions. Then a constant should be added that implements that interface so that it is accessible as a name and not just a type. Taken together, the two "class"es should look something like this:

interface colors {
    get(): Array<ColorAsset | GradientAsset>;
    add(...): number;
    delete(...): number;
}

const colors: colors;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants