Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript complains on table.push() #55

Open
max-block opened this issue Oct 10, 2018 · 2 comments
Open

TypeScript complains on table.push() #55

max-block opened this issue Oct 10, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@max-block
Copy link

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/**/*"]
}

@Turbo87
Copy link
Contributor

Turbo87 commented Oct 10, 2018

can you check if #53 fixes your issue?

otherwise something like this should also resolve your issue for now:

const table = new Table({
  head: ["H1", "H2"]
}) as HorizontalTable

(I just noticed that #53 removed those type definitions though, but I'm hoping that we can bring them back before releasing another version)

@max-block max-block changed the title TypeScript compains on table.push() TypeScript complains on table.push() Oct 10, 2018
@DanielRuf DanielRuf added the bug Something isn't working label Jan 28, 2019
@OmgImAlexis
Copy link

@Turbo87 was this ever fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants