Skip to content

Commit

Permalink
fix(types): expose MqlError
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Oct 5, 2023
1 parent 91b4695 commit 338cac7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install
run: npm install --no-package-lock
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: latest
run_install: true
- name: Test
run: npm test
- name: Report
Expand Down
13 changes: 10 additions & 3 deletions lightweight/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ export type MqlPayload = {
data: MqlResponseData;
statusCode: number;
headers: { [key: string]: string };
more?: string,
code?: string,
url?: string
}

export type MqlResponse = MqlPayload & {
Expand All @@ -164,6 +161,16 @@ export type MqlResponse = MqlPayload & {
};
}

export type MqlError = {
headers: { [key: string]: string };
name: string;
message: string;
status: MqlStatus;
code: string;
more: string;
url: string;
}

declare function mql(
url: string,
opts?: MqlOptions & MicrolinkApiOptions,
Expand Down
2 changes: 1 addition & 1 deletion src/node.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MqlPayload, MqlOptions, MicrolinkApiOptions } from '../lightweight'

export { MqlPayload } from '../lightweight'
export { MqlError, MqlPayload } from '../lightweight'

export type MqlResponse = MqlPayload & {
response: {
Expand Down
3 changes: 0 additions & 3 deletions test/lightweight.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ console.log(result.status)
console.log(result.data)
console.log(result.statusCode)
console.log(result.headers)
console.log(result.more)
console.log(result.code)
console.log(result.url)

/** stream */

Expand Down

1 comment on commit 338cac7

@vercel
Copy link

@vercel vercel bot commented on 338cac7 Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.