From cee85c57512032713b641bc2944f03ed3d1c72c0 Mon Sep 17 00:00:00 2001 From: Egor Dydykin Date: Fri, 8 Nov 2024 15:47:29 +0300 Subject: [PATCH 1/2] v4: types fixes --- lib/index.ts | 3 ++- lib/types.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/index.ts b/lib/index.ts index 9d52dae..7583c29 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -23,6 +23,7 @@ import type { InferResultFromBlock, InferParamsInFromBlock, InferBlock, + InferHttpBlock, } from './types'; import type BaseBlock from './block'; import type { DescriptHttpBlockDescription, DescriptHttpBlockQuery, DescriptHttpBlockQueryValue } from './httpBlock'; @@ -205,6 +206,6 @@ export { DescriptBlockDeps, BaseBlock, BlockResultOut, - + InferHttpBlock, HttpBlock, }; diff --git a/lib/types.ts b/lib/types.ts index aeead71..d2f6c06 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -7,6 +7,7 @@ import type DescriptLogger from './logger'; import type { IncomingHttpHeaders } from 'http'; import type { EventTimestamps } from './logger'; import type { RequestOptions } from './request'; +import type HttpBlock from './httpBlock'; export interface DescriptHttpBlockResult { statusCode: number; @@ -122,6 +123,13 @@ infer Context, infer CustomBlock, infer ParamsOut, infer ResultOut, infer Interm infer BlockResult, infer BeforeResultOut, infer AfterResultOut, infer ErrorResultOut, infer Params > ? Type : never; +export type InferHttpBlock = Type extends HttpBlock< +// eslint-disable-next-line @typescript-eslint/no-unused-vars +infer Context, infer ParamsOut, infer HttpResult, infer ResultOut, infer BlockResult, +// eslint-disable-next-line @typescript-eslint/no-unused-vars +infer BeforeResultOut, infer AfterResultOut, infer ErrorResultOut, infer Params +> ? Type : never; + export type InferContextFromBlock< T > = T extends BaseBlock< // eslint-disable-next-line @typescript-eslint/no-unused-vars infer Context, infer CustomBlock, infer ParamsOut, infer ResultOut, infer IntermediateResult, From 6ed337adaf4a26d1384bde02d8de0c47d1ce5aef Mon Sep 17 00:00:00 2001 From: Egor Dydykin Date: Fri, 8 Nov 2024 15:48:22 +0300 Subject: [PATCH 2/2] v4: types fixes --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3310d70..20dbc03 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ }, "name": "descript", "description": "descript", - "version": "3.4.0", + "version": "3.4.1", "homepage": "https://github.com/pasaran/descript3", "repository": { "type": "git",