Skip to content

TypeScript complains on table.push() #55

Open
@max-block

Description

@max-block

TypeScript complains on table.push().

Here is a test code:

import Table from "cli-table3"
const table = new Table({
  head: ["H1", "H2"]
})
table.push(["c1", "c2"])
console.log(table.toString())

Here is an error message:

tsc

src/t0-test.ts:6:1 - error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((...items: Cell[][]) => number) | ((...items: VerticalTableRow[]) => number) | ((...items: CrossTableRow[]) => number)' has no compatible call signatures.

6 table.push(["c1", "c2"])
  ~~~~~~~~~~~~~~~~~~~~~~~~

That code possible to compile and run with ts-ignore comment:
It will works:

// @ts-ignore
table.push(["c1", "c2"])

TypeScript version: 3.1.2
tsconfig.json:

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "lib": ["es2017"],
    "sourceMap": true,
    "outDir": "./dist",
    "strict": true,
    "moduleResolution": "node",
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "esModuleInterop": true
  },
  "include": ["src/**/*"]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions