Skip to content

Commit 54394f0

Browse files
committed
fix(node): Make fastify types more broad
1 parent f6a3e02 commit 54394f0

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

dev-packages/e2e-tests/test-applications/node-fastify-app/src/app.js renamed to dev-packages/e2e-tests/test-applications/node-fastify-app/src/app.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
require('./tracing');
2-
31
const Sentry = require('@sentry/node');
2+
3+
Sentry.init({
4+
environment: 'qa', // dynamic sampling bias to keep transactions
5+
dsn: process.env.E2E_TEST_DSN,
6+
integrations: [],
7+
tracesSampleRate: 1,
8+
tunnel: 'http://localhost:3031/', // proxy server
9+
tracePropagationTargets: ['http://localhost:3030', '/external-allowed'],
10+
});
11+
12+
// Make sure fastify is imported after Sentry is initialized
413
const { fastify } = require('fastify');
514
const http = require('http');
615

@@ -103,7 +112,7 @@ app2.listen({ port: port2 });
103112

104113
function makeHttpRequest(url) {
105114
return new Promise(resolve => {
106-
const data = [];
115+
const data: any[] = [];
107116

108117
http
109118
.request(url, httpRes => {

dev-packages/e2e-tests/test-applications/node-fastify-app/src/tracing.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/node/src/integrations/tracing/fastify.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ export const fastifyIntegration = defineIntegration(_fastifyIntegration);
3131

3232
// We inline the types we care about here
3333
interface Fastify {
34-
register: (plugin: unknown) => void;
35-
addHook: (hook: string, handler: (request: unknown, reply: unknown, error: Error) => void) => void;
34+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
35+
register: (plugin: any) => void;
36+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
37+
addHook: (hook: string, handler: (request: any, reply: any, error: Error) => void) => void;
3638
}
3739

3840
/**
@@ -53,7 +55,7 @@ interface FastifyRequestRouteInfo {
5355
*/
5456
export function setupFastifyErrorHandler(fastify: Fastify): void {
5557
const plugin = Object.assign(
56-
function (fastify: Fastify, options: unknown, done: () => void): void {
58+
function (fastify: Fastify, _options: unknown, done: () => void): void {
5759
fastify.addHook('onError', async (_request, _reply, error) => {
5860
captureException(error);
5961
});

0 commit comments

Comments
 (0)