Jimp: TS error `Type '"constants"' cannot be used to index type 'T' (2536) when consuming .d.ts

Created on 13 Mar 2020  路  2Comments  路  Source: oliver-moran/jimp

I'm writing 3rd part TypeScript/Definition file that consumes Jimp (this part works marvelously):

import mergeImg from 'merge-img';
import { resolve } from 'path';
import Jimp from 'jimp';

const fixturePath = resolve(__dirname, 'fixtures');

mergeImg(['image-1.png', 'image-2.jpg']).then(img => {
    // Save image as file
    img.write('out.png', () => console.log('done'));
});

```ts
export default function mergeImg(
images: Array,
options?: Options,
): Promise;

I cannot see the outcome of the adding TS support as the tsc tooling complains:
```bash
Error: Errors in typescript@next for external dependencies:
node_modules/@jimp/core/types/utils.d.ts(16,3): error TS2536: Type '"class"' cannot be used to index type 'T'.
node_modules/@jimp/core/types/utils.d.ts(17,3): error TS2536: Type '"constants"' cannot be used to index type 'T'.

Relevant jimp def type:

export type WellFormedValues<T extends any> = 
  T['class'] &
  T['constants'];

https://www.google.com/search?q=typescript+TS2536&oq=typescript+TS2536&aqs=chrome..69i57.1779j0j1&sourceid=chrome&ie=UTF-8

Shoudl this one be changed by restructuring consuming code? Or there in the upstream source?

Thanks folks!

Most helpful comment

@hipstersmoothie think we can close this issue out now?

All 2 comments

Thanks for raising this issue! Sorry for missing it beforehand 馃槄 This should be fixed in #858

@hipstersmoothie think we can close this issue out now?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

master-of-null picture master-of-null  路  3Comments

dtrofimov picture dtrofimov  路  5Comments

chancein007 picture chancein007  路  5Comments

Inbarasan16 picture Inbarasan16  路  3Comments

DylanPiercey picture DylanPiercey  路  4Comments