question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TS2371 in exceljs >= 1.9.0 (Typescript)

See original GitHub issue

Version 1.9.0 introduced a new issue in exceljs/index.d.ts.

ERROR in node_modules/exceljs/index.d.ts(787,17): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

In an Angular (7) project, install exceljs 1.9.0 and add the following to tsconfig.json

"paths": {
  "exceljs": ["../node_modules/exceljs/dist/exceljs.min"]
}

use ng serve and see TS2371

Downgrading to 1.8.0 solves the problem

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:15
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
yonaroshellacommented, Apr 10, 2019

use import * as Excel from “exceljs/dist/exceljs.min.js”; instead of import { Workbook } from ‘exceljs’;

and declare let workbook = new Excel.Workbook();

5reactions
mfulopcommented, Apr 4, 2019

I think line #789 of index.d.ts:

constructor(model: IAnchor|object = {});

should be:

constructor(model: IAnchor|object);
Read more comments on GitHub >

github_iconTop Results From Across the Web

TS2371 in exceljs >= 1.9.0 (Typescript) - Bountysource
ERROR in node_modules/exceljs/index.d.ts(787,17): error TS2371: A parameter initializer is only allowed in a function or constructor ...
Read more >
4.3.0 - exceljs - npm
Read, manipulate and write spreadsheet data and styles to XLSX and JSON. Reverse engineered from Excel spreadsheet files as a project.
Read more >
Can't export excel using ExcelJS - error TS2307: Cannot find ...
I was try to export an excel file using ExcelJS. Here is my console in VS Code terminal :
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found