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

fix utility props value type about override the Theme interface #345

Conversation

strozw
Copy link
Contributor

@strozw strozw commented Jan 11, 2022

Summary

this PR is fix below issue by add string | number | false into ThemeNamespaceValue (7a430a9).

Fixes #344

and fix type-errors about theme value types in tests files.

Test plan

  1. npm install in project root
  2. type checking
    • no errors to run npx tsc --noEmit -p ./packages/system
    • no errors to run npx tsc --noEmit -p ./packages/styled-components
    • no errors to run npx tsc --noEmit -p ./packages/emotion
  3. pass the tests (run npm test in project root)

@strozw strozw marked this pull request as ready for review January 11, 2022 15:59
@strozw strozw force-pushed the fix_style_props_value_type_in_system_packages branch from e5a42c0 to 78859fa Compare January 11, 2022 16:02
@strozw strozw force-pushed the fix_style_props_value_type_in_system_packages branch from 78859fa to e0942c5 Compare January 11, 2022 16:03
@strozw strozw changed the title fix style props value type in system packages fix utility props value type in system packages Jan 11, 2022
@strozw strozw changed the title fix utility props value type in system packages fix utility props value type Jan 11, 2022
@strozw strozw changed the title fix utility props value type fix utility props value type about override the Theme interface in typescript Jan 11, 2022
@strozw strozw changed the title fix utility props value type about override the Theme interface in typescript fix utility props value type about override the Theme interface Jan 11, 2022
@@ -126,7 +126,7 @@ declare type SynthesizedPath<T extends {}> = {
export type ThemeNamespaceValue<
K extends string,
T extends ITheme,
> = SynthesizedPath<T[K]>
> = SynthesizedPath<T[K]> | number | string | false
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think the fix is correct. ThemeNamespaceValue means a value in the theme namespace, nothing else. However, I see what you want to fix, but I think it is not the right place to do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review.
Sure, my fix wasn't fit for name.

Read the code again and investigate the appropriate corrections.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

1st, I reverted prev changes, and changed SystemProp insted of ThemeNamespaeceValue for fix utility props. I think this type name means utility props, but what do you think?

2nd, above changes is not cover same problem about each themeGetter. so I changed ThemeGetter for it.

3rd, the first change on SystemProps found an issue where col and row props didn't support false, so we fixed each one.

@strozw strozw requested a review from gregberge January 17, 2022 14:24
Copy link
Collaborator

@gregberge gregberge left a comment

Choose a reason for hiding this comment

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

I am sorry but it does not make sens at all to authorize anything anywhere. Each prop has its own typing, maybe some are missing, but globally it is good.

@strozw
Copy link
Contributor Author

strozw commented Apr 2, 2022

@gregberge

thanks for your review.

Each prop has its own typing, maybe some are missing, but globally it is good.

Indeed, I think it should be safe for Typing to be more accurate and limited. This PR will be closed and I'll reconsider if we can contribute in another way.

@strozw strozw closed this Apr 2, 2022
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.

Overriding Theme causes a type error occurred in specify a value that not exist in theme into utility props
2 participants