-
Notifications
You must be signed in to change notification settings - Fork 31
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: export mockHttpClient types #169
Conversation
WalkthroughThe changes enhance the TypeScript declarations in Changes
Sequence Diagram(s)Silently ignored generating this section as the changes are straightforward and primarily involve type declarations without modifying control flow. Poem
Tip Early access features: enabledWe are currently testing the following features in early access:
Note:
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Run & review this pull request in StackBlitz Codeflow. commit: egg-mock
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- index.d.ts (3 hunks)
- index.test-d.ts (2 hunks)
Additional context used
Biome
index.d.ts
[error] 10-10: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
[error] 11-11: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
[error] 94-94: void is confusing inside a union type.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
Additional comments not posted (10)
index.test-d.ts (2)
3-3
: Import statement looks good.The
ResultObject
type is correctly imported from the module.
46-47
: Type assertion looks good.The variable
result
is correctly typed asResultObject
and the type assertion ensures thatstatus
is a number.index.d.ts (8)
8-8
: Export statement looks good.The
MockAgent
is correctly exported.
9-12
: Export statement looks good.The
EggTest
interface is correctly exported.Tools
Biome
[error] 10-10: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
[error] 11-11: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
14-14
: Export statement looks good.The
Methods
type is correctly exported.
Line range hint
16-84
: Export statement looks good.The
BaseMockApplication
interface is correctly exported.Tools
Biome
[error] 10-10: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
[error] 11-11: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
85-92
: Export statement looks good.The
ResultObject
interface is correctly exported.
96-96
: Export statement looks good.The
MockHttpClientResult
type is correctly exported.
130-130
: Export statement looks good.The
EnvType
type is correctly exported.
131-131
: Export statement looks good.The
LogLevel
type is correctly exported.
status?: number; | ||
headers?: any; | ||
delay?: number; | ||
persist?: boolean; | ||
repeats?: number; | ||
} | ||
|
||
type ResultFunction = (url?: string, opts?: any) => ResultObject | string | void; | ||
export type ResultFunction = (url?: string, opts?: any) => ResultObject | string | void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace void
with undefined
in the union type.
Using void
in a union type can be confusing. Replace it with undefined
for better clarity.
- export type ResultFunction = (url?: string, opts?: any) => ResultObject | string | void;
+ export type ResultFunction = (url?: string, opts?: any) => ResultObject | string | undefined;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export type ResultFunction = (url?: string, opts?: any) => ResultObject | string | void; | |
export type ResultFunction = (url?: string, opts?: any) => ResultObject | string | undefined; |
Tools
Biome
[error] 94-94: void is confusing inside a union type.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #169 +/- ##
=======================================
Coverage 85.51% 85.51%
=======================================
Files 27 27
Lines 2623 2623
Branches 472 472
=======================================
Hits 2243 2243
Misses 380 380 ☔ View full report in Codecov by Sentry. |
[skip ci] ## [5.12.2](v5.12.1...v5.12.2) (2024-07-02) ### Bug Fixes * export mockHttpClient types ([#169](#169)) ([ddab25f](ddab25f))
Summary by CodeRabbit
Refactor
Tests