Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Mar 17, 2024
1 parent 8d403af commit 1543685
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/node.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import { MqlError, MqlPayload, MqlOptions } from '../lightweight';

import { MqlPayload, MqlOptions } from '../lightweight';
export { MicrolinkError, MqlError, MqlPayload } from '../lightweight'

import { Response, Options as GotOpts } from 'got/dist/source/core'

export type HTTPResponse = Response<Buffer>

type HTTPResponseWithBody = HTTPResponse & { body: MqlPayload };
type HTTPResponseWithBody = Response & { body: MqlPayload };

type HTTPResponseRaw = HTTPResponse & { body: Buffer };
type HTTPResponseRaw = Response & { body: Buffer };

export type MqlResponse = MqlPayload & { response: HTTPResponseWithBody };

interface Mql {
(url: string, opts?: MqlOptions & { stream: string }, gotOpts?: GotOpts): Promise<HTTPResponse>;
(url: string, opts?: MqlOptions & { stream: string }, gotOpts?: GotOpts): Promise<HTTPResponseRaw>;
(url: string, opts?: MqlOptions, gotOpts?: GotOpts): Promise<MqlResponse>;
extend: (gotOpts?: GotOpts) => Mql;
stream: (url: string, gotOpts?: GotOpts) => NodeJS.ReadableStream;
buffer: (url: string, opts?: MqlOptions, gotOpts?: GotOpts) => Promise<HTTPResponseRaw>;
MicrolinkError: new (props: object) => MqlError;
version: string;
}

Expand Down

0 comments on commit 1543685

Please sign in to comment.