-
Notifications
You must be signed in to change notification settings - Fork 2
wip add some component types #6
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
Conversation
WalkthroughThis update expands the Changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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
🧹 Nitpick comments (2)
packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts (2)
105-106
: Implement missing event handler definitionsThe comment indicates several event handlers should be defined (beforeenter, enter, afterenter, beforeleave, leave, afterleave, clickoverlay) but they're not implemented in the interface.
interface MpxPageContainer { show?: boolean duration?: number 'z-index'?: number overlay?: boolean position?: string round?: boolean 'close-on-slide-down'?: boolean 'overlay-style'?: string 'custom-style'?: string - // bind:beforeenter bind:enter bind:enter bind:afterenter bind:beforeleave bind:leave bind:afterleave bind:clickoverlay + bindbeforeenter?: EventHandler + bindenter?: EventHandler + bindafterenter?: EventHandler + bindbeforeleave?: EventHandler + bindleave?: EventHandler + bindafterleave?: EventHandler + bindclickoverlay?: EventHandler }
199-199
: Consider more specific typing for nodes propertyThe
nodes
property accepts bothArray<string>
andstring
, but rich text nodes typically have a more structured format.Consider defining a more specific type:
+type RichTextNode = { + name: string + attrs?: Record<string, any> + children?: RichTextNode[] +} | string interface MpxRichText { - nodes?: Array<string> | string + nodes?: RichTextNode[] space?: string 'user-select'?: boolean }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts
(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts
[error] 61-62: 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] 62-63: 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] 96-96: 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] 97-98: 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] 98-99: 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] 100-100: 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] 136-137: 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] 137-138: 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] 138-138: 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] 139-139: 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] 140-140: 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] 141-141: 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] 142-142: 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] 145-145: 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] 146-147: 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] 147-148: 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] 166-167: 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] 167-167: 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] 170-171: 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] 204-204: 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)
🔇 Additional comments (3)
packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts (3)
25-43
: Well-structured component type additionsThe additions to the
NativeComponentAttrs
interface provide comprehensive coverage for view containers and basic content components. The categorization with comments helps organize the component types logically.
178-178
: Good use of required propertyThe
type
property is correctly marked as required for the Icon component, which enforces proper usage.
91-91
: No action needed:htouchmove
is intentional
Thehtouchmove
property is paired withvtouchmove
to represent horizontal and vertical touch‐move event handlers, respectively. This matches the surrounding API pattern in
packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts (lines 91–92). Please disregard the typo suggestion.Likely an incorrect or invalid review comment.
bindload?: Function | ||
binderror?: Function |
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 generic Function
types with specific event handler signatures
The static analysis correctly identifies that using Function
as a type is problematic as it accepts any function-like value, which can be a source of bugs. Event handlers should have specific signatures.
Consider defining specific event handler types. For example:
+// Event handler type definitions
+type EventHandler<T = any> = (event: T) => void
+type TouchEventHandler = (event: TouchEvent) => void
+type ScrollEventHandler = (event: ScrollEvent) => void
interface MpxCoverImage {
src?: string
'referrer-policy'?: string
- bindload?: Function
- binderror?: Function
+ bindload?: EventHandler
+ binderror?: EventHandler
}
Apply similar changes to all interfaces using Function
types.
Also applies to: 89-92, 132-141, 160-162, 195-195, 206-206
🤖 Prompt for AI Agents
In packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts
at lines 53-54 and also at lines 89-92, 132-141, 160-162, 195, and 206, replace
the generic Function types used for event handlers with specific event handler
signatures that define the expected parameters and return types. Identify the
appropriate event object types for each handler and update the type annotations
accordingly to ensure type safety and clarity.
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.
@Liub1202 todo
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.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
Summary by CodeRabbit