-
Notifications
You must be signed in to change notification settings - Fork 663
ASP Related: fix ts issues in demos in strict mode #32122
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
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.
Pull request overview
This PR fixes TypeScript strict mode issues in React demos for the Diagram, FileManager, and Gantt components, enabling them to be included in strict type checking by removing their exclusions from tsconfig.react-check.json.
Key changes include:
- Added proper type annotations for component props, function parameters, and event handlers
- Initialized React refs with explicit
nullvalues for strict null checking - Added optional chaining operators to safely access potentially undefined properties
- Separated type imports from value imports following TypeScript best practices
- Fixed property access patterns to use dataItem instead of deprecated properties
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/demos/tsconfig.react-check.json | Removed Diagram, FileManager, and Gantt demos from TypeScript strict mode exclusions |
| apps/demos/Demos/Gantt/TaskTemplate/React/TaskTemplate.tsx | Added TaskTemplateProps interface for type safety |
| apps/demos/Demos/Gantt/ExportToPDF/ReactJs/App.js | Fixed dataRange object structure with mode property |
| apps/demos/Demos/Gantt/ExportToPDF/React/App.tsx | Added type annotations for event handlers and fixed dataRange structure |
| apps/demos/Demos/Gantt/ContextMenu/React/App.tsx | Added ContextMenuPreparingEvent type for event handler |
| apps/demos/Demos/Gantt/Appearance/React/TaskTooltipTemplate.tsx | Added type annotations for function parameters |
| apps/demos/Demos/Gantt/Appearance/React/TaskProgressTooltipContentTemplate.tsx | Added type annotation for progress prop |
| apps/demos/Demos/FileManager/UICustomization/ReactJs/App.js | Added optional chaining for safe property access |
| apps/demos/Demos/FileManager/UICustomization/React/data.ts | Improved type safety with const assertion and FileExtensionName type |
| apps/demos/Demos/FileManager/UICustomization/React/App.tsx | Added FileSystemItem interface and optional chaining |
| apps/demos/Demos/FileManager/Overview/ReactJs/App.js | Added optional chaining for safe property access |
| apps/demos/Demos/FileManager/Overview/React/App.tsx | Separated type imports and added optional chaining |
| apps/demos/Demos/FileManager/CustomThumbnails/React/App.tsx | Added CustomFileSystemItem interface for customizeThumbnail callback |
| apps/demos/Demos/FileManager/BindingToEF/ReactJs/App.js | Added optional chaining for safe property access |
| apps/demos/Demos/FileManager/BindingToEF/React/App.tsx | Added type annotation for allowedFileExtensions and optional chaining |
| apps/demos/Demos/Diagram/UICustomization/ReactJs/App.js | Added optional chaining for diagram ref access |
| apps/demos/Demos/Diagram/UICustomization/React/App.tsx | Added DiagramRef type and optional chaining |
| apps/demos/Demos/Diagram/ReadOnly/ReactJs/App.js | Added optional chaining for diagram ref access |
| apps/demos/Demos/Diagram/ReadOnly/React/App.tsx | Added optional chaining for diagram ref access |
| apps/demos/Demos/Diagram/Overview/ReactJs/App.js | Initialized ref with null and added optional chaining |
| apps/demos/Demos/Diagram/Overview/React/App.tsx | Initialized ref with null and added optional chaining |
| apps/demos/Demos/Diagram/ItemSelection/ReactJs/App.js | Fixed property access from item.text to item.dataItem |
| apps/demos/Demos/Diagram/ItemSelection/React/App.tsx | Added types for event handler and fixed property access |
| apps/demos/Demos/Diagram/CustomShapesWithTexts/ReactJs/App.js | Initialized ref with null and added optional chaining |
| apps/demos/Demos/Diagram/CustomShapesWithTexts/React/App.tsx | Initialized ref with null and added optional chaining |
| apps/demos/Demos/Diagram/CustomShapesWithTemplatesWithEditing/React/CustomShapeTemplate.tsx | Added type annotations for function parameters |
| apps/demos/Demos/Diagram/CustomShapesWithTemplatesWithEditing/React/App.tsx | Added PopupContentFuncProps interface and ValueChangedEvent types |
| apps/demos/Demos/Diagram/CustomShapesWithTemplates/React/CustomShapeTemplate.tsx | Added Employee type import and parameter types |
| apps/demos/Demos/Diagram/CustomShapesWithTemplates/React/App.tsx | Added type annotation for showInfo callback |
| apps/demos/Demos/Diagram/Containers/ReactJs/App.js | Initialized ref with null and added optional chaining |
| apps/demos/Demos/Diagram/Containers/React/App.tsx | Initialized ref with null and added optional chaining |
| apps/demos/Demos/Diagram/AdvancedDataBinding/React/App.tsx | Added type annotations for function parameters including undefined |
| apps/demos/Demos/Diagram/Adaptability/ReactJs/App.js | Initialized ref with null and added optional chaining |
| apps/demos/Demos/Diagram/Adaptability/React/App.tsx | Initialized ref with null and added optional chaining |
apps/demos/Demos/Diagram/CustomShapesWithTemplatesWithEditing/React/App.tsx
Show resolved
Hide resolved
| const allowedFileExtensions: string[] = []; | ||
|
|
||
| export default function App() { | ||
| const [currentPath, setCurrentPath] = useState('Documents/Reports'); |
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.
don't you want to use types on useState?
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.
added type
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.
could you please ensure that other places have typing as well
No description provided.