Closed pixelzoom closed 1 year ago
A couple other things:
window
is a code smell. PhET agree to namespace globals.circuitConstructionKitTestSuite
, which made fixing it more expensive.The other 2 mains are JavaScript files. And in those files, WebStorm flags window.circuitConstructionKitTestSuite
as “Unresolved variable circuitConstructionKitTestSuite”. So I'm guessing your best options for resolving this in TypeScript is something like:
- // @ts-expect-error
- if ( !window.circuitConstructionKitTestSuite ) {
+ type WindowKey = keyof typeof window;
+ if ( !window[ 'circuitConstructionKitTestSuite' as WindowKey ] ) {
Fixed, closing.
This line in circuit-construction-kit-dc-main.ts:
... was causing CT errors and blocking other devs, so I added a
@ts-expect-error
to unblock.The TS error was:
Oddly, the same line was not a problem in the other CCK main.ts files.