apex – Add data retrieved from soql to a list

I have a soql query from which I want to retrieve a list of Ids. I want to add those Ids a list in apex.

public static void myFunction(List<myObject1__c> myObject1ID) {
            
   List<myObject2__c> ftseCompaniesID = new List<myObject2__c>();
   List<myObject1__c> ChannelList = [Select myObject2_Id__c, Name from myObject1__c
                                     Where Id IN :myObject1ID];
            
   for(myObject1__c getftseId : ChannelList) {
       ftseCompaniesID.add(getftseId.myObject2_Id__c);
   }
}

I get this error when I try to save this code:

Method does not exist or incorrect signature: void add(Id) from the type List<myObject2__c>

Read more here: Source link