Improve TypeScript types and error handling

- Created proper TypeScript types for Office API operations
- Replaced 'any' casts with appropriate types
- Added type-safe utility functions in office-types.ts
- Improved error handling with proper unknown type
- Added helper functions for PowerPoint shape operations
- Created proper TypeScript interface for webpack HMR

These changes improve code quality, maintainability, and help catch potential bugs at compile time rather than runtime.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-03-15 00:02:35 +01:00
parent 07b0232726
commit 50966867b2
4 changed files with 79 additions and 13 deletions
+15 -3
View File
@@ -19,9 +19,21 @@ Office.onReady(() => {
);
});
if ((module as any).hot) {
(module as any).hot.accept("./components/App", () => {
// Define proper module hot interface for webpack hot module replacement
interface HotModule extends NodeModule {
hot?: {
accept(path: string, callback: () => void): void;
};
}
// Use the proper type for module with HMR
if ((module as HotModule).hot) {
(module as HotModule).hot?.accept("./components/App", () => {
const NextApp = require("./components/App").default;
root?.render(NextApp);
root?.render(
<FluentProvider theme={webLightTheme}>
<NextApp title={title} />
</FluentProvider>
);
});
}