SK-2110: fix typescript types in interfaces for react sdk#214
Conversation
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
There was a problem hiding this comment.
Pull request overview
This pull request enhances TypeScript support for the React SDK by adding comprehensive type definitions and fixing gaps in public interfaces. The changes improve type safety across hooks, elements, utilities, and the event system while maintaining backward compatibility.
Changes:
- Added new common type definitions including
StylesConfig,ElementClassesConfig,CollectElementState,EventCallback,EventCallbackFunction, andComposableSubmitResponse - Updated hooks and elements to use proper TypeScript types instead of
anyorunknown - Enhanced EventEmitter class with proper type annotations
- Fixed sample code to use string values for
fontWeightCSS property
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/common/index.ts | New file defining core TypeScript interfaces and types for the SDK |
| src/index.ts | Exports new type definitions for public API consumption |
| src/utils/event-emitter/index.ts | Added proper types for event callbacks and event records |
| src/hooks/CollectContainer/index.ts | Added ContainerOptions type parameter |
| src/hooks/ComposableContainer/index.ts | Added required ContainerOptions type parameter |
| src/hooks/RevealContainer/index.ts | Added optional ContainerOptions type parameter |
| src/hooks/MakeSkyflowStyles/index.ts | Replaced generic Record type with specific StylesConfig type |
| src/elements/index.ts | Updated element props to use ElementClassesConfig and CollectElementState types |
| src/elements/RevealElement/index.tsx | Removed unused imports, added proper type for element state, added eslint comment |
| src/elements/FileRenderElement/index.tsx | Added proper type for element state, added eslint comment |
| src/elements/ComposableContainer/index.tsx | Added ComposableSubmitResponse type for onSubmit handler |
| tests/elements/collectElements.test.tsx | Enhanced event emitter mock with all required methods, added explicit any type |
| samples/SkyflowElements/src/components/DynamicComposableElements/index.tsx | Fixed fontWeight to use string type, improved formatting |
| samples/SkyflowElements/src/components/ComposableElements/index.tsx | Fixed fontWeight to use string type |
| samples/SkyflowElements/src/components/CardBrandChoice/index.tsx | Removed commented-out dropdown styling code |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
Why:
Fix gaps in typescript public interfaces and add typescript support.
Goal:
Identify and fix gaps in typescript public interfaces for React SDK.
Add comprehensive TypeScript type definitions.