Skip to content

Conversation

@mayagbarnes
Copy link
Collaborator

📚 Context

Updating & deduplicating some minor versions of devDependencies.

  • What kind of change does this PR introduce?
    • Other: devDependency update/dedup

🧠 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.

@mayagbarnes mayagbarnes added the security-assessment-completed Security assessment has been completed for PR label Jan 5, 2023
// @ts-ignore
if (isColor(color)) {
// @ts-ignore
colors[key] = color
Copy link
Collaborator Author

@mayagbarnes mayagbarnes Jan 5, 2023

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.

Copy link
Collaborator

@vdonato vdonato Jan 5, 2023

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:

  1. Unpack the base field of themeInput (and probably name it _base to signify that it's unused) on line 371 above so that customColors doesn't include it. base isn't a color so shouldn't be included in parsedColors, 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).
  2. Somehow cast color to a string before it's used. I think the best way of doing this would probably be to cast customColors as a Record<string, string> before it's used in line 375 rather than casting color itself. We know that every value in customColors should be a string because completeThemeInput is always called before createEmotionTheme in the createTheme function (and also because we got rid of the font/base fields, which are the only two non-string fields), but the type checker isn't smart enough to infer this.

@mayagbarnes mayagbarnes marked this pull request as ready for review January 5, 2023 07:20
// @ts-ignore
if (isColor(color)) {
// @ts-ignore
colors[key] = color
Copy link
Collaborator

@vdonato vdonato Jan 5, 2023

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:

  1. Unpack the base field of themeInput (and probably name it _base to signify that it's unused) on line 371 above so that customColors doesn't include it. base isn't a color so shouldn't be included in parsedColors, 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).
  2. Somehow cast color to a string before it's used. I think the best way of doing this would probably be to cast customColors as a Record<string, string> before it's used in line 375 rather than casting color itself. We know that every value in customColors should be a string because completeThemeInput is always called before createEmotionTheme in the createTheme function (and also because we got rid of the font/base fields, which are the only two non-string fields), but the type checker isn't smart enough to infer this.

@mayagbarnes mayagbarnes merged commit 23491c5 into develop Jan 5, 2023
@mayagbarnes mayagbarnes deleted the minor-devDeps-b branch January 5, 2023 23:57
tconkling added a commit that referenced this pull request Jan 6, 2023
* develop:
  Fix slider overlap values for ranges (#5913)
  Update Minor devDependencies - Part B (#5914)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants