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.

[BUG] Type '{ col: number; row: number; }' is missing the following properties from type 'Anchor': nativeCol, nativeColOff, nativeRow, nativeRowOff, and 3 more.

See original GitHub issue

🐛 Bug Report

Lib version: 4.2.1

Steps To Reproduce

worksheet.addImage(imageId, {
  tl: { col: 0, row: 31 },
  br: { col: 15, row: 31 },
});

The expected behaviour:

In TypeScript projects (like my Angular project) will not run if I use the example syntax shown in the README: image

I get the following errors and cannot build because the interface requires all properties to be present.

image

Possible solution (optional, but very helpful):

// You could make those properties optional by putting a `?` before the semicolon defining the properties type to be optional.  

export interface Anchor {
  nativeCol?: number;
  nativeColOff?: number;
  nativeRow?: number;
  nativeRowOff?: number;
  ....
}

// Or you could use a Partial of Anchor in the method declaration for `addImage`:

Partial<Anchor>

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

5reactions
rob4226commented, Aug 18, 2021

Any updates??

I just overrode the errors and it seems to work fine so it must be an issue with the TS type definitions in this lib.

worksheet.addImage(imageId1, {
   // @ts-expect-error Issue with ExcelJs types.
   tl: { col: 8, row: 0.2 },
   // @ts-expect-error Issue with ExcelJs types.
   br: { col: 8.8, row: 4.2 }
});
2reactions
jakehockey10commented, Jun 16, 2021

You can get around this by doing the following, but I couldn’t find an example of this in the documentation:

worksheet.addImage(imageId, {
    tl: new Anchor({ col: 0, row: 31 }),
    br: new Anchor({ col: 15, row: 31})
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

typesrcript reactjs : is missing the following properties from type
In your interface you've declared dropdownItems as any. Looking at you data it seems dropdownItems is an array of objects containing keys ...
Read more >
Row | TanStack Table Docs
These are core options and API properties for all rows. More options and API properties are available for other table features. Row API....
Read more >
Merge branch 'master' of https://github.com/exceljs/exceljs ...
All index values in the table are zero based, so the first row number ... this field specifies the path to a file...
Read more >
bug type
[BUG] Type '{ col: number; row: number; }' is missing the following properties from type 'Anchor': nativeCol, nativeColOff, nativeRow, nativeRowOff, ...
Read more >
exceljs-modify - npm Package Health Analysis - Snyk
A count of the number of rows that have values. If a mid-document row is empty, it will not be included in the...
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