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

VSEPRConfiguration.js:37:7 - error TS9006: Declaration emit for this file requires using private name 'ResultMapping' #185

Closed
samreid opened this issue Jun 21, 2021 · 3 comments

Comments

@samreid
Copy link
Member

samreid commented Jun 21, 2021

While working on phetsims/chipper#1055, I saw this error for Molecule Shapes:

~/apache-document-root/main/chipper/tsconfig/molecule-shapes$ tsc -b
../../../molecule-shapes/js/common/model/VSEPRConfiguration.js:37:7 - error TS9006: Declaration emit for this file requires using private name 'ResultMapping' from module '"/Users/samreid/apache-document-root/main/molecule-shapes/js/common/model/AttractorModel"'. An explicit type annotation may unblock declaration emit.

37 class VSEPRConfiguration {
         ~~~~~~~~~~~~~~~~~~


Found 1 error.

I don't really understand this problem (if it is really a problem), but it seems to be related TypeScript parsing this JSDoc:

  /**
   * For finding ideal rotations including matching for 'bond-vs-bond' and 'lone pair-vs-lone pair'.
   * @public
   *
   * @param {Array.<PairGroup>} groups
   * @returns {AttractorModel.ResultMapping}
   */
  getIdealGroupRotationToPositions( groups ) {

And thinking it's referring to a private non-exported variable name ResultMapping.

@samreid
Copy link
Member Author

samreid commented Jun 21, 2021

I worked around the problem by inlining the class declaration, and it seems to have corrected the problem. I didn't devote more time to understanding the root of the problem since it only seems to affect a few files across our codebase, and there is a straightforward workaround. @jonathanolson would you like to review?

@jonathanolson
Copy link
Contributor

That seems like a decent workaround, and looks good. Presumably we'll handle in a better way with typescript in the future?

@samreid
Copy link
Member Author

samreid commented Jun 21, 2021

Yes, I think this problem occurs in JS but not TS, since in TS you import files to provide them in type annotations. Closing.

@samreid samreid closed this as completed Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants