LWC Linter - SObject autocompletion works but upon selection, the 'Unresolved variable' error still shows.

Issue #2134 resolved
Darrion created an issue
  1. Create a controller that returns an SObject list
  2. In the LWC, fetch the records using that controller, and iterate over the list. Each ‘row’ has the correct autocomplete suggestions.

3. Select one of the suggestions, and the following linter error is show:

Kind of weird that the linter knows those fields exist but does not recognise them upon selection.

Comments (2)

  1. Scott Wells repo owner

    Can you provide a little more detail about how you're getting to this? I added an import for an @AuraEnabled method that returns a list of Expense__c SObjects, and it's resolving everything fine, e.g.:

    import getExpenses from "@salesforce/apex/ExpenseController.getExpenses";
    
    ...
    
        verifyGetExpenses() {
            getExpenses()
                .then((expenses) => {
                    for (const expense of expenses) {
                        if (expense.Amount__c > 100.0) {
    
                        }
                    }
                });
        }
    
    ...
    

    has no errors, and the expression expense.Amount__c properly resolves to the field Expense__c.Amount__c in the TypeScript interface Expense__c from the OST.

  2. Scott Wells repo owner

    Issue tracker grooming. If this is still an issue, please feel free to reopen, ideally with a concrete reproduction scenario.

  3. Log in to comment