-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Optional chaining (?.) is not supported with "target": "esnext" #20753
Comments
@mlegait Thank you for opening an issue. Cypress expects a preprocessor to prepare & transpile the pluginsFile, supportFile and test files within a project. If a preprocessor has not been registered to the If the default webpack configuration provided in Another option is to see if an existing community preprocessor meets your needs: https://www.npmjs.com/search?q=cypress-*-preprocessor -- though taking a quick glance I'm not sure if I'm noticing one outright. |
The same issue appears to occur when the target is "ES2020". This is discussed in the closed issue:
|
Thank you @emilyrohrbough for the complete explanation. |
@lmiller1990 @ZachJW34 any chance of supporting |
We recently decided to move to ESNext in our project, but unfortunately stumpled upon this here. Also moving back until this issue is fixed here. |
I documented some workarounds over here: #16914 (comment) |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
@emilyrohrbough any plans on the radar about fixing this problem out of the box for all Cypress TypeScript users? |
Also curious. The webpack fix kinda works, but causes a HUGE cascade of other issues requiring a ton of work. Seems like a nightmare band-aid just to support a newer ES spec. |
Comment in #16914
Should we just do this? Will this fix the issue? The user in that thread says it will, and implied by @karlhorky in #16914 (comment). My understanding is the older version of webpack/babel Cypress ships does not understanding If this does fix it, though, I think we should make this change - there are a lot of issues around optional chaining that could be fixed. WDYT @emilyrohrbough ? |
Looks like its deeply related to webpack/webpack#10227 If I see it correctly it should be fixed in I'm running [email protected] and still have this problem. And update would be really welcome. |
this happened to me today, lucky I had switched to "esnext" yesterday. so it was the first thing i checked. it was an optional parameter in a class that was returning as undefined. |
Current behavior
It's impossible to use optional chaining if
"target": "esnext"
is configured intsconfig.json
.In fact, I would like to reopen the issue #9298.
In tsconfig.json:
In spec:
Error:
Desired behavior
We should be able to use
esnext
as target with Cypress and have optional chaining supported.Test code to reproduce
https://github.com/mlegait/cypress-test-tiny
Cypress Version
9.5.2
Other
No response
The text was updated successfully, but these errors were encountered: