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

Support for TypeScript version 3.7.x - Optional Chaining error #2231

Closed
CloudPower97 opened this issue Dec 5, 2019 · 6 comments · Fixed by #2232
Closed

Support for TypeScript version 3.7.x - Optional Chaining error #2231

CloudPower97 opened this issue Dec 5, 2019 · 6 comments · Fixed by #2232
Assignees

Comments

@CloudPower97
Copy link

Describe the bug

I recently moved to TypeScript version 3.7.3 mainly because of optional chaining operator.

However, it seems that even the react-typescript compiler version 3.1.16 released yesterday has some problem with it.

Steps to Reproduce

  1. Install the latest TypeScript version (as of now 3.7.3)
  2. Try to use the optional chaining operator

Expected Behavior

It should be possible to use the optional chaining operator

Screenshots, exceptions and logs

     > card ...  issues found       
       error found while parsing the file (please edit the file and fix the parsing error): 
          src/components/Card/Filters/index.tsx -> Expression expected.

Specifications

@qballer
Copy link
Contributor

qballer commented Dec 7, 2019

Hi @CloudPower97, I upgraded to the compiler to use chaining myself. I will test that and get back to you. Hopefully with a fix.

@qballer
Copy link
Contributor

qballer commented Dec 8, 2019

issue fixed in current version please update.

@qballer qballer closed this as completed Dec 8, 2019
@CloudPower97
Copy link
Author

Hey @qballer, I've updated both bit-bin and react-typescript, but I'm experiencing the same issue.
Thoughts?

@qballer qballer reopened this Dec 9, 2019
@qballer qballer closed this as completed Dec 9, 2019
@qballer
Copy link
Contributor

qballer commented Dec 9, 2019

It would be great to talk on gitter, I feel that there might be something specific in your work space I need to look at. My email is [email protected] I also hang in our gitter chat here: https://gitter.im/bit-src/Bit

@qballer qballer reopened this Dec 9, 2019
@JoshK2
Copy link
Member

JoshK2 commented Jan 8, 2020

@CloudPower97 I reproduce the error and get the same error as you from Bit:

error found while parsing the file (please edit the file and fix the parsing error): 
          src/getAnimalType.ts -> Expression expected.

@GiladShoham , @davidfirst
The error is with Bit parsing and not with the compiler, because if I run bit build with the React-TypeScript compiler (3.1.28) it's built correctly the component, but I cannot tag it because of the parsing error.

STP:

  1. Create a TypeScript project.
  2. Create a simple TS file and put this function inside;
export const getAnimalType = (animal: Record<string, any>, name: string): string => {
    return animal[name]?.type;
}
  1. Track this component and run bit status, you should get the same error as we get.

@JoshK2 JoshK2 changed the title Support for TypeScript version 3.7.x Support for TypeScript version 3.7.x - Optional Chaining error Jan 8, 2020
@JoshK2 JoshK2 transferred this issue from teambit/envs Jan 8, 2020
@davidfirst davidfirst assigned davidfirst and unassigned GiladShoham Jan 8, 2020
davidfirst added a commit that referenced this issue Jan 8, 2020
* resolve #2231, update typescript to support optional chaining

* fix lint issues, upgrade some more packages to fix npm-audit

* fix eslint issues

* fix build-types script

* update CHANGELOG
@davidfirst
Copy link
Member

Fixed by updating the typescript version of bit-bin and bit-javascript to 3.7.4.
(the reason why typescript dependency is pinned is to avoid the warning

WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser

we get from eslint-parser.

Will be part of the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants