[Feature Request] egg-passport 的 index.d.ts 添加支持回调函数
- Dominant language
- TypeScript
- Stars
- 19k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
## Background
我在使用 ctx.app.passport.authenticate 时,翻阅了passport的文档的时候发现可以[自定义回调函数](http://www.passportjs.org/docs/authenticate/),而我在 ts 模板中使用回调函数的时候,代码可以跑通,但是 ts 编译报错,因为 egg-passport 的 index.d.ts 里面定义的第二个参数只能传 AuthenticateOptions 类型
``` js
interface EggPassport extends Authenticator {
authenticate(strategy: string | string[]): AuthenticateRet;
authenticate(strategy: string | string[], options: AuthenticateOptions): AuthenticateRet;
...
}
```
## Proposal
希望能多加一个函数重载以支持在 ts 中使用回调函数
``` js
interface EggPassport extends Authenticator {
authenticate(strategy: string | string[]): AuthenticateRet;
authenticate(strategy: string | string[], options: AuthenticateOptions): AuthenticateRet;
authenticate(strategy: string | string[], callback: function): AuthenticateRet;
...
}
```
Contributor guide
Assessment
This issue has not been assessed yet.