Skip to content
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

refactor(statistics) to typescript #1077

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

meziyum
Copy link
Contributor

@meziyum meziyum commented Mar 18, 2024

Problem

The bookbrainz project has been gradually adopting typescript. Typescript can help us prevent the code base more type safe and boost collaboration

Solution

Refactored the statistics and any related functions to typescript.
Added the type _EditorType which can easily be imported in the ts files wherever necessary

Areas of Impact

statistics page

Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!
Just a naming suggestion below

@@ -9,6 +9,24 @@ export type _AuthorType = {

};

export interface _EditorType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
export interface _EditorType {
export type _Editor {

@@ -19,23 +19,28 @@
import * as bootstrap from 'react-bootstrap';
import * as utilsHelper from '../../helpers/utils';

import PropTypes from 'prop-types';
import {_EditorType} from '../../../types';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And with the renaming below:

Suggested change
import {_EditorType} from '../../../types';
import {type Editor} from '../../../types';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants