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

Type error causing build failure in the destination package: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. #272

Closed
mia-mifeng opened this issue Apr 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mia-mifeng
Copy link
Collaborator

Provide a general summary of the issue here

We're using RSC in another TS-based package. There's a build failure caused by the type configuration / export issues from RSC.

🤔 Expected Behavior?

The build of the destination package should be successful.

😯 Current Behavior

The build command yarn prepack failed with the following 4 error messages:

node_modules/@adobe/react-spectrum-charts/dist/@types/types/Chart.d.ts(2,53): error TS2307: Cannot find module '@constants' or its corresponding type declarations.
node_modules/@adobe/react-spectrum-charts/dist/@types/types/Chart.d.ts(604,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
node_modules/@adobe/react-spectrum-charts/dist/@types/types/Chart.d.ts(605,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
node_modules/@adobe/react-spectrum-charts/dist/@types/types/Chart.d.ts(606,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.

💁 Possible Solution

The possible root cause of the problem may be related to the interface definition for Datum, specifically L684-686

export interface Datum {

where the constants like MARK_ID are directly used to define the keys for the interface, which triggers the issue A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. And then these errors further triggers the first error where the paths alias @constants cannot be correctly resolved.

One attempt to fix is #270, where the constants are converted to literal types.

References

  1. A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. palantir/tslint#4605 (comment)
  2. https://stackoverflow.com/questions/69669498/typescript-a-computed-property-name-in-a-type-literal-must-refer-to-an-express

🔦 Context

No response

🖥️ Steps to Reproduce

  1. Install and import RSC to another TS-based react app
  2. Build the destination app: in our case, run yarn prepack

Version

1.7.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

MacOS

🧢 Your Company/Team

Adobe/AEP Reporting Experience

🕷 Tracking Issue

No response

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

No branches or pull requests

2 participants