We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Если сделать вот так, то method выводится как const method: de.DescriptHttpBlock<Context, any, any>
method
const method: de.DescriptHttpBlock<Context, any, any>
Если убрать дженерик из de.http, то все ломается, потому что method превращается в const method: de.DescriptHttpBlock<unknown, unknown, unknown>.
const method: de.DescriptHttpBlock<unknown, unknown, unknown>
Идеальный для меня вариантом было бы писать вот так:
import de from 'descript'; interface Context { foo: string; } // определяем базовый http-блок с общим для всех Context // params и result будут определены в конкретных блоках const baseHttpBlock = de.http<Context, unknown, unknown>({ block: { family: 6, timeout: 1000, }, }); interface Params { param1: string; } interface ResultIn { status_code: number; result: { bar: string; foo: string; } } interface ResultOut { bar: string; } const method = baseHttpBlock<Params, ResultIn, ResultOut>({ block: { method: 'GET', pathname: '/pathname', // автовывод Params query: ({ params }) => { return { param1: params.param1, }; }, }, options: { // автовывод ResultIn и ResultOut after: ({ result }) => result.bar, }, });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Если сделать вот так, то
method
выводится какconst method: de.DescriptHttpBlock<Context, any, any>
Если убрать дженерик из de.http, то все ломается, потому что
method
превращается вconst method: de.DescriptHttpBlock<unknown, unknown, unknown>
.Идеальный для меня вариантом было бы писать вот так:
The text was updated successfully, but these errors were encountered: