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

Fix issues with typings using classes, publish @core typings, and fix 3.1 typings #792

Merged
merged 10 commits into from
Sep 18, 2019
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"dist",
"es",
"index.d.ts",
"fonts"
"fonts",
"types"
],
"repository": {
"type": "git",
Expand Down
10 changes: 2 additions & 8 deletions packages/jimp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@
"module": "es/index.js",
"browser": "browser/lib/jimp.js",
"types": "types/index.d.ts",
"typesVersions": {
">=3.1.0-0": {
"*": [
"types/ts3.1/index.d.ts"
]
}
},
"tonicExampleFilename": "example.js",
"files": [
"browser",
"dist",
"es",
"index.d.ts",
"fonts"
"fonts",
"types"
],
"repository": {
"type": "git",
Expand Down
26 changes: 13 additions & 13 deletions packages/jimp/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
// TypeScript Version: 2.8

declare const Jimp: Jimp;

export default Jimp;

/**
* @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version
*/
declare class Jimp {
export interface Jimp {
// Constructors
constructor(path: string, cb?: ImageCallback);
crutchcorn marked this conversation as resolved.
Show resolved Hide resolved
constructor(urlOptions: URLOptions, cb?: ImageCallback);
constructor(image: Jimp, cb?: ImageCallback);
constructor(data: Buffer | Bitmap, cb?: ImageCallback);
constructor(w: number, h: number, cb?: ImageCallback);
constructor(
new(path: string, cb?: ImageCallback): Jimp;
new(urlOptions: URLOptions, cb?: ImageCallback): Jimp;
new(image: Jimp, cb?: ImageCallback): Jimp;
new(data: Buffer | Bitmap, cb?: ImageCallback): Jimp;
new(w: number, h: number, cb?: ImageCallback): Jimp;
new(
w: number,
h: number,
background?: number | string,
cb?: ImageCallback
);
): Jimp;
// For custom constructors when using Jimp.appendConstructorOption
constructor(...args: any[]);
new(...args: any[]): Jimp;
prototype: Jimp;

// Constants
Expand Down Expand Up @@ -411,10 +415,6 @@ declare class Jimp {
): this;
}

declare const JimpInst: Jimp;

export default JimpInst;

type GenericCallback<T, U = any, TThis = any> = (
this: TThis,
err: Error | null,
Expand Down