-
Notifications
You must be signed in to change notification settings - Fork 34
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: published types from package #144
Conversation
WalkthroughThe recent changes in the Changes
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 (
|
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: 0
Outside diff range and nitpick comments (1)
packages/common/src/services/file-upload.service.ts (1)
Line range hint
119-123
: Remove the redundant else clause.The else clause is redundant and can be omitted to simplify the code.
- else{ - this.logger.error(`Error downloading file: File does not exist`); - return null; - } + this.logger.error(`Error downloading file: File does not exist`); + return null;
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- packages/common/package.json (3 hunks)
- packages/common/src/interfaces/fastify-multipart.d.ts (1 hunks)
- packages/common/src/interfaces/file-upload.interface.ts (2 hunks)
- packages/common/src/services/file-upload.service.ts (2 hunks)
- packages/common/tsconfig.json (2 hunks)
Additional context used
Biome
packages/common/src/services/file-upload.service.ts
[error] 113-123: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 119-122: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
Additional comments not posted (12)
packages/common/src/interfaces/file-upload.interface.ts (1)
1-1
: Importing theMultipartFields
type is correct.The import statement correctly brings in the
MultipartFields
type fromfastify-multipart
.packages/common/src/interfaces/fastify-multipart.d.ts (3)
1-1
: Declare module 'fastify-multipart' correctly.Declaring a module augmentation for 'fastify-multipart' is correct and ensures the new interfaces are available globally.
2-11
: DefineParsedPart
interface correctly.The
ParsedPart
interface is well-defined and covers all necessary fields for handling multipart data.
13-15
: DefineMultipartFields
interface correctly.The
MultipartFields
interface is well-defined and supports both single and multipleParsedPart
entries.packages/common/tsconfig.json (2)
5-5
: SpecifydeclarationDir
correctly.The
declarationDir
option ensures that type declarations are generated in the./dist/types
directory, which is a good practice.
16-20
: Enable strict type checking options.Enabling strict type checking options like
strictNullChecks
,noImplicitAny
,strictBindCallApply
,forceConsistentCasingInFileNames
, andnoFallthroughCasesInSwitch
improves code quality and type safety.packages/common/package.json (4)
18-18
: Addtypes
field correctly.The
types
field ensures that the type declarations are correctly referenced in the package.
20-21
: Includetypes
directory infiles
field.Including the
types
directory in thefiles
field ensures that the type declarations are included in the published package.
27-27
: Addclean
script correctly.The
clean
script usesrimraf
to remove thedist
andtypes
directories, which is useful for cleaning up the build artifacts.
64-66
: Add necessary type dependencies.Adding
@types/cache-manager-redis-store
and@types/fastify-multipart
ensures that type definitions are available for these packages.packages/common/src/services/file-upload.service.ts (2)
26-30
: LGTM! But verify environment variables.The changes improve type safety by casting environment variables to specific types.
However, ensure that all environment variables (
STORAGE_ENDPOINT
,STORAGE_PORT
,STORAGE_ACCESS_KEY
,STORAGE_SECRET_KEY
) are always set correctly.
48-48
: LGTM! But verify error handling.The change improves type safety by specifying the type of the
err
parameter in the callback function.However, ensure that the callback function handles errors correctly and consistently.
Verification successful
Error handling in the callback function is correctly implemented.
The callback function logs the error and rejects the promise if an error occurs, which is a proper error handling mechanism.
- The error is logged using
console.log('err: ', err);
- The promise is rejected with
reject(err);
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify error handling in the callback function. # Test: Search for the callback function usage. Expect: Proper error handling. rg --type typescript $'function (err: Error | null)'Length of output: 88
Script:
#!/bin/bash # Description: Verify error handling in the callback function. # Test: Search for the callback function usage. Expect: Proper error handling. rg --type ts $'function (err: Error | null)'Length of output: 45
Script:
#!/bin/bash # Description: Verify error handling in the `uploadToMinio` function. # Find the definition of the `uploadToMinio` function. rg 'function uploadToMinio' # Find the usage of the `uploadToMinio` function. rg 'uploadToMinio('Length of output: 130
Script:
#!/bin/bash # Description: Verify error handling in the `uploadToMinio` function. # Find the definition of the `uploadToMinio` function. rg 'function uploadToMinio' # Find the usage of the `uploadToMinio` function. rg 'uploadToMinio\('Length of output: 285
Script:
#!/bin/bash # Description: Extract the implementation of the `uploadToMinio` function. # Extract the implementation of the `uploadToMinio` function from the specified file. ast-grep --lang typescript --pattern 'async uploadToMinio($_, $_): Promise<string> { $$$ }' packages/common/src/services/file-upload.service.tsLength of output: 620
Script:
#!/bin/bash # Description: Extract the implementation of the `uploadToMinio` function using a simplified pattern. # Extract the implementation of the `uploadToMinio` function definition. ast-grep --lang typescript --pattern 'async uploadToMinio($_, $_): Promise<string> { $$$ }' packages/common/src/services/file-upload.service.ts # Extract the body of the `uploadToMinio` function. rg -A 20 'async uploadToMinio' packages/common/src/services/file-upload.service.tsLength of output: 1373
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.
closing this because #147 has the improvements
Checklist
Make sure you have
@nestjs/swagger
decorators wherever requiredDescription
type declarations
for all packages within Stencil.tsconfig.json
to generate.d.ts
files and included them in the build process.package.json
to reference the generated type definitions.Demo
https://drive.google.com/uc?id=1so9yliRJ_74WfFNqSrhaWhK3rWWta6CP&export=download
Summary by CodeRabbit
New Features
Chores
"clean"
script to the package configuration.Refactor
Documentation
tsconfig.json
settings to improve code quality and consistency.