Question: I have a list of objects which, depending on the condition that applies, has a variable type. However, I have not found a way to make this happen.

issue:
`cannot implicitly convert type List<TABLE_ONE> to type list<object>`

```
 List<object> listName;

    switch (sourceTableName)
    {
        case "TABLE_ONE":
            listName = m_api.Database.ExecuteQuery<TABLE_ONE>($"SELECT * FROM {sourceTableName}");
            break;
        case "TABLE_TWO":
            listName = m_api.Database.ExecuteQuery<TABLE_TWO>($"SELECT * FROM {sourceTableName}");
            break;
        case "TABLE_THREE":
            listName = m_api.Database.ExecuteQuery<TABLE_THREE>($"SELECT * FROM {sourceTableName}");
            break;
    }

foreach (var row in listName)
     {
        var dif3 = new DataInterfaceFactory(DatabaseTypes.SqlServer, row.DatabaseName, row.ServerName);
        do stuff...
     }

```

the variable `sourceTableName` is a string that contains the name of a class.

**Classes that are used as types:**

```
    public class TABLE_ONE
    {
        public int TableOneColumnUid;
        public string ServerName;
        public string DatabaseName;
        public DateTime LastCheckDate;
        public int IsRunning;
    }
    public class TABLE_TWO
    {
        public int TableTwoColumnUid;
        public string ServerName;
        public string DatabaseName;
        public DateTime LastCheckDate;
        public int IsRunning;
    }
    public class TABLE_THREE
    {
        public int TableThreeColumnUid;
        public string ServerName;
        public string DatabaseName;
        public DateTime LastCheckDate;
        public int IsRunning;
    }

```

Answer: 
I had a similar issue which was resolved by calling the `event.preventDefault()` method.

This would need to be called in your 'onSubmit' function i think

```
const onSubmit = jest.fn(e => e.preventDefault());

```

edit: woops forgot to invoke it!
Adding `type="button"` to the button element is also effective. This will dismiss that error.

Realised this because I had a save and cancel button. I tested the save first and this error didn't occur but when I tested the cancel the error occurred.

When I came to this answer, reading the first answer gave me a clue and as I was about to add the `event.preventDefault()` I realised `type="button"` was missing on the cancel button.

Both buttons are child elements of the form.