Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
223 changes: 0 additions & 223 deletions .eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions docs/typescript-examples/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ de.run(block4, {
console.log(result);
});


const bfn1 = de.func({
block: ({ params }: { params: { p1: number } }) => {
return {
Expand All @@ -116,7 +115,6 @@ const bfn1 = de.func({
},
});


const bfn2 = de.func({
block: ({ params }: { params: { p2: string } }) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion docs/typescript-examples/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { DescriptHttpBlockResult } from '../../lib/types';
const block1 = de.http({
block: {},
options: {
//TODO как указать тип blockResult?
// TODO как указать тип blockResult?
after: ({ result }: { result: DescriptHttpBlockResult<string> }) => {
if (de.isError(result)) {
return result.error.id;
Expand Down
2 changes: 0 additions & 2 deletions docs/typescript-examples/first.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ de.run(block4, {
console.log(result);
});


const bfn1 = de.func({
block: ({ params }: { params: { p1: number } }) => {
return {
Expand All @@ -122,7 +121,6 @@ const bfn1 = de.func({
},
});


const bfn2 = de.func({
block: ({ params }: { params: { p2: string } }) => {
return {
Expand Down
6 changes: 2 additions & 4 deletions docs/typescript-examples/func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ const block3 = block2.extend({
},
});


de.run(block3, {
params: {
param2: 2,
Expand All @@ -92,7 +91,6 @@ de.run(block3, {
console.log(result);
});


const objBlock = de.object({
block: {
foo: block1,
Expand All @@ -103,9 +101,9 @@ const objBlock = de.object({
const block4 = de.func({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
block: ({ params }) => {
//TODO не выводится params.
// TODO не выводится params.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
//const x = params.id;
// const x = params.id;
return objBlock;
},
options: {
Expand Down
14 changes: 6 additions & 8 deletions docs/typescript-examples/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { DEFAULT_OPTIONS } from '../../lib/request';

// --------------------------------------------------------------------------------------------------------------- //


interface ParamsIn1 {
id1: string;
}
Expand All @@ -22,7 +21,7 @@ const block1 = de.http({
return null;
}

if (headers['content-type']?.startsWith('application/json')) {
if (headers[ 'content-type' ]?.startsWith('application/json')) {
return JSON.parse(body.toString('utf-8'));
} else {
return body;
Expand Down Expand Up @@ -57,7 +56,7 @@ const block1 = de.http({

options: ({
before: () => {
//TODO возврат результата и типизация в after
// TODO возврат результата и типизация в after
// return {
// d: 1,
// };
Expand All @@ -73,8 +72,8 @@ const block1 = de.http({
};
},

//TODO автовыведение ResultIn1
after: ({ params, result }: { params: { s1: ParamsIn1['id1']}; result: DescriptHttpBlockResult<ResultIn1> }) => {
// TODO автовыведение ResultIn1
after: ({ params, result }: { params: { s1: ParamsIn1['id1'] }; result: DescriptHttpBlockResult<ResultIn1> }) => {
return {
a: params.s1,
b: result.result.foo,
Expand All @@ -98,14 +97,13 @@ interface ParamsIn2 {

const block2 = block1.extend({
options: ({
params: ({ params }: { params: ParamsIn2 & ParamsIn1}) => {
params: ({ params }: { params: ParamsIn2 & ParamsIn1 }) => {
return {
id1: params.id1,
s2: params.id2,
};
},


after: ({ params, result }) => {
return {
...result,
Expand All @@ -117,7 +115,7 @@ const block2 = block1.extend({
});

de.run(block2, {
//TODO что за undefined?
// TODO что за undefined?
params: {
id1: '12345',
id2: '12345',
Expand Down
Loading