Skip to content

Typing of the result of getAuthenticateOptions is misleading/incorrect #947

Open
@eesdil

Description

@eesdil

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Current typing is:

getAuthenticateOptions(context): IAuthModuleOptions | undefined;

export interface IAuthModuleOptions<T = any> {
  defaultStrategy?: string | string[];
  session?: boolean;
  property?: string;
  [key: string]: any;
}

It is allowing/suggesting that the defaultStrategy can be passed, which in fact is ignored.
Also it is not showing that a promise can be used.

Minimum reproduction code

https://github.com/nestjs/passport/blob/master/lib/auth.guard.ts

Steps to reproduce

No response

Expected behavior

Disable adding the defaultStrategy with using different signature, something like: Omit<IAuthModuleOptions, 'defaultStrategy'>
Plus having the Promise<Omit<IAuthModuleOptions, 'defaultStrategy'>> also.

Package version

8.2.2

Passport version

No response

NestJS version

No response

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions