М
Size: a a a
М
ДМ
Д
ДМ

И
И
C
И
A
import {EventEmitter} from 'events';
import {getContent} from "../src/API";
type connectionData = Promise<any>
export class MyStream extends EventEmitter {
private list: Array<string>;
private connection: Array<connectionData>|null = null;
constructor(list: Array<string>) {
super();
this.list = list;
}
getChunk(counter: number): Array<string> {
return this.list.splice(0, counter);
}
getCount():number {
if (!this.connection) {
this.connection = [];
return 50;
}
return 1;
}
start() {
const count = this.getCount();
const start = this.getChunk(count);
start.forEach(item => {
this.emit('request_start', item)
const request = getContent(item);
(this.connection as Array<connectionData>).push(request)
request.then(data => {
this.emit('data', {data, item})
});
});
}
}A
UU

UU
TSError: ⨯ Unable to compile TypeScript:
[0] server/src/routes/message.router.ts(14,17): error TS2769: No overload matches this call.
[0] Overload 1 of 3, '(path: PathParams, ...handlers: RequestHandler<ParamsDictionary, any, any, ParsedQs>[]): Router', gave the following error.
[0] Argument of type 'typeof import("/server/src/middleware/auth.middleware")' is not assignable to parameter of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs>'.
[0] Type 'typeof import("/server/src/middleware/auth.middleware")' provides no match for the signature '(req: Request<ParamsDictionary, any, any, ParsedQs>, res: Response<any, number>, next: NextFunction): void'.
[0] Overload 2 of 3, '(path: PathParams, ...handlers: RequestHandlerParams<ParamsDictionary, any, any, ParsedQs>[]): Router', gave the following error.
[0] Argument of type 'typeof import("/server/src/middleware/auth.middleware")' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any, ParsedQs>'.
[0] Type 'typeof import("/server/src/middleware/auth.middleware")' is missing the following properties from type '(ErrorRequestHandler<ParamsDictionary, any, any, ParsedQs> | RequestHandler<ParamsDictionary, any, any, ParsedQs>)[]': length, pop, push, concat, and 26 more.
Д
Д
Д
UU
C
TSError: ⨯ Unable to compile TypeScript:
[0] server/src/routes/message.router.ts(14,17): error TS2769: No overload matches this call.
[0] Overload 1 of 3, '(path: PathParams, ...handlers: RequestHandler<ParamsDictionary, any, any, ParsedQs>[]): Router', gave the following error.
[0] Argument of type 'typeof import("/server/src/middleware/auth.middleware")' is not assignable to parameter of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs>'.
[0] Type 'typeof import("/server/src/middleware/auth.middleware")' provides no match for the signature '(req: Request<ParamsDictionary, any, any, ParsedQs>, res: Response<any, number>, next: NextFunction): void'.
[0] Overload 2 of 3, '(path: PathParams, ...handlers: RequestHandlerParams<ParamsDictionary, any, any, ParsedQs>[]): Router', gave the following error.
[0] Argument of type 'typeof import("/server/src/middleware/auth.middleware")' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any, ParsedQs>'.
[0] Type 'typeof import("/server/src/middleware/auth.middleware")' is missing the following properties from type '(ErrorRequestHandler<ParamsDictionary, any, any, ParsedQs> | RequestHandler<ParamsDictionary, any, any, ParsedQs>)[]': length, pop, push, concat, and 26 more.
Д