refactor(theme): clean up type definitions#1172
Conversation
|
Visit the preview URL for this PR (updated for commit 039978c): https://docusaurus-openapi-36b86--pr1172-jb9ezfh5.web.app (expires Sun, 27 Jul 2025 17:39:57 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bf293780ee827f578864d92193b8c2866acd459f |
|
The “Refactor theme types” commit removes a custom Map interface and switches to the built‑in Record type. The earlier implementation defined interface Map { [key: string]: T; }, which essentially mirrored the standard Record<string, T> utility and could be confused with JavaScript’s Map object. After refactoring, the schema definitions directly reference Record: The component using these types was updated accordingly: Switching to Record eliminates redundant custom types and avoids name clashes with the native Map class. It also aligns with the project’s goal of reusing existing Docusaurus types, as reflected in the updated DocFrontMatter definition: Overall, the change simplifies type definitions and makes them clearer for anyone already familiar with TypeScript’s built‑in utilities. Using Record communicates that these objects behave like plain key/value maps with no custom behavior, making the code easier to read and maintain. |
Summary
Testing
yarn lintyarn testyarn build-packageshttps://chatgpt.com/codex/tasks/task_e_685ec8b8693083238aaed80639f5dfa9