Skip to content

Argument of type '...' is not assignable to parameter of type '(string | number | null | undefined)[][]'. #9

@avevlad

Description

@avevlad

Typescript error:

image

Argument of type 'Omit<any, "Target gene" | "Representative miRNA">[]' is not assignable to parameter of type '(string | number | null | undefined)[][]'.
  Type 'Omit<any, "Target gene" | "Representative miRNA">' is missing the following properties from type '(string | number | null | undefined)[]': length, pop, push, concat, and 28 more.ts(2345)
import _ from "lodash";
import * as fs from "fs";
import csv from "async-csv";
import { dbName, sql, targetscanDirName } from "../lib/constants";

async function main() {
  let files = fs.readdirSync(targetscanDirName);
  for (const file of files) {
    let fileBody = fs.readFileSync(targetscanDirName + `/${file}`, "utf-8");
    let rows: any[] = await csv.parse(fileBody, {
      delimiter: "\t",
      columns: true,
    });
    let columns = Object.keys(rows[0]);
    console.log("columns:", columns);
    let fixedRows = rows.map((__) =>
      _.omit(__, ["Target gene", "Representative miRNA"])
    );
    let x2 = await csv.stringify(fixedRows);
  }
}

main();

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions