Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: IMiddleware interface #2242

Merged
merged 1 commit into from
Aug 16, 2022
Merged

Conversation

ilyydy
Copy link
Contributor

@ilyydy ilyydy commented Aug 16, 2022

fixes #2241

tsconfig 开启 strictFunctionTypes 时,方法参数必须逆变。以下为一示例:

interface Obj {
  f: (n: number) => any;
  g: (n?: number) => any;
}

class O1 implements Obj {
  f: () => 1; // Ok
  g: () => 1; // Ok
}

class O2 implements Obj {
  f: (n: number) => 1; // Ok
  g: (n: number) => 1; // Error, 类型“O2”中的属性“g”不可分配给基类型“Obj”中的同一属性
}

@gitpod-io
Copy link

gitpod-io bot commented Aug 16, 2022

@codecov-commenter
Copy link

codecov-commenter commented Aug 16, 2022

Codecov Report

Merging #2242 (c6e6e20) into main (5eae117) will decrease coverage by 0.13%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2242      +/-   ##
==========================================
- Coverage   82.51%   82.38%   -0.14%     
==========================================
  Files         434      434              
  Lines       15240    15240              
  Branches     3606     3606              
==========================================
- Hits        12576    12555      -21     
- Misses       2437     2455      +18     
- Partials      227      230       +3     
Impacted Files Coverage Δ
packages/core/src/interface.ts 100.00% <ø> (ø)
packages/oss/src/manager.ts 38.88% <0.00%> (-50.00%) ⬇️
packages/oss/src/configuration.ts 60.00% <0.00%> (-40.00%) ⬇️
packages/upload/src/parse.ts 92.91% <0.00%> (-0.79%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@czy88840616 czy88840616 merged commit 1b435fb into midwayjs:main Aug 16, 2022
@ilyydy ilyydy deleted the fix/IMiddleware-type branch August 17, 2022 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

中间件 match 的类型问题
3 participants