mh-two-thousand-and-two
2024-04-12 3d2ec2fd0578d3ba0a414b0cc4e4a2ae60878596
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
 * While there is nothing in these typings that prevent it from running in TS 2.8 even,
 * due to the complexity of the typings anything lower than TS 3.1 will only see
 * Jimp as `any`. In order to test the strict versions of these types in our typing
 * test suite, the version has been bumped to 3.1
 */
 
import {
  Jimp as JimpType,
  Bitmap,
  RGB,
  RGBA,
  UnionToIntersection,
  GetPluginVal,
  GetPluginConst,
  GetPluginEncoders,
  GetPluginDecoders,
  JimpConstructors
} from '@jimp/core';
import typeFn from '@jimp/types';
import pluginFn from '@jimp/plugins';
 
type Types = ReturnType<typeof typeFn>;
type Plugins = ReturnType<typeof pluginFn>;
 
type IntersectedPluginTypes = UnionToIntersection<
  GetPluginVal<Types> | GetPluginVal<Plugins>
>;
 
type IntersectedPluginConsts = UnionToIntersection<
  GetPluginConst<Types> | GetPluginConst<Plugins>
>;
 
type IntersectedPluginEncoders = UnionToIntersection<
  GetPluginEncoders<Types> | GetPluginEncoders<Plugins>
>;
 
type IntersectedPluginDecoders = UnionToIntersection<
  GetPluginDecoders<Types> | GetPluginDecoders<Plugins>
>;
 
type Jimp = JimpType & IntersectedPluginTypes;
 
declare const Jimp: JimpConstructors & IntersectedPluginConsts & {
  prototype: Jimp;
  encoders: IntersectedPluginEncoders;
  decoders: IntersectedPluginDecoders;
};
 
export = Jimp;