Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: Updated typings #2384

Merged
merged 1 commit into from
Jun 8, 2021
Merged

chore: Updated typings #2384

merged 1 commit into from
Jun 8, 2021

Conversation

deskoh
Copy link
Contributor

@deskoh deskoh commented Jun 8, 2021

Summary

The current generated type definitions for JwtStrategy is as follows:

// jwt.d.ts
parse(req: IncomingMessage): Promise<{
  strategy: string;
  accessToken: string;
}>;

This backwards-compatible PR updates the type definition to:

 parse(req: IncomingMessage): Promise<{
    strategy: string;
    accessToken: string;
} | null>;

This is to allow other projects with strictNullChecks to sub-class JwtStrategy and able to compile without any errors.

node_modules/feathers-authentication-oidc/lib/OidcStrategy.d.ts:9:5 - error TS2416: Property 'parse' in type 'OidcStrategy' is not assignable to the same property in base type 'JWTStrategy'.
  Type '(req: IncomingMessage) => Promise<{ strategy: string; accessToken: string; } | null>' is not assignable to type '(req: IncomingMessage) => Promise<{ strategy: string; accessToken: string; }>'.
    Type 'Promise<{ strategy: string; accessToken: string; } | null>' is not assignable to type 'Promise<{ strategy: string; accessToken: string; }>'.
      Type '{ strategy: string; accessToken: string; } | null' is not assignable to type '{ strategy: string; accessToken: string; }'.
        Type 'null' is not assignable to type '{ strategy: string; accessToken: string; }'.

9     parse(req: IncomingMessage): Promise<{

@daffl
Copy link
Member

daffl commented Jun 8, 2021

Great, thank you! Hopefully we can eventually get everything (including the internal codebase) working with strictNullChecks, too. Will go out in the next prerelease.

@daffl daffl merged commit b6a2672 into feathersjs:dove Jun 8, 2021
@deskoh deskoh deleted the pr branch June 8, 2021 21:55
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants