From 95761c05d87c806bcfb8eb8ba64656d4c31fd3b9 Mon Sep 17 00:00:00 2001 From: stdpi Date: Tue, 4 Jun 2024 17:24:03 +0700 Subject: [PATCH] fix: anything around stupid ts code (squashed) fix: whatever apparently 1.1.3 never works fix: commonjs option? fix: dfy2c fix: wrong shcema --- package.json | 8 ++++---- src/index.ts | 11 ++++++++--- src/models.ts | 2 +- tsconfig.json | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 5004c50..fa2b1ce 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "@team-fuho/wt", - "version": "1.1.3", + "version": "1.1.7", "description": "", - "type": "module", - "main": "dist/src/index.js", - "types": "dist/src/index.d.ts", + "type": "commonjs", + "main": "dist/index.js", + "types": "dist/index.d.ts", "files": [ "/dist" ], diff --git a/src/index.ts b/src/index.ts index f2aaaec..4abb051 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,10 +52,15 @@ export class Model { } /** - * @todo generic return type + * @description to return stuff, ofc */ - async query(options: GenericParameter, id?: number): Promise<(TResponse & T)[]> { - return fetch(this.requestBuilder(options, id)).then((ok) => ok.json()); + async query(options: GenericParameter, id?: number, init?: RequestInit): Promise<{ + meta: { + total_count: Number + }, + items: (TResponse & T)[] + }> { + return fetch(this.requestBuilder(options, id), Object.assign({}, init)).then((ok) => ok.json()); } } diff --git a/src/models.ts b/src/models.ts index d5a9f73..53b3723 100644 --- a/src/models.ts +++ b/src/models.ts @@ -5,7 +5,7 @@ export function BlogPage(ctx: Context) { intro: string, body: string, thumbnail_set: Record - }>("gallery.Picture", ctx) + }>("blog.BlogPage", ctx) } export function GalleryPicture(ctx: Context) { diff --git a/tsconfig.json b/tsconfig.json index 6a8f1fe..7792b24 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "commonjs", + "module": "CommonJS", "target": "ESNext", "declaration": true, "outDir": "./dist"