-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: tsc error #3362
fix: tsc error #3362
Conversation
🦋 Changeset detectedLatest commit: fb0a094 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughA patch was made to address TypeScript compiler errors, and various components were updated to improve type safety and consistency. This includes adjustments in type declarations, handling of state, and component rendering logic. These changes aim to enhance reliability and maintainability, particularly in handling dynamic collections, ensuring better developer experience with fewer type-related issues. Changes
Assessment against linked issues
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: 1
Outside diff range and nitpick comments (1)
packages/components/calendar/src/calendar-base.tsx (1)
Line range hint
169-174
: Provide an explicit type for the button element.The default type of a button is
submit
, which may cause unintended form submissions. Specify the button type explicitly.- <button + <button type="button"
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (7)
- .changeset/eight-worms-cough.md (1 hunks)
- packages/components/autocomplete/stories/autocomplete.stories.tsx (1 hunks)
- packages/components/badge/stories/badge.stories.tsx (1 hunks)
- packages/components/calendar/src/calendar-base.tsx (1 hunks)
- packages/components/select/tests/select.test.tsx (6 hunks)
- packages/utilities/aria-utils/src/collections/section.ts (1 hunks)
- tsconfig.json (1 hunks)
Files skipped from review due to trivial changes (2)
- .changeset/eight-worms-cough.md
- tsconfig.json
Additional context used
Biome
packages/utilities/aria-utils/src/collections/section.ts
[error] 9-9: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
packages/components/calendar/src/calendar-base.tsx
[error] 169-174: Provide an explicit type prop for the button element.
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset(lint/a11y/useButtonType)
Additional comments not posted (10)
packages/components/badge/stories/badge.stories.tsx (1)
71-71
: Ensureargs.classNames?.badge
is a string before casting.Casting
args.classNames?.badge
as a string may hide potential issues ifbadge
is not a string. Ensure thatbadge
is always a string or handle other types appropriately.- isBordered={(args.classNames?.badge as string)?.includes("bottom")} + isBordered={typeof args.classNames?.badge === "string" && args.classNames?.badge.includes("bottom")}packages/components/calendar/src/calendar-base.tsx (1)
62-63
: LGTM!The type annotations for
headers
andcalendars
improve type safety.packages/components/select/__tests__/select.test.tsx (6)
86-86
: Good practice: Added key prop to SelectItem.Adding a
key
prop toSelectItem
components based on item properties likeid
helps React optimize rendering.
113-113
: Improved type safety: Updated type declaration for SelectSection.The type declaration for
SelectSection
has been updated to use a more specific type, improving type safety.
366-366
: Good practice: Added key prop to SelectItem.Adding a
key
prop toSelectItem
components based on item properties likeid
helps React optimize rendering.
406-406
: Good practice: Added key prop to SelectItem.Adding a
key
prop toSelectItem
components based on item properties likekey
helps React optimize rendering.
564-564
: Use @ts-ignore sparingly.The
@ts-ignore
directive is used to bypass TypeScript errors. Ensure there is a valid reason for ignoring the error to avoid masking potential issues.
652-652
: Good practice: Added key prop to SelectItem.Adding a
key
prop toSelectItem
components based on item properties likeid
helps React optimize rendering.packages/components/autocomplete/stories/autocomplete.stories.tsx (2)
434-434
: Improved state handling: Updated value state type to Key | null.The change from
Key
toKey | null
allows the state to handle a null value, improving the flexibility of the controlled component.
436-436
: Improved parameter handling: Updated handleSelectionChange parameter type to Key | null.The change from
Key
toKey | null
allows the function to handle a null value, improving the flexibility of the selection change handler.
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
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- packages/components/select/tests/select.test.tsx (8 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/components/select/tests/select.test.tsx
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)
apps/docs/scripts/update-search-meta.ts (1)
Line range hint
57-57
: Remove redundant double-negation.It is not necessary to use double-negation when a value will already be coerced to a boolean.
- const title = !!frontMatter.title ? frontMatter.title : ""; + const title = frontMatter.title ? frontMatter.title : "";
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- apps/docs/components/code-window/code-block.tsx (1 hunks)
- apps/docs/components/sonar-pulse.tsx (1 hunks)
- apps/docs/scripts/update-search-meta.ts (1 hunks)
Files not reviewed due to errors (1)
- apps/docs/components/code-window/code-block.tsx (no review received)
Files skipped from review due to trivial changes (1)
- apps/docs/components/sonar-pulse.tsx
Additional context used
Biome
apps/docs/scripts/update-search-meta.ts
[error] 57-57: Avoid redundant double-negation.
It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation(lint/complexity/noExtraBooleanCast)
apps/docs/components/code-window/code-block.tsx
[error] 81-81: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
[error] 94-94: This var should be declared at the root of the enclosing function.
The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.(lint/correctness/noInnerDeclarations)
[error] 105-105: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
[error] 111-111: Avoid passing content using the dangerouslySetInnerHTML prop.
Setting content using code can expose users to cross-site scripting (XSS) attacks
(lint/security/noDangerouslySetInnerHtml)
[error] 158-158: Avoid passing content using the dangerouslySetInnerHTML prop.
Setting content using code can expose users to cross-site scripting (XSS) attacks
(lint/security/noDangerouslySetInnerHtml)
Additional comments not posted (1)
apps/docs/scripts/update-search-meta.ts (1)
99-99
: LGTM!
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
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- apps/docs/scripts/update-search-meta.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- apps/docs/scripts/update-search-meta.ts
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
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- apps/docs/scripts/update-search-meta.ts (2 hunks)
- packages/components/badge/stories/badge.stories.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- apps/docs/scripts/update-search-meta.ts
- packages/components/badge/stories/badge.stories.tsx
📝 Description
Fix all the typescript error in project
⛳️ Current behavior (updates)
🚀 New behavior
💣 Is this a breaking change (Yes/No):
📝 Additional Information
Summary by CodeRabbit
New Features
Bug Fixes
@nextui-org/aria-utils
package.Refactor
Chores
any
types.