WebStorm thinks it is a ternary operator and expects expressions and colon next. Maybe it thinks it is a TS code, while this is JS code in .js file, I'm not sure.
How can I switch this inspection off?
TypeScript compiler service reports the error here because optional chaining is not supported in TypeScript < 3.7. Service is used for JavaScript linting if the service is enabled in Settings | Languages & Frameworks | TypeScript and "allowJs"
is set to true
in tsconfig.json
.
If you only want the service to compile/lint TypeScript, make sure that "allowJs"
is either not set or set to false
in tsconfig.json