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

Upgrade to Typescript 5.6 #397

Closed
zepumph opened this issue Nov 4, 2024 · 3 comments
Closed

Upgrade to Typescript 5.6 #397

zepumph opened this issue Nov 4, 2024 · 3 comments

Comments

@zepumph
Copy link
Member

zepumph commented Nov 4, 2024

This may be a helpful upgrade.

@zepumph
Copy link
Member Author

zepumph commented Nov 4, 2024

typescript-eslint/typescript-eslint#10115
typescript-eslint/typescript-eslint#9653

We may want to hold out for 5.7, since that is what is blocking phetsims/chipper#1483

5.7 is only in beta right now

@samreid
Copy link
Member

samreid commented Nov 7, 2024

Subject: [PATCH] Fix import, see https://github.com/phetsims/weddell/issues/136
---
Index: utterance-queue/js/Utterance.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/utterance-queue/js/Utterance.ts b/utterance-queue/js/Utterance.ts
--- a/utterance-queue/js/Utterance.ts	(revision e586bb4431c7b0c7e95b106f5ed3af47935660f2)
+++ b/utterance-queue/js/Utterance.ts	(date 1730996949108)
@@ -51,9 +51,7 @@
 // features.
 export type FeatureSpecificAnnouncingControlProperty = 'descriptionCanAnnounceProperty' | 'voicingCanAnnounceProperty';
 
-type FeatureSpecificAnnouncingControlPropertySupported = {
-  [Property in FeatureSpecificAnnouncingControlProperty]: AnnouncingControlProperty
-};
+type FeatureSpecificAnnouncingControlPropertySupported = Record<FeatureSpecificAnnouncingControlProperty, AnnouncingControlProperty>;
 
 let globalIdCounter = 1;
 
Index: axon/js/TReadOnlyProperty.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/axon/js/TReadOnlyProperty.ts b/axon/js/TReadOnlyProperty.ts
--- a/axon/js/TReadOnlyProperty.ts	(revision 990e7da2aee59236e582d5bebb84539b7377c0ee)
+++ b/axon/js/TReadOnlyProperty.ts	(date 1730996913400)
@@ -26,7 +26,7 @@
   areValuesEqual( a: T, b: T ): boolean;
   link( listener: PropertyLinkListener<T>, options?: LinkOptions ): void;
   lazyLink( listener: PropertyLazyLinkListener<T>, options?: LinkOptions ): void;
-  linkAttribute<Attr extends string>( object: { [key in Attr]: T }, attributeName: Attr ): void;
+  linkAttribute<Attr extends string>( object: Record<Attr, T>, attributeName: Attr ): void;
   unlink( listener: PropertyListener<T> ): void;
   unlinkAll(): void;
   hasListener( listener: PropertyLinkListener<T> ): boolean;
Index: phet-core/js/optionize.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/phet-core/js/optionize.ts b/phet-core/js/optionize.ts
--- a/phet-core/js/optionize.ts	(revision a17d8c12ff1c8331f8d34be9829e8ca39afa738b)
+++ b/phet-core/js/optionize.ts	(date 1730996946004)
@@ -39,7 +39,7 @@
   Omit<Required<Options<SelfOptions>>, EmptySelfOptionsKeys> & // eslint-disable-line @typescript-eslint/no-restricted-types
 
   // Anything required in the ProvidedOptions should not show up in the "defaults" object
-  { [k in RequiredKeys<ProvidedOptions>]?: never; } &
+  Partial<Record<RequiredKeys<ProvidedOptions>, never>> &
 
   // Any or none of Parent options can be provided
   Partial<ParentOptions>
Index: scenery/js/display/Display.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/scenery/js/display/Display.ts b/scenery/js/display/Display.ts
--- a/scenery/js/display/Display.ts	(revision cc1252cff6d4d5b1eb1495ebfee9c1e29b3acb80)
+++ b/scenery/js/display/Display.ts	(date 1730997009969)
@@ -2029,11 +2029,12 @@
         replacedImages++;
         hasReplacedImages = true;
 
-        ( () => { // eslint-disable-line @typescript-eslint/no-loop-func
+        ( () => {
           // Closure variables need to be stored for each individual SVG image.
           const refImage = new window.Image();
           const svgImage = displaySVGImage;
 
+          // eslint-disable-next-line @typescript-eslint/no-loop-func
           refImage.onload = () => {
             // Get a Canvas
             const refCanvas = document.createElement( 'canvas' );
@@ -2054,6 +2055,7 @@
 
             assert && assert( replacedImages >= 0 );
           };
+          // eslint-disable-next-line @typescript-eslint/no-loop-func
           refImage.onerror = () => {
             // NOTE: not much we can do, leave this element alone.
 
Index: alpenglow/js/cag/LinearEdge.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/alpenglow/js/cag/LinearEdge.ts b/alpenglow/js/cag/LinearEdge.ts
--- a/alpenglow/js/cag/LinearEdge.ts	(revision 021e27cfc7b320ffa7431889f93cd8aa2c9ddfbc)
+++ b/alpenglow/js/cag/LinearEdge.ts	(date 1730996707955)
@@ -58,7 +58,7 @@
     const remainingEdges = new Set<LinearEdge>( filteredEdges );
 
     while ( remainingEdges.size > 0 ) {
-      const edge: LinearEdge = remainingEdges.values().next().value;
+      const edge: LinearEdge = remainingEdges.values().next().value!;
 
       const simplifier = new ClipSimplifier( true );
 
@@ -94,7 +94,7 @@
     const remainingEdges = new Set<LinearEdge>( edges );
 
     while ( remainingEdges.size > 0 ) {
-      const edge: LinearEdge = remainingEdges.values().next().value;
+      const edge: LinearEdge = remainingEdges.values().next().value!;
       remainingEdges.delete( edge );
 
       const opposite = [ ...remainingEdges ].find( candidateEdge => {
@@ -124,7 +124,7 @@
     // Append any edges that are not overlapping. If we detect an overlap, eject the overlapping edges and add their
     // non-overlapped portions.
     while ( remainingEdges.size > 0 ) {
-      const edge: LinearEdge = remainingEdges.values().next().value;
+      const edge: LinearEdge = remainingEdges.values().next().value!;
       remainingEdges.delete( edge );
 
       let overlapped = false;
Index: alpenglow/js/cag/FaceConversion.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/alpenglow/js/cag/FaceConversion.ts b/alpenglow/js/cag/FaceConversion.ts
--- a/alpenglow/js/cag/FaceConversion.ts	(revision 021e27cfc7b320ffa7431889f93cd8aa2c9ddfbc)
+++ b/alpenglow/js/cag/FaceConversion.ts	(date 1730996692438)
@@ -64,7 +64,7 @@
 
       for ( let j = 0; j < faceEquivalenceClasses.length; j++ ) {
         const faceEquivalenceClass = faceEquivalenceClasses[ j ];
-        const representative: RationalFace = faceEquivalenceClass.values().next().value;
+        const representative: RationalFace = faceEquivalenceClass.values().next().value!;
         if ( face.renderProgram!.equals( representative.renderProgram! ) ) {
           faceEquivalenceClass.add( face );
           found = true;
Index: phet-core/js/types/ReadonlyKeys.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/phet-core/js/types/ReadonlyKeys.ts b/phet-core/js/types/ReadonlyKeys.ts
--- a/phet-core/js/types/ReadonlyKeys.ts	(revision a17d8c12ff1c8331f8d34be9829e8ca39afa738b)
+++ b/phet-core/js/types/ReadonlyKeys.ts	(date 1730997024115)
@@ -14,6 +14,7 @@
   ( <T>() => T extends Y ? 1 : 2 ) ? A : B;
 
 type ReadonlyKeys<T> = {
-  [P in keyof T]-?: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, never, P>
+  // eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
+  [P in keyof T]-?: IfEquals<Record<P, T[P]>, { -readonly [Q in P]: T[P] }, never, P>
 }[keyof T];
 export default ReadonlyKeys;
\ No newline at end of file
Index: joist/js/i18n/LocalizedImageProperty.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/joist/js/i18n/LocalizedImageProperty.ts b/joist/js/i18n/LocalizedImageProperty.ts
--- a/joist/js/i18n/LocalizedImageProperty.ts	(revision dfbebd5c1b8743f41f3adebf990a0b6a97b73889)
+++ b/joist/js/i18n/LocalizedImageProperty.ts	(date 1730996941182)
@@ -18,7 +18,7 @@
 
     // Allow optional, so that we can support a subset of regionAndCultures.
     // BUT also require the usa regionAndCulture, so that we can always have a fallback.
-    private readonly imageMap: { [ regionAndCulture in ConcreteRegionAndCulture ]?: ImageableImage } & { usa: ImageableImage }
+    private readonly imageMap: Partial<Record<ConcreteRegionAndCulture, ImageableImage>> & { usa: ImageableImage }
   ) {
     assert && Object.keys( imageMap ).forEach( regionAndCulture => {
       assert && assert( concreteRegionAndCultureValues.includes( regionAndCulture as ConcreteRegionAndCulture ),
Index: phet-core/js/types/WritableKeys.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/phet-core/js/types/WritableKeys.ts b/phet-core/js/types/WritableKeys.ts
--- a/phet-core/js/types/WritableKeys.ts	(revision a17d8c12ff1c8331f8d34be9829e8ca39afa738b)
+++ b/phet-core/js/types/WritableKeys.ts	(date 1730997034787)
@@ -14,6 +14,7 @@
   ( <T>() => T extends Y ? 1 : 2 ) ? A : B;
 
 type WritableKeys<T> = {
-  [P in keyof T]-?: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P>
+  // eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
+  [P in keyof T]-?: IfEquals<Record<P, T[P]>, { -readonly [Q in P]: T[P] }, P>
 }[keyof T];
 export default WritableKeys;
\ No newline at end of file
Index: scenery/js/input/Input.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/scenery/js/input/Input.ts b/scenery/js/input/Input.ts
--- a/scenery/js/input/Input.ts	(revision cc1252cff6d4d5b1eb1495ebfee9c1e29b3acb80)
+++ b/scenery/js/input/Input.ts	(date 1730996951970)
@@ -237,9 +237,7 @@
 
 type SerializedDOMEvent = {
   constructorName: string; // used to get the constructor from the window object, see Input.deserializeDOMEvent
-} & {
-  [key in SerializedPropertiesForDeserialization]?: unknown;
-};
+} & Partial<Record<SerializedPropertiesForDeserialization, unknown>>;
 
 // A list of keys on events that need to be serialized into HTMLElements
 const EVENT_KEY_VALUES_AS_ELEMENTS: SerializedPropertiesForDeserialization[] = [ 'target', 'relatedTarget' ];
Index: axon/js/TinyProperty.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/axon/js/TinyProperty.ts b/axon/js/TinyProperty.ts
--- a/axon/js/TinyProperty.ts	(revision 990e7da2aee59236e582d5bebb84539b7377c0ee)
+++ b/axon/js/TinyProperty.ts	(date 1730996941222)
@@ -164,7 +164,7 @@
    *
    * NOTE: Duplicated with Property.linkAttribute
    */
-  public linkAttribute<Attr extends string>( object: { [key in Attr]: T }, attributeName: Attr ): ( value: T ) => void {
+  public linkAttribute<Attr extends string>( object: Record<Attr, T>, attributeName: Attr ): ( value: T ) => void {
     const handle = ( value: T ) => { object[ attributeName ] = value; };
     this.link( handle );
     return handle;
Index: perennial-alias/package.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/perennial-alias/package.json b/perennial-alias/package.json
--- a/perennial-alias/package.json	(revision fef6c0d2f33cbc0043249177ac95f4d2afea69b9)
+++ b/perennial-alias/package.json	(date 1730996475948)
@@ -23,9 +23,9 @@
     "@types/three": "~0.137.0",
     "@types/nopt": "~3.0.32",
     "@webgpu/types": "~0.1.34",
-    "@typescript-eslint/eslint-plugin": "~8.8.1",
-    "@typescript-eslint/parser": "~8.8.1",
-    "@typescript-eslint/utils": "~8.8.1",
+    "@typescript-eslint/eslint-plugin": "~8.13.0",
+    "@typescript-eslint/parser": "~8.13.0",
+    "@typescript-eslint/utils": "~8.13.0",
     "async": "~0.9.2",
     "async-mutex": "~0.4.0",
     "async-q": "~0.3.1",
@@ -52,7 +52,7 @@
     "rsync": "~0.6.1",
     "thread-sleep": "~2.0.0",
     "tsx": "~4.19.1",
-    "typescript": "~5.5.4",
+    "typescript": "~5.6.3",
     "winston": "~2.4.5",
     "winston-loggly": "~1.3.1",
     "xml2js": "~0.4.15"
Index: density/js/density-main.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/density/js/density-main.ts b/density/js/density-main.ts
--- a/density/js/density-main.ts	(revision cfcc8e8854359a3e5e6009a96ac96c63e69837e5)
+++ b/density/js/density-main.ts	(date 1730997232895)
@@ -62,4 +62,12 @@
     DescriptionContext.startupComplete();
   } );
   sim.start();
-} );
\ No newline at end of file
+} );
+
+
+
+
+
+
+
+
Index: scenery-phet/js/keypad/Keypad.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/scenery-phet/js/keypad/Keypad.ts b/scenery-phet/js/keypad/Keypad.ts
--- a/scenery-phet/js/keypad/Keypad.ts	(revision c0c71dea68c7871ef0f095e082daf807fbf86615)
+++ b/scenery-phet/js/keypad/Keypad.ts	(date 1730996948118)
@@ -74,9 +74,7 @@
 };
 
 export type KeypadOptions = SelfOptions & NodeOptions;
-type KeyboardKeys = {
-  [K in OneKeyStroke]?: Key;
-};
+type KeyboardKeys = Partial<Record<OneKeyStroke, Key>>;
 
 class Keypad extends Node {
 
Index: perennial/package.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/perennial/package.json b/perennial/package.json
--- a/perennial/package.json	(revision fef6c0d2f33cbc0043249177ac95f4d2afea69b9)
+++ b/perennial/package.json	(date 1730996475943)
@@ -23,9 +23,9 @@
     "@types/three": "~0.137.0",
     "@types/nopt": "~3.0.32",
     "@webgpu/types": "~0.1.34",
-    "@typescript-eslint/eslint-plugin": "~8.8.1",
-    "@typescript-eslint/parser": "~8.8.1",
-    "@typescript-eslint/utils": "~8.8.1",
+    "@typescript-eslint/eslint-plugin": "~8.13.0",
+    "@typescript-eslint/parser": "~8.13.0",
+    "@typescript-eslint/utils": "~8.13.0",
     "async": "~0.9.2",
     "async-mutex": "~0.4.0",
     "async-q": "~0.3.1",
@@ -52,7 +52,7 @@
     "rsync": "~0.6.1",
     "thread-sleep": "~2.0.0",
     "tsx": "~4.19.1",
-    "typescript": "~5.5.4",
+    "typescript": "~5.6.3",
     "winston": "~2.4.5",
     "winston-loggly": "~1.3.1",
     "xml2js": "~0.4.15"

samreid added a commit to phetsims/axon that referenced this issue Nov 8, 2024
samreid added a commit to phetsims/phet-core that referenced this issue Nov 8, 2024
samreid added a commit to phetsims/twixt that referenced this issue Nov 8, 2024
samreid added a commit to phetsims/joist that referenced this issue Nov 8, 2024
samreid added a commit to phetsims/utterance-queue that referenced this issue Nov 8, 2024
samreid added a commit to phetsims/scenery that referenced this issue Nov 8, 2024
samreid added a commit to phetsims/scenery-phet that referenced this issue Nov 8, 2024
samreid added a commit to phetsims/alpenglow that referenced this issue Nov 8, 2024
samreid added a commit that referenced this issue Nov 8, 2024
@samreid
Copy link
Member

samreid commented Nov 8, 2024

Updated and notified the team, closing.

@samreid samreid closed this as completed Nov 8, 2024
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

No branches or pull requests

2 participants