function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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/