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

Bug/overrides for token #210

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/stylex/src/StyleXTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export type Theme<
type OverridesForTokenType<Config extends { [key: string]: unknown }> = {
[Key in keyof Config]:
| Config[Key]
| { default: Config[Key]; [atRule: AtRuleStr]: Config[Key] };
| { default: Config[Key]; [atRule: string]: Config[Key] };
};

export type StyleX$CreateTheme = <
Expand Down
6 changes: 4 additions & 2 deletions packages/stylex/src/StyleXTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type CSSPropertiesWithExtras = $ReadOnly<{
'::-webkit-search-cancel-button'?: CSSProperties,
'::-webkit-search-results-button'?: CSSProperties,
'::-webkit-search-results-decoration'?: CSSProperties,

}>;

export type NestedCSSPropTypes = $ReadOnly<{
Expand Down Expand Up @@ -176,12 +177,13 @@ export type Theme<
[string]: StyleXClassNameFor<string, IDFromVarGroup<T>>,
}>;

export type OverridesForTokenType<Config: { +[string]: mixed }> = {
export type OverridesForTokenType<Config extends { [key: string]: unknown }> = {
[Key in keyof Config]:
| Config[Key]
| { +default: Config[Key], +[string]: Config[Key] },
| { default: Config[Key]; [property: string]: Config[Key] };
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert this line.
+ means readonly in Flow and is needed.
[string] is valid in Flow, and there is no need for the property: bit.
Please bring back the + here.

Copy link
Author

Choose a reason for hiding this comment

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

Okay I will correct this

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the purpose of your PR? Every change this PR breaks Flow by trying to change it to Typescript syntax.

Copy link
Author

Choose a reason for hiding this comment

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

@nmn I thought the problem occurred , can be fixed by changing the type, it was my first try to contribute to open source I think I am not at the ryt place then.
Thanks

Copy link
Author

Choose a reason for hiding this comment

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

I will try to fix what's bad in my PR, I am sure that I'll learn something :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@develop084 From what I understand, you're trying to change the types of createTheme to allow changing some of the variables instead of all of them.

I've already made this fix and it'll be out in the next release in a few days.


I don't want to discourage you from learning and contributing. I would suggest reading the Contribution.md document, and learn more about Flow at flow.org

Then, make sure you have the Flow plugin for VSCode installed and functional before you make your next attempt.

};


export type StyleX$CreateTheme = <
BaseTokens: VarGroup<{ +[string]: mixed }>,
ID: string = string,
Expand Down
Loading