From 6f8a52eed0efe1e0af1e1c764e32ee67b22e0f67 Mon Sep 17 00:00:00 2001 From: Nicklas Date: Fri, 7 Apr 2023 19:26:51 +0200 Subject: [PATCH] fix: decorator types (#1685) I found this issue https://github.com/willsoto/nestjs-prometheus/issues/1667 that had the same errors as me, but the comments didn't help. I also found a different issue https://github.com/nestjs/nest/issues/10959, and the fix they used https://github.com/nestjs/nest/pull/10970, and used that to fix the problem with the InjectMetric decorator. The problem is that the decorator types are wrong. Record fails with strict checks, and the key may also be undefined. Fixes #1667 --- src/injector.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/injector.ts b/src/injector.ts index 2a70d7a4..ce89d33e 100644 --- a/src/injector.ts +++ b/src/injector.ts @@ -23,8 +23,8 @@ import { getToken } from "./metrics"; export function InjectMetric( name: string, ): ( - target: Record, - key: string | symbol, + target: object, + key: string | symbol | undefined, index?: number | undefined, ) => void { const token = getToken(name);