Skip to content

Commit

Permalink
fix(component): correct type when using strict mode
Browse files Browse the repository at this point in the history
When an application that depends on ng-recaptcha has tsconfig.json

    "strictNullChecks": true

the `Parameters<T>` utility type fails if the type parameter allows `undefined`.

Closes #211
  • Loading branch information
bbarry authored and DethAriel committed Jan 7, 2021
1 parent 8eb658e commit a687d13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/recaptcha/recaptcha.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import { RECAPTCHA_SETTINGS } from "./tokens";

let nextId = 0;

export type NeverUndefined<T> = T extends undefined ? never : T;

export type RecaptchaErrorParameters = Parameters<
ReCaptchaV2.Parameters["error-callback"]
NeverUndefined<ReCaptchaV2.Parameters["error-callback"]>
>;

@Component({
Expand Down

0 comments on commit a687d13

Please sign in to comment.