I'm building a TypeScript-based LWC project using WebStorm + Illuminated Cloud.
I was implementing a basic todoApp.ts component, and added a line to call an Apex class method:
As soon as I added the import getTodos from '@salesforce/apex/...'; line, I started getting this error:
As a result, push metadata button won't deploy the component.
✅ What I tried so far:
0. Removed deprecated @types/eslint__js:
At one point, I had a TS error related to missing types for 'eslint__js', which was being pulled in indirectly by one of the ESLint-related packages.
After some research, I removed @types/eslint__js as it is deprecated and unnecessary when using @eslint/js, like this:
```
npm uninstall @types/eslint__js
```
1. Created a manual type declaration in types/lwc-apex.d.ts:
2. My tsconfig.json (relevant parts):
```
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "Node",
"baseUrl": ".",
"paths": {
"lwc": ["node_modules/@lwc/types"]
},
"typeRoots": [
"./node_modules/@types",
"./node_modules/@lwc/types",
"./types"
]
},
"include": [
"force-app/main/default/lwc/**/*",
"types/**/*"
]
}
```
3. Installed all the relevant packages:
Hi. Illuminated Cloud should be maintaining stubs for @AuraEnabled Apex symbols — and other LWC-importable Salesforce metadata — under <projectDir>/.illuminatedCloud/lwc/types. For @AuraEnabled Apex symbols, they would be found under .../lwc/types/apex/<ClassName>Exports.d.ts, e.g.:
// DO NOT EDIT: This file is managed by Illuminated Cloud. Any external changes will be discarded. declare module "@salesforce/apex/ExpenseController.getExpense" { export default function getExpense(): Promise<Expense__c>; } declare module "@salesforce/apex/ExpenseController.getExpenses" { export default function getExpenses(): Promise<Expense__c[]>; } declare module "@salesforce/apex/ExpenseController.saveExpense" { export default function saveExpense(params: {expense: Expense__c}): Promise<Expense__c>; }If you’re not seeing those, please make sure that you’re on the latest version of Illuminated Cloud and, if so and you still see the issue, please log a bug in the public issue tracker with your idea.log file(s) for review.
Regards,
Scott Wells