Skip to content

Commit

Permalink
fix(nano-server): data type
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD authored and njfamirm committed May 18, 2023
1 parent 887e64f commit f629f3b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/nano-server/src/nano-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ import type {
ParamKeyType,
ParamValueType,
QueryParameters,
Stringifyable,
StringifyableRecord,
UserAuth,
} from '@alwatr/type';
import type {IncomingMessage, ServerResponse} from 'node:http';
import type {Duplex} from 'node:stream';

export type RouteMiddleware<
TData extends StringifyableRecord = StringifyableRecord,
TData extends Stringifyable = Stringifyable,
TMeta extends StringifyableRecord = StringifyableRecord
> = (connection: AlwatrConnection) => MaybePromise<AlwatrServiceResponse<TData, TMeta> | null>;

Expand Down Expand Up @@ -152,7 +153,7 @@ export class AlwatrNanoServer {
* ```
*/
route<
TData extends StringifyableRecord = StringifyableRecord,
TData extends Stringifyable = Stringifyable,
TMeta extends StringifyableRecord = StringifyableRecord
>(method: 'ALL' | Methods, route: 'all' | `/${string}`, middleware: RouteMiddleware<TData, TMeta>): void {
this._logger.logMethodArgs?.('route', {method, route});
Expand Down Expand Up @@ -188,7 +189,7 @@ export class AlwatrNanoServer {
*/
reply(
serverResponse: ServerResponse,
content: AlwatrServiceResponse<StringifyableRecord, StringifyableRecord>,
content: AlwatrServiceResponse<Stringifyable, StringifyableRecord>,
): void {
content.statusCode ??= 200;
this._logger.logMethodArgs?.('reply', {ok: content.ok, statusCode: content.statusCode});
Expand Down

0 comments on commit f629f3b

Please sign in to comment.