-
Notifications
You must be signed in to change notification settings - Fork 31
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: TypeScript Type Improvements #1056
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1056 +/- ##
==========================================
- Coverage 43.46% 43.46% -0.01%
==========================================
Files 437 437
Lines 32951 32954 +3
Branches 8305 8309 +4
==========================================
Hits 14323 14323
- Misses 18579 18582 +3
Partials 49 49
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
If you want to make sure this doesn't get merged, you can click "Convert to Draft" under the reviewers section to mark it as a draft. |
@Zhou-Ziheng can you rebase this off the latest and mark this as "Ready for review" if it is ready for review? |
@@ -16,7 +16,7 @@ export type FormatOption = { | |||
export type FormatterItem = { | |||
columnType: string; | |||
columnName: string; | |||
format: Partial<TableColumnFormat>; | |||
format: TableColumnFormat | Record<string, never>; |
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.
I think would be cleaner to do Partial<TableColumnFormat>
@Zhou-Ziheng also update the PR description to put "Fixes #1122" in the description, and change the Breaking notice to match the format we're expecting (e.g. "BREAKING CHANGE: Selector type removed from redux" |
item: FormattingRule & { id?: number; isNewRule?: boolean } | ||
): FormattingRule { |
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.
I don't really like what's going on here with removeFormatRuleExtraProps
and isFormatRuleValidForSave
.
Instead, we should define a ValidFormatterItem
type as well, so something like:
export type ValidFormatterItem = FormattingRule & {
id?: number;
isNewRule?: boolean;
};
export type FormatterItem = ValidFormatterItem & {
format: Partial<TableColumnFormat>;
};
So it makes it a little more clear what constitutes an "invalid" FormatterItem
.
Then these functions just become:
function removeFormatRuleExtraProps(item: ValidFormatterItem): FormattingRule;
function isFormatRuleValidForSave(rule: FormatterItem): rule is ValidFormatterItem;
I think that makes it a little clearer what's going on.
There are certain types that needs to be improved as part of the Enterprise TypeScript conversion.
This PR aims to contain all changes that needs to be made.
Fixes #1122
BREAKING CHANGE: Selector Type removed from redux