-
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 #9298
Comments
Are your targeting |
@jreyes33 this worked for me, thank you |
Is there any other solution to this? I'm running |
@jreyes33 , @jamesdsmyth, this did not work for me on Cypress 6.5.0, could you share your sample tsconfig.json ? |
yeah this is not working for me either @jreyes33 @jamesdsmyth I'm using Cypress 6.5.0 can you share your tsconfig.json file? |
@yann-combarnous, @gwpetersen project's root {
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"sourceMap": true,
...
},
"include": [
"src/**/*.ts",
"src/**/*.vue",
"tests/**/*.ts"
],
"exclude": [
"node_modules",
"types",
"tests/e2e/**/*.ts"
]
} Cypress {
"extends": "../../tsconfig",
"compilerOptions": {
"sourceMap": false,
"target": "ES2019"
},
"include": ["**/*.ts"],
"exclude": []
} The mentioned compilation error is thrown when targeting I am using some common modules and dependencies in my E2E tests from the parent project (that can't be avoided) and would really prefer if it would be compiled using the same ES version. |
Is there a better solution as changing the es version isnt a good solution in my eyes |
Should there be an "Optional chaining (?.) is not supported in ES2020" issue created, maybe? |
IMO targeting an older version is not a fix but a workaround. |
Optional chaining was added in Edit: anyway, |
@folmert please open a new issue with a reproducible example and the Cypress team will be happy to investigate. |
This is finally going to be fixed in core, probably Cy 13 #27438 |
Current behavior
Currently I am seeing an issue when running a test where a function i am testing contains optional chaining. What do I need to do to allow optional chaining, be it a loader or a config setting.
This Works
if (error && error.errors.length)
This does not work
if (error.errors?.length)
Desired behavior
To be able to use optional chaining and allow the Cypress tests to run without fail.
Versions
5.6.0
The text was updated successfully, but these errors were encountered: