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

improve types #1885

Merged
merged 1 commit into from Aug 16, 2022
Merged

improve types #1885

merged 1 commit into from Aug 16, 2022

Conversation

brunocrosier
Copy link
Contributor

  • create a named type for Record<string, ThemeComponent>
  • remove unnecessary code (fn was being Omitted twice)
  • refactor to use Partial<Pick<>

- create a named type for `Record<string, ThemeComponent>`
- remove unnecessary code (`fn` was being `Omit`ted twice)
- refactor to use `Partial<Pick<>`
@@ -98,9 +99,6 @@ interface ThemeComponent {
}

export type MantineThemeBase = Omit<MantineTheme, 'fn'>;
export type MantineThemeOverride = DeepPartial<
Omit<MantineThemeBase, 'fn' | 'other' | 'components'>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't need to omit fn as we're already doing that in MantineThemeBase

};

export type MantineThemeOverride = DeepPartial<Omit<MantineThemeBase, 'other' | 'components'>> &
Partial<Pick<MantineThemeBase, 'other' | 'components'>>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

better and safer to Pick directly from MantineThemeBase, otherwise the types could fall out of sync

@rtivital rtivital changed the base branch from master to dev August 16, 2022 12:36
@rtivital rtivital merged commit 1ba9fe3 into mantinedev:dev Aug 16, 2022
@rtivital
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants