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 the GlobalStylesContext type for typescript 5 #79722

Merged

Conversation

arthur791004
Copy link
Contributor

@arthur791004 arthur791004 commented Jul 21, 2023

Related to #

Proposed Changes

  • Fix types in the @automattic/global-stypes package
  • Use the fixed version of the @popperjs/core package to resolve the error below. The reakit has a breaking changes, and I think it's not a great timing to upgrade it as well.
    node_modules/reakit/node_modules/@popperjs/core/lib/types.d.ts(123,34): error TS2344: Type 'Options' does not satisfy the constraint 'Obj'.
    node_modules/reakit/node_modules/@popperjs/core/lib/types.d.ts(124,39): error TS2344: Type 'Options' does not satisfy the constraint 'Obj'.
    

Testing Instructions

  • Run yarn build-packages and you should not see the errors

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

@arthur791004 arthur791004 self-assigned this Jul 21, 2023
@github-actions
Copy link

github-actions bot commented Jul 21, 2023

Link to live branch is being generated...
Please wait a few minutes and refresh this page.

@matticbot
Copy link
Contributor

This PR modifies the release build for editing-toolkit

To test your changes on WordPress.com, run install-plugin.sh editing-toolkit update-to-typescript-5-global-styles on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-mMA-p2

@arthur791004 arthur791004 force-pushed the update-to-typescript-5-global-styles branch from 1c3eaa2 to d5bcb32 Compare July 21, 2023 06:50
@arthur791004 arthur791004 force-pushed the update-to-typescript-5-global-styles branch from d5bcb32 to 23bbefe Compare July 21, 2023 06:51
@arthur791004 arthur791004 changed the title Fix the GlobalStylesContext type Fix the GlobalStylesContext type for typescript 5 Jul 21, 2023
@arthur791004 arthur791004 requested a review from noahtallen July 21, 2023 07:16
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 21, 2023
@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~108 bytes added 📈 [gzipped])

name           parsed_size           gzip_size
entry-stepper       +166 B  (+0.0%)      +66 B  (+0.0%)
entry-main          +131 B  (+0.0%)      +45 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~411 bytes added 📈 [gzipped])

name                             parsed_size           gzip_size
pattern-assembler-step               +1061 B  (+0.1%)     +411 B  (+0.1%)
import-flow                          +1061 B  (+0.0%)     +411 B  (+0.0%)
themes                                +998 B  (+0.1%)     +395 B  (+0.2%)
theme                                 +998 B  (+0.2%)     +395 B  (+0.2%)
settings-performance                  +998 B  (+0.2%)     +395 B  (+0.3%)
scan                                  +998 B  (+0.1%)     +395 B  (+0.2%)
plugins                               +998 B  (+0.1%)     +395 B  (+0.1%)
media                                 +998 B  (+0.1%)     +395 B  (+0.1%)
marketplace                           +998 B  (+0.1%)     +395 B  (+0.2%)
jetpack-cloud-plugin-management       +998 B  (+0.1%)     +395 B  (+0.1%)
hosting                               +998 B  (+0.2%)     +395 B  (+0.2%)
backup                                +998 B  (+0.1%)     +395 B  (+0.2%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~424 bytes added 📈 [gzipped])

name                                                                         parsed_size           gzip_size
async-load-automattic-design-preview                                             +1061 B  (+0.1%)     +407 B  (+0.1%)
async-load-design-wordpress-components-gallery                                    +998 B  (+0.2%)     +395 B  (+0.3%)
async-load-design-blocks                                                          +998 B  (+0.1%)     +395 B  (+0.1%)
async-load-calypso-post-editor-media-modal                                        +998 B  (+0.1%)     +395 B  (+0.1%)
async-load-calypso-post-editor-editor-media-modal                                 +998 B  (+0.1%)     +395 B  (+0.1%)
async-load-automattic-global-styles-src-components-global-styles-variations        +39 B  (+0.0%)      +17 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@noahtallen noahtallen left a comment

Choose a reason for hiding this comment

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

Wonderful, thanks!

@noahtallen noahtallen merged this pull request into update-to-typescript-5 Jul 21, 2023
@noahtallen noahtallen deleted the update-to-typescript-5-global-styles branch July 21, 2023 21:11
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 21, 2023
noahtallen added a commit that referenced this pull request Jul 25, 2023
noahtallen added a commit that referenced this pull request Aug 1, 2023
noahtallen added a commit that referenced this pull request Aug 1, 2023
* Update typescript to 5.1

* Update @typescript-eslint to latest v5 release to support ts 5.1

* Update popperjs to fix type issue

* Update emotion for compatibility with Typescript 5

* Fix the GlobalStylesContext types for typescript 5 (#79722)

* Fix unspecific type parameter to isObjKey

* Fix implementation details for Report

* Fix BaseButton type issue

- Use wrapper fn to handle issues with isValidElement

* Use type parameter to fix cloneElement issues

* Fix issue where Typescript doesn't infer generic correctly
- This applies to createSelector and treeSelect

* Add wrapper type to handle error catch

* Fix another HoC OuterProps issue
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.

3 participants