refactor : convert entity-link component from JSX to typescript#1230
refactor : convert entity-link component from JSX to typescript#1230garvthakre wants to merge 2 commits intometabrainz:masterfrom
Conversation
|
hey @MonkeyDo , can u also close this PR's. whenever u got the time. means a lot :) |
MonkeyDo
left a comment
There was a problem hiding this comment.
Small type change to avoid duplication, and we're good.
Generally, it's a good idea to check in the codebase if a type or function already exists, although I will admit in this case it might be hard ot find with such a generic name that appears in a lot of places (although a codebase-wide search for type entity would have worked)
| type Entity = { | ||
| bbid: string; | ||
| type: string; | ||
| defaultAlias?: { | ||
| name: string; | ||
| }; | ||
| disambiguation?: string; | ||
| }; |
There was a problem hiding this comment.
There is already an existing Entity type you can use, although you will have to add the disambiguation field to it:
bookbrainz-site/src/client/entity-editor/relationship-editor/types.ts
Lines 21 to 27 in 9fac3aa
There was a problem hiding this comment.
@MonkeyDo really sorry for this small errors, and yeah really thanks for that search suggestion, i think this will help me alot ...
|
@MonkeyDo , I've updated the PR to use the existing Entity type from relationship-editor/types.ts and added the disambiguation field to it instead of creating a duplicate type. |
Problem
This PR is part of the ongoing TypeScript migration of the BookBrainz codebase. The entity-link component is currently written in JavaScript with PropTypes for type checking, which provides less type safety compared to TypeScript's compile-time type checking
Solution
1.Renaming the file from .js to .tsx
2.Maintaining all existing functionality without any behavioral changes
Areas of Impact
File affected: src/client/components/entity-link.js → src/client/components/entity-link.tsx