Migrated to TS first component where some dependency was being injected

This commit is contained in:
Alejandro Celaya
2020-08-22 11:20:27 +02:00
parent eefea0c37b
commit 39663ba936
6 changed files with 68 additions and 59 deletions

View File

@@ -6,7 +6,7 @@ const CSV_MIME_TYPE = 'text/csv';
export default class ServersImporter {
public constructor(private readonly csvjson: CsvJson, private readonly fileReaderFactory: () => FileReader) {}
public importServersFromFile = async (file?: File): Promise<RegularServer[]> => {
public importServersFromFile = async (file?: File | null): Promise<RegularServer[]> => {
if (!file || file.type !== CSV_MIME_TYPE) {
throw new Error('No file provided or file is not a CSV');
}