From a687d13e2874f38738002ffba598f5892cb60959 Mon Sep 17 00:00:00 2001 From: Bill Barry Date: Tue, 5 Jan 2021 14:30:40 -0500 Subject: [PATCH] fix(component): correct type when using strict mode When an application that depends on ng-recaptcha has tsconfig.json "strictNullChecks": true the `Parameters` utility type fails if the type parameter allows `undefined`. Closes #211 --- src/recaptcha/recaptcha.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/recaptcha/recaptcha.component.ts b/src/recaptcha/recaptcha.component.ts index b5730f6..c832f34 100644 --- a/src/recaptcha/recaptcha.component.ts +++ b/src/recaptcha/recaptcha.component.ts @@ -19,8 +19,10 @@ import { RECAPTCHA_SETTINGS } from "./tokens"; let nextId = 0; +export type NeverUndefined = T extends undefined ? never : T; + export type RecaptchaErrorParameters = Parameters< - ReCaptchaV2.Parameters["error-callback"] + NeverUndefined >; @Component({