+ Start a Discussion
Nishtha Gupta 23Nishtha Gupta 23 

Illegal assignment from List<Contact> to List<Contact>

public with sharing class Contact {
@AuraEnabled
    public static list<Contact> contactlist(){
        List<Contact> con = new List<Contact>();
            con = [Select Id, Lastname from Contact limit 5];
        system.debug(con);
        return con;
    }
}
MagulanDuraipandianMagulanDuraipandian
Nishtha,

You cannot create a class with the name Contact. Contact is the Standard object.

Change the Class name to resolve this issue.

--
Magulan Duraipandian
https://www.infallibletechie.com/