-
Notifications
You must be signed in to change notification settings - Fork 4k
Update Minor devDependencies - Part B #5914
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
Conversation
…int/eslint-plugin, & typescript-eslint/parser
| // @ts-ignore | ||
| if (isColor(color)) { | ||
| // @ts-ignore | ||
| colors[key] = color |
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.
Would appreciate feedback on how to fix this typecheck issue 😓
Error info can be found in this run.
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.
Hm, so this typecheck issue is technically correct since the fields of the ICustomThemeConfig type have type string | BaseTheme | null, and we need a string here.
I'm not sure why this wasn't caught by typescript earlier, but this probably happened because some dependency wasn't typed (or typed less strictly) so checks related to it were skipped, and types were added in a minor version upgrade so now types are being more strictly enforced in more places.
Two things need to be done to fix this:
- Unpack the
basefield ofthemeInput(and probably name it_baseto signify that it's unused) on line 371 above so thatcustomColorsdoesn't include it.baseisn't a color so shouldn't be included inparsedColors, but we must have missed this when it got added because of the lax typechecking for this code (I don't think it mattered that it was being included, but we should probably fix this anyway for good practice's sake). - Somehow cast
colorto astringbefore it's used. I think the best way of doing this would probably be to castcustomColorsas aRecord<string, string>before it's used in line 375 rather than castingcoloritself. We know that every value incustomColorsshould be a string becausecompleteThemeInputis always called beforecreateEmotionThemein thecreateThemefunction (and also because we got rid of thefont/basefields, which are the only two non-string fields), but the type checker isn't smart enough to infer this.
| // @ts-ignore | ||
| if (isColor(color)) { | ||
| // @ts-ignore | ||
| colors[key] = color |
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.
Hm, so this typecheck issue is technically correct since the fields of the ICustomThemeConfig type have type string | BaseTheme | null, and we need a string here.
I'm not sure why this wasn't caught by typescript earlier, but this probably happened because some dependency wasn't typed (or typed less strictly) so checks related to it were skipped, and types were added in a minor version upgrade so now types are being more strictly enforced in more places.
Two things need to be done to fix this:
- Unpack the
basefield ofthemeInput(and probably name it_baseto signify that it's unused) on line 371 above so thatcustomColorsdoesn't include it.baseisn't a color so shouldn't be included inparsedColors, but we must have missed this when it got added because of the lax typechecking for this code (I don't think it mattered that it was being included, but we should probably fix this anyway for good practice's sake). - Somehow cast
colorto astringbefore it's used. I think the best way of doing this would probably be to castcustomColorsas aRecord<string, string>before it's used in line 375 rather than castingcoloritself. We know that every value incustomColorsshould be a string becausecompleteThemeInputis always called beforecreateEmotionThemein thecreateThemefunction (and also because we got rid of thefont/basefields, which are the only two non-string fields), but the type checker isn't smart enough to infer this.
📚 Context
Updating & deduplicating some minor versions of devDependencies.
🧠 Description of Changes
eslint-plugin-import to 2.26.0
eslint-plugin-jsx-a11y to 6.6.1
eslint-plugin-react to 7.31.11
eslint-plugin-react-hooks to 4.6.0
@typescript-eslint/eslint-plugin to 5.48.0
@typescript-eslint/parser to 5.48.0
prettier to 2.8.1
typescript to 4.9.4
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.