Skip to content

Commit b55df1d

Browse files
committed
fix: export missing types
1 parent d7455bf commit b55df1d

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

lightweight/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type ColorScheme = 'dark' | 'light'
1+
export type ColorScheme = 'dark' | 'light'
22

33
type WaitUntilEvent =
44
| 'load'

src/node.d.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
import { MqlPayload, MqlOptions } from '../lightweight';
2-
export { MicrolinkApiOptions, MicrolinkError, MqlError, MqlPayload } from '../lightweight'
2+
3+
export {
4+
ColorScheme,
5+
MicrolinkApiOptions,
6+
MicrolinkError,
7+
MqlError,
8+
MqlOptions,
9+
MqlPayload,
10+
MqlResponseData,
11+
version
12+
} from '../lightweight';
313

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

616
type HTTPResponseWithBody = Response & { body: MqlPayload };
717

8-
type HTTPResponseRaw = Response & { body: Buffer };
18+
export type HTTPResponseRaw = Response & { body: Buffer };
919

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

test/lightweight.test-d.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
import mql, { MicrolinkError } from '../lightweight'
1+
import mql, { MicrolinkError, version } from '../lightweight'
22
import type { MqlError } from '../lightweight'
33

4+
/** version */
5+
6+
;(async () => {
7+
console.log(version)
8+
})()
9+
10+
411
/** error */
512

613
;(async () => {
@@ -141,6 +148,7 @@ console.log(result.statusCode)
141148
console.log(result.headers)
142149

143150
/** error */
151+
144152
;({
145153
status: 'error',
146154
data: { url: 'fetch failed' },
@@ -153,6 +161,7 @@ console.log(result.headers)
153161
message: 'EFATALCLIENT, fetch failed',
154162
description: 'fetch failed'
155163
} as MqlError)
164+
156165
;({
157166
status: 'fail',
158167
code: 'EAUTH',

test/node.test-d.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1-
import mql, { MicrolinkError } from '../src/node'
1+
import mql, { MicrolinkError, version } from '../src/node'
2+
import type { MqlError } from '../lightweight'
3+
4+
/** version */
5+
6+
;(async () => {
7+
console.log(version)
8+
})()
29

310
/** error */
411

12+
;({
13+
status: 'error',
14+
data: { url: 'fetch failed' },
15+
more: 'https://microlink.io/efatalclient',
16+
code: 'EFATALCLIENT',
17+
url: 'https://localhost.microlink.io?url=https%3A%2F%2Fexample.com%23t%3D1696503516588',
18+
statusCode: undefined,
19+
headers: {},
20+
name: 'MicrolinkError',
21+
message: 'EFATALCLIENT, fetch failed',
22+
description: 'fetch failed'
23+
} as MqlError)
24+
525
;(async () => {
626
const error = new MicrolinkError({
727
status: 'fail',

0 commit comments

Comments
 (0)