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.3 and TypeScript eslint 6.18 #1417

Closed
samreid opened this issue Jan 12, 2024 · 4 comments
Closed

Upgrade to TypeScript 5.3 and TypeScript eslint 6.18 #1417

samreid opened this issue Jan 12, 2024 · 4 comments
Assignees

Comments

@samreid
Copy link
Member

samreid commented Jan 12, 2024

TypeScript 5.3 has been out long enough that TypeScript ESLint has also been updated. When I upgrade both in chipper/package.json, I see tsc and grunt lint-everything --disable-eslint-cache working well. We pick up these new issues:

../../../phet-core/js/swapObjectKeys.ts:28:5 - error TS2322: Type 'T[keyof T]' is not assignable to type '{}'.
  Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{}'.
    Type 'T[string]' is not assignable to type '{}'.

28     value1 = object[ keyName1 ];
       ~~~~~~

../../../phet-core/js/swapObjectKeys.ts:31:5 - error TS2322: Type 'T[keyof T]' is not assignable to type '{}'.

31     value2 = object[ keyName2 ];
       ~~~~~~

and


/Users/samreid/phet/root/alpenglow/js/cag/LinearEdge.ts
  24:21  error  Type boolean trivially inferred from a boolean literal, remove type annotation  @typescript-eslint/no-inferrable-types

/Users/samreid/phet/root/alpenglow/js/webgpu/compute/TextureBindingType.ts
  15:21  error  Type boolean trivially inferred from a boolean literal, remove type annotation  @typescript-eslint/no-inferrable-types

✖ 2 problems (2 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

Here is the patch I was testing with:

Subject: [PATCH] Factor out keyboard order code, see https://github.com/phetsims/projectile-data-lab/issues/60
---
Index: package.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/package.json b/package.json
--- a/package.json	(revision 3af8b686e5f7152d553e2f7dcb227b3e568f29d8)
+++ b/package.json	(date 1705067102514)
@@ -27,9 +27,9 @@
     "@types/three": "~0.137.0",
     "@types/react": "~18.0.12",
     "@types/react-dom": "~18.0.5",
-    "@typescript-eslint/parser": "~6.1.0",
-    "@typescript-eslint/eslint-plugin": "~6.1.0",
-    "@typescript-eslint/utils": "~6.1.0",
+    "@typescript-eslint/parser": "~6.18.1",
+    "@typescript-eslint/eslint-plugin": "~6.18.1",
+    "@typescript-eslint/utils": "~6.18.1",
     "eslint-plugin-html": "~7.1.0",
     "@webgpu/types": "~0.1.34",
     "archiver": "~5.3.0",
@@ -54,7 +54,7 @@
     "qunit": "~2.20.0",
     "taffydb": "~2.7.3",
     "terser": "~4.6.4",
-    "typescript": "~5.1.3",
+    "typescript": "~5.3.3",
     "webpack": "~5.76.3",
     "webpack-cli": "~5.0.0",
     "webpack-dev-server": "~4.11.1"

@zepumph should we make time to do this upgrade?

zepumph added a commit to phetsims/alpenglow that referenced this issue Jan 12, 2024
zepumph added a commit to phetsims/phet-core that referenced this issue Jan 12, 2024
@zepumph
Copy link
Member

zepumph commented Jan 12, 2024

Thanks for knowing this! Yes, let's apply the patch. I fixed the above issues and we can proceed with anything else that comes up throughout the day. Let me know if you'd like me to do anything else

@zepumph zepumph assigned samreid and unassigned zepumph Jan 12, 2024
@samreid
Copy link
Member Author

samreid commented Jan 12, 2024

Uh-oh, I applied the patch and pulled the changes above, but this time I got this error:

~/phet/root/chipper$ grunt lint-everything --disable-eslint-cache
Running "lint-everything" task
(Forwarding task to perennial)
Running "lint-everything" task
[....................................... ] 96.35%>> <--- Last few GCs --->
>> 
>> [82984:0x138008000]   288400 ms: Scavenge 3895.3 (4126.6) -> 3883.3 (4127.3) MB, 48.33 / 0.00 ms  (average mu = 0.361, current mu = 0.460) allocation failure; 
>> [82984:0x138008000]   288509 ms: Scavenge 3898.1 (4127.3) -> 3886.4 (4127.8) MB, 24.79 / 0.00 ms  (average mu = 0.361, current mu = 0.460) allocation failure; 
>> [82984:0x138008000]   288611 ms: Scavenge 3900.9 (4128.1) -> 3889.7 (4129.1) MB, 46.58 / 0.00 ms  (average mu = 0.361, current mu = 0.460) allocation failure; 
>> 
>> 
>> <--- JS stacktrace --->
>> FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
>> 1: 0x102d4cbf4 node::Abort() [/usr/local/bin/node]
>> 2: 0x102d4cddc node::ModifyCodeGenerationFromStrings(v8::Local<v8::Context>, v8::Local<v8::Value>, bool) [/usr/local/bin/node]
>> 3: 0x102ed0da8 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/node]
>> 4: 0x1030a56e8 v8::internal::Heap::GarbageCollectionReasonToString(v8::internal::GarbageCollectionReason) [/usr/local/bin/node]

@samreid
Copy link
Member Author

samreid commented Jan 12, 2024

@zepumph and I confirmed that was a temporary problem. It couldn't be reproduced. We agreed to push. Pushed. I'll notify slack.

@samreid
Copy link
Member Author

samreid commented Jan 12, 2024

I wrote:

Greetings! We upgraded to TypeScript 5.3 and TypeScript ESLint 6.18, please see #1417. At your convenience, please pull chipper and run npm update or install. Report any problems in the issue, thanks!

Closing.

@samreid samreid closed this as completed Jan 12, 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