build: use strict null checks part 5

This commit is contained in:
Kamil Myśliwiec
2024-11-26 14:39:51 +01:00
parent 5b220df118
commit 7d3e5c1a38
75 changed files with 98 additions and 75 deletions

View File

@@ -4,6 +4,7 @@ import * as chaiAsPromised from 'chai-as-promised';
import * as sinon from 'sinon';
import { BarService } from '../src/bar.service';
import { FooService } from '../src/foo.service';
chai.use(chaiAsPromised);
const { expect } = chai;

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -17,17 +17,17 @@ export class WebhooksExplorer {
const { name } = this.discoveryService.getMetadataByDecorator(
Webhook,
wrapper,
);
)!;
return {
name,
handlers: this.metadataScanner
.getAllMethodNames(wrapper.metatype.prototype)
.getAllMethodNames(wrapper.metatype!.prototype)
.map(methodName => {
const { event } = this.discoveryService.getMetadataByDecorator(
WebhookHandler,
wrapper,
methodName,
);
)!;
return {
methodName,
event,

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -20,6 +20,6 @@ export class CatsRequestScopedService {
}
findOneById(id: number): Cat {
return this.cats.find(cat => cat.id === id);
return this.cats.find(cat => cat.id === id)!;
}
}

View File

@@ -20,6 +20,6 @@ export class CatsService {
}
findOneById(id: number): Cat {
return this.cats.find(cat => cat.id === id);
return this.cats.find(cat => cat.id === id)!;
}
}

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -6,7 +6,7 @@ export class CircularModule {
const a = {
module: CircularModule,
providers: [InputService],
b: null,
b: null as any,
};
a.b = a;
return a;

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -100,7 +100,7 @@ describe.skip('Kafka concurrent', function () {
}
}
if (topicMetadata && topicMetadata.topics.length > 0) {
if (topicMetadata! && topicMetadata.topics.length > 0) {
// we have topics, how many partitions do they have?
for (const topic of topicMetadata.topics) {
if (topic.partitions.length < numbersOfServers) {

View File

@@ -123,7 +123,7 @@ describe.skip('Kafka transport', function () {
});
it(`/POST (sync command create user) Concurrency Test`, async () => {
const promises = [];
const promises = [] as Array<Promise<any>>;
for (let concurrencyKey = 0; concurrencyKey < 100; concurrencyKey++) {
const innerUserDto = JSON.parse(JSON.stringify(userDto));
innerUserDto.name += `+${concurrencyKey}`;

View File

@@ -17,7 +17,7 @@ import { SumDto } from './dto/sum.dto';
*/
const explicitPartitioner = () => {
return ({ message }: PartitionerArgs) => {
return parseFloat(message.headers.toPartition.toString());
return parseFloat(message.headers!.toPartition!.toString());
};
};

View File

@@ -138,7 +138,7 @@ export class MqttController {
}
@MessagePattern('wildcard-message/#')
wildcardMessageHandler(data: number[]): number {
wildcardMessageHandler(data: number[]): number | undefined {
if ((data as any).response) {
return;
}
@@ -186,7 +186,7 @@ export class MqttController {
}
@MessagePattern('$share/test-group/shared-wildcard-message/#')
sharedWildcardMessageHandler(data: number[]): number {
sharedWildcardMessageHandler(data: number[]): number | undefined {
if ((data as any).response) {
return;
}

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -11,6 +11,7 @@
"sourceMap": true,
"allowJs": true,
"outDir": "./dist",
"strictNullChecks": true,
"paths": {
"@nestjs/common": ["../../../packages/common"],
"@nestjs/common/*": ["../../../packages/common/*"],

View File

@@ -11,6 +11,7 @@
"sourceMap": true,
"allowJs": true,
"outDir": "./dist",
"strictNullChecks": true,
"paths": {
"@nestjs/common": ["../../../packages/common"],
"@nestjs/common/*": ["../../../packages/common/*"],

View File

@@ -11,6 +11,7 @@
"sourceMap": true,
"allowJs": true,
"outDir": "./dist",
"strictNullChecks": true,
"paths": {
"@nestjs/common": ["../../../packages/common"],
"@nestjs/common/*": ["../../../packages/common/*"],

View File

@@ -11,6 +11,7 @@
"sourceMap": true,
"allowJs": true,
"outDir": "./dist",
"strictNullChecks": true,
"paths": {
"@nestjs/common": ["../../../packages/common"],
"@nestjs/common/*": ["../../../packages/common/*"],

View File

@@ -7,7 +7,7 @@ export class ExpressController {
getRawBody(@Req() req: RawBodyRequest<Request>) {
return {
parsed: req.body,
raw: req.rawBody.toString(),
raw: req.rawBody!.toString(),
};
}
}

View File

@@ -7,7 +7,7 @@ export class FastifyController {
getRawBody(@Req() req: RawBodyRequest<FastifyRequest>) {
return {
parsed: req.body,
raw: req.rawBody.toString(),
raw: req.rawBody!.toString(),
};
}
}

View File

@@ -11,6 +11,7 @@
"sourceMap": true,
"allowJs": true,
"outDir": "./dist",
"strictNullChecks": true,
"paths": {
"@nestjs/common": ["../../../packages/common"],
"@nestjs/common/*": ["../../../packages/common/*"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -9,7 +9,7 @@ export class DurableContextIdStrategy implements ContextIdStrategy {
let tenantSubTreeId: ContextId;
if (tenants.has(tenantId)) {
tenantSubTreeId = tenants.get(tenantId);
tenantSubTreeId = tenants.get(tenantId)!;
} else {
tenantSubTreeId = { id: +tenantId } as ContextId;
tenants.set(tenantId, tenantSubTreeId);

View File

@@ -10,7 +10,7 @@ import { Observable } from 'rxjs';
@Injectable({ scope: Scope.REQUEST })
export class Guard implements CanActivate {
static COUNTER = 0;
static REQUEST_SCOPED_DATA = [];
static REQUEST_SCOPED_DATA = [] as number[];
constructor(@Inject('REQUEST_ID') private readonly requestId: number) {
Guard.COUNTER++;

View File

@@ -11,7 +11,7 @@ import { Observable } from 'rxjs';
@Injectable({ scope: Scope.REQUEST })
export class Interceptor implements NestInterceptor {
static COUNTER = 0;
static REQUEST_SCOPED_DATA = [];
static REQUEST_SCOPED_DATA = [] as number[];
constructor(@Inject('REQUEST_ID') private readonly requestId: number) {
Interceptor.COUNTER++;

View File

@@ -9,7 +9,7 @@ import { UsersService } from './users.service';
@Injectable()
export class UserByIdPipe implements PipeTransform<string> {
static COUNTER = 0;
static REQUEST_SCOPED_DATA = [];
static REQUEST_SCOPED_DATA = [] as number[];
constructor(
@Inject('REQUEST_ID') private readonly requestId: number,

View File

@@ -10,7 +10,7 @@ import { Observable } from 'rxjs';
@Injectable({ scope: Scope.REQUEST })
export class Guard implements CanActivate {
static COUNTER = 0;
static REQUEST_SCOPED_DATA = [];
static REQUEST_SCOPED_DATA = [] as number[];
constructor(@Inject('REQUEST_ID') private readonly requestId: number) {
Guard.COUNTER++;

View File

@@ -11,7 +11,7 @@ import { Observable } from 'rxjs';
@Injectable({ scope: Scope.REQUEST })
export class Interceptor implements NestInterceptor {
static COUNTER = 0;
static REQUEST_SCOPED_DATA = [];
static REQUEST_SCOPED_DATA = [] as number[];
constructor(@Inject('REQUEST_ID') private readonly requestId: number) {
Interceptor.COUNTER++;

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -14,7 +14,7 @@ describe('Custom Versioning (fastify)', () => {
.flatMap(v => v.split(','))
.map(header => header.match(/v(\d+\.?\d*)\+json$/))
.filter(match => match && match.length)
.map(matchArray => matchArray[1])
.map(matchArray => matchArray![1])
.sort()
.reverse();

View File

@@ -11,11 +11,11 @@ describe('Custom Versioning', () => {
?.split(',')
.map(header => header.match(/v(\d+\.?\d*)\+json$/))
.filter(match => match && match.length)
.map(matchArray => matchArray[1])
.map(matchArray => matchArray![1])
.sort()
.reverse();
return versions;
return versions!;
};
let app: INestApplication;

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -11,7 +11,7 @@ describe('ErrorGateway', () => {
const testingModule = await Test.createTestingModule({
providers: [ErrorGateway],
}).compile();
app = testingModule.createNestApplication();
await app.listen(3000);
});

View File

@@ -10,6 +10,7 @@
"target": "ES2021",
"sourceMap": true,
"allowJs": true,
"strictNullChecks": true,
"outDir": "./dist",
"paths": {
"@nestjs/common": ["../../packages/common"],

View File

@@ -139,7 +139,7 @@ export class HttpException extends IntrinsicException {
if (isString(arg0) || Array.isArray(arg0) || isNumber(arg0)) {
return {
message: arg0!,
message: arg0,
error: arg1 as string,
statusCode: statusCode!,
};
@@ -153,7 +153,7 @@ export class HttpException extends IntrinsicException {
): string {
return isString(descriptionOrOptions)
? descriptionOrOptions
: descriptionOrOptions?.description!;
: (descriptionOrOptions?.description as string);
}
public static getHttpExceptionOptionsFrom(

View File

@@ -269,7 +269,7 @@ export class ConfigurableModuleBuilder<
const moduleOptions = {};
const extrasKeys = Object.keys(extras);
Object.keys(input!)
Object.keys(input as object)
.filter(key => !extrasKeys.includes(key))
.forEach(key => {
moduleOptions[key] = input[key];

View File

@@ -77,7 +77,7 @@ export class ParseEnumPipe<T = any> implements PipeTransform<T> {
}
protected isEnum(value: T): boolean {
const enumValues = Object.keys(this.enumType!).map(
const enumValues = Object.keys(this.enumType as object).map(
item => this.enumType[item],
);
return enumValues.includes(value);

View File

@@ -215,7 +215,7 @@ export class ValidationPipe implements PipeTransform<any> {
}
protected toEmptyIfNil<T = any, R = any>(value: T): R | object {
return isNil(value) ? {} : value!;
return isNil(value) ? {} : (value as object);
}
protected stripProtoKeys(value: any) {

View File

@@ -365,7 +365,7 @@ export class Injector {
return item;
};
return [
wrapper.inject?.map?.(mapFactoryProviderInjectArray)!,
wrapper.inject?.map?.(mapFactoryProviderInjectArray) as any[],
optionalDependenciesIds,
];
}

View File

@@ -40,7 +40,7 @@ export class LazyModuleLoader {
moduleClassOrDynamicDefinition,
);
const moduleInstance = this.modulesContainer.get(token)!;
return moduleInstance && this.getTargetModuleRef(moduleInstance)!;
return moduleInstance && this.getTargetModuleRef(moduleInstance);
}
const lazyModulesContainer =
this.createLazyModulesContainer(moduleInstances);

View File

@@ -219,7 +219,7 @@ export class GraphInspector {
targetClassName: target.name,
sourceClassToken: source.token,
targetClassToken: target.token,
targetModuleName: target.host?.name!,
targetModuleName: target.host?.name as string,
keyOrIndex,
injectionType,
},

View File

@@ -338,7 +338,7 @@ export class MiddlewareModule<
}
private getContextId(request: unknown, isTreeDurable: boolean): ContextId {
const contextId = ContextIdFactory.getByRequest(request!);
const contextId = ContextIdFactory.getByRequest(request as object);
if (!request![REQUEST_CONTEXT_ID]) {
Object.defineProperty(request, REQUEST_CONTEXT_ID, {
value: contextId,

View File

@@ -112,8 +112,8 @@ export function isMiddlewareRouteExcluded(
if (excludedRoutes.length <= 0) {
return false;
}
const reqMethod = httpAdapter.getRequestMethod?.(req)!;
const originalUrl = httpAdapter.getRequestUrl?.(req)!;
const reqMethod = httpAdapter.getRequestMethod!(req);
const originalUrl = httpAdapter.getRequestUrl!(req);
const queryParamsIndex = originalUrl ? originalUrl.indexOf('?') : -1;
const pathname =
queryParamsIndex >= 0

View File

@@ -115,7 +115,7 @@ export class ReplContext {
return typeof token !== 'string'
? typeof token === 'function'
? token.name
: token?.toString()!
: (token?.toString() as string)
: `"${token}"`;
}

View File

@@ -447,7 +447,7 @@ export class RouterExecutionContext {
result,
(res as any).raw || res,
(req as any).raw || req,
{ additionalHeaders: res.getHeaders?.()! },
{ additionalHeaders: res.getHeaders!() },
);
};
}

View File

@@ -314,13 +314,13 @@ export class DependenciesScanner {
),
);
methodInjectables.forEach(methodInjectable => {
methodInjectable.metadata!.forEach(injectable =>
methodInjectable.metadata.forEach(injectable =>
this.insertInjectable(
injectable,
token,
component,
ENHANCER_KEY_TO_SUBTYPE_MAP[metadataKey],
methodInjectable.methodKey!,
methodInjectable.methodKey,
),
);
});

View File

@@ -37,7 +37,7 @@ describe('provider classifier', () => {
it('should return false if provider is undefined', () => {
const classProvider = undefined!;
expect(isClassProvider(classProvider as ClassProvider)!).to.be.false;
expect(isClassProvider(classProvider)).to.be.false;
});
});

View File

@@ -78,7 +78,7 @@ export class ClientKafka
'No producer initialized. Please, call the "connect" method first.',
);
}
return this._producer!;
return this._producer;
}
constructor(protected readonly options: Required<KafkaOptions>['options']) {

View File

@@ -20,8 +20,8 @@ let natsPackage = {} as any;
// type Client = import('nats').NatsConnection;
// type NatsMsg = import('nats').Msg;
type Client = any;
type NatsMsg = any;
type Client = Record<string, any>;
type NatsMsg = Record<string, any>;
/**
* @publicApi
@@ -216,12 +216,12 @@ export class ClientNats extends ClientProxy<NatsEvents, NatsStatus> {
callback,
);
const subscription = this.natsClient.subscribe(inbox, {
const subscription = this.natsClient!.subscribe(inbox, {
callback: subscriptionHandler,
});
const headers = this.mergeHeaders(serializedPacket.headers);
this.natsClient.publish(channel, serializedPacket.data, {
this.natsClient!.publish(channel, serializedPacket.data, {
reply: inbox,
headers,
});
@@ -240,7 +240,7 @@ export class ClientNats extends ClientProxy<NatsEvents, NatsStatus> {
return new Promise<void>((resolve, reject) => {
try {
this.natsClient.publish(pattern, serializedPacket.data, {
this.natsClient!.publish(pattern, serializedPacket.data, {
headers,
});
resolve();

View File

@@ -198,7 +198,7 @@ export abstract class ClientProxy<
prop: Attribute,
defaultValue: DefaultValue = undefined as DefaultValue,
) {
return obj && prop in obj ? obj![prop] : defaultValue;
return obj && prop in obj ? (obj as any)[prop] : defaultValue;
}
protected normalizePattern(pattern: MsPattern): string {

View File

@@ -1,5 +1,3 @@
/* eslint-disable prefer-spread */
import {
ArgumentsHost,
IntrinsicException,

View File

@@ -18,8 +18,9 @@ export class RpcException extends Error {
) {
this.message = (this.error as Record<string, any>).message;
} else if (this.constructor) {
this.message =
this.constructor!.name!.match(/[A-Z][a-z]+|[0-9]+/g)!.join(' ');
this.message = this.constructor.name
.match(/[A-Z][a-z]+|[0-9]+/g)!
.join(' ');
}
}

View File

@@ -167,7 +167,7 @@ export class ListenersController {
{
type: 'microservice',
methodName: definition.methodKey,
className: instanceWrapper.metatype?.name!,
className: instanceWrapper.metatype?.name as string,
classNodeId: instanceWrapper.id,
metadata: {
key: definition.patterns.toString(),

View File

@@ -32,7 +32,7 @@ export class ServerFactory {
case Transport.MQTT:
return new ServerMqtt(options as Required<MqttOptions>['options']);
case Transport.GRPC:
return new ServerGrpc(options as Required<GrpcOptions>['options']);
return new ServerGrpc(options);
case Transport.KAFKA:
return new ServerKafka(options as Required<KafkaOptions>['options']);
case Transport.RMQ:

View File

@@ -75,7 +75,7 @@ export class ServerRedis extends Server<RedisEvents, RedisStatus> {
}
public start(callback?: () => void) {
Promise.all([this.subClient.connect(), this.pubClient.connect()])
void Promise.all([this.subClient.connect(), this.pubClient.connect()])
.then(() => {
this.bindEvents(this.subClient, this.pubClient);
callback?.();

View File

@@ -219,7 +219,7 @@ export abstract class Server<
prop: Attribute,
defaultValue: DefaultValue = undefined as DefaultValue,
) {
return obj && prop in obj ? obj![prop] : defaultValue;
return obj && prop in obj ? (obj as any)[prop] : defaultValue;
}
protected handleError(error: string) {

View File

@@ -687,7 +687,7 @@ describe('ClientKafka', () => {
assignPacketIdStub = sinon
.stub(client as any, 'assignPacketId')
.callsFake(packet =>
Object.assign(packet!, {
Object.assign(packet as object, {
id: correlationId,
}),
);

View File

@@ -58,7 +58,7 @@ describe('ClientMqtt', () => {
connectSpy = sinon.stub(client, 'connect');
assignStub = sinon
.stub(client, 'assignPacketId' as any)
.callsFake(packet => Object.assign(packet!, { id }));
.callsFake(packet => Object.assign(packet as object, { id }));
});
afterEach(() => {
connectSpy.restore();

View File

@@ -88,7 +88,7 @@ describe('ClientNats', () => {
callback = sinon.spy();
assignStub = sinon
.stub(client, 'assignPacketId' as any)
.callsFake(packet => Object.assign(packet!, { id }));
.callsFake(packet => Object.assign(packet as object, { id }));
subscription = client['publish'](msg, callback);
subscription();

View File

@@ -93,7 +93,7 @@ describe('ClientRedis', () => {
callback = sinon.spy();
assignStub = sinon
.stub(client, 'assignPacketId' as any)
.callsFake(packet => Object.assign(packet!, { id }));
.callsFake(packet => Object.assign(packet as object, { id }));
getReplyPatternStub = sinon
.stub(client, 'getReplyPattern')

View File

@@ -176,16 +176,16 @@ describe('JsonSocket connection', () => {
server.once('connection', socket => {
const serverSocket = new JsonSocket(socket);
serverSocket!.once('end', () => {
serverSocket.once('end', () => {
setTimeout(() => {
expect(serverSocket!['isClosed']).to.equal(true);
expect(clientSocket!['isClosed']).to.equal(true);
expect(serverSocket['isClosed']).to.equal(true);
expect(clientSocket['isClosed']).to.equal(true);
clientSocket!.on(TcpEventsMap.CONNECT, () => {
clientSocket.on(TcpEventsMap.CONNECT, () => {
setTimeout(() => {
expect(clientSocket!['isClosed']).to.equal(false);
expect(clientSocket['isClosed']).to.equal(false);
clientSocket!.end();
clientSocket.end();
server.close(done);
}, 10);
});
@@ -196,11 +196,11 @@ describe('JsonSocket connection', () => {
}
const port2 = (address2 as AddressInfo).port;
clientSocket!.connect(port2, ip);
clientSocket.connect(port2, ip);
}, 10);
});
clientSocket!.end();
clientSocket.end();
});
const address1 = server.address();
@@ -209,7 +209,7 @@ describe('JsonSocket connection', () => {
}
const port1 = (address1 as AddressInfo).port;
clientSocket!.connect(port1, ip);
clientSocket.connect(port1, ip);
});
server.listen();
});

View File

@@ -393,9 +393,7 @@ describe('ServerKafka', () => {
await server.handleMessage(payload);
expect(
getPublisherSpy.calledWith({
id: payload.message!.headers![
KafkaHeaders.CORRELATION_ID
]!.toString(),
id: payload.message.headers![KafkaHeaders.CORRELATION_ID]!.toString(),
err: NO_MESSAGE_HANDLER,
}),
).to.be.true;
@@ -455,7 +453,7 @@ describe('ServerKafka', () => {
response: messageValue,
},
replyTopic,
undefined!,
'',
correlationId,
);

View File

@@ -268,7 +268,7 @@ export class ExpressAdapter extends AbstractHttpAdapter<
options?: Omit<Options, 'verify'>,
): this {
const parserOptions = getBodyParserOptions<Options>(rawBody, options);
const parser = bodyparser[type](parserOptions!);
const parser = bodyparser[type](parserOptions);
this.use(parser);

View File

@@ -428,7 +428,7 @@ export class FastifyAdapter<
response.statusCode = statusCode;
return response;
}
return (response as TReply).code(statusCode);
return (response as { code: Function }).code(statusCode);
}
public end(response: TReply, message?: string) {

View File

@@ -15,8 +15,9 @@ export class WsException extends Error {
) {
this.message = (this.error as Record<string, any>).message;
} else if (this.constructor) {
this.message =
this.constructor!.name!.match(/[A-Z][a-z]+|[0-9]+/g)!.join(' ');
this.message = this.constructor.name
.match(/[A-Z][a-z]+|[0-9]+/g)!
.join(' ');
}
}