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

String literal property names cause errors during compilation #132

Open
Aierie opened this issue Jun 1, 2020 · 2 comments
Open

String literal property names cause errors during compilation #132

Aierie opened this issue Jun 1, 2020 · 2 comments

Comments

@Aierie
Copy link

Aierie commented Jun 1, 2020

Using Diez version 10.6.0

Error: Expected to find member with name: "contentBackground-1"
    at throwIfNullOrUndefined (/Users/michael/Documents/vase-design-tokens/design-language/node_modules/ts-morph/dist/ts-morph.js:127:15)
    at Symbol.getMemberOrThrow (/Users/michael/Documents/vase-design-tokens/design-language/node_modules/ts-morph/dist/ts-morph.js:17868:16)
    at exports.ProjectParser.processType (/Users/michael/Documents/vase-design-tokens/design-language/node_modules/@diez/compiler-core/lib/parser.js:1:4608)
    at exports.ProjectParser.processType (/Users/michael/Documents/vase-design-tokens/design-language/node_modules/@diez/compiler-core/lib/parser.js:1:5812)
    at exports.ProjectParser.run (/Users/michael/Documents/vase-design-tokens/design-language/node_modules/@diez/compiler-core/lib/parser.js:1:7130)

The error above occurs whenever I have to use string literals for property names.

eg.

const palette = {
  "15thItem": colors.red,
  "ui-1": colors.blue
}

It may be related to this issue on ts-morph:
dsherret/ts-morph#820

@roperzh
Copy link
Member

roperzh commented Jun 1, 2020

Hey @Aierie , thank you very much for the report and the help investigating the issue. I think this is worth fixing and publishing, I will ping you as soon as a new version is out.

@phil-lgr
Copy link

Same thing for enums:

const palette = {
  [ENUM.NAME1]: colors.red,
  "ui-1": colors.blue
}

Does not work either

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

3 participants