entry list | previous: Procedural Shape Editor | next: Secondary action invocation in Phrebar

date: 2016-08-02
subject: strictNullChecks

strictNullChecks - 2016-08-02 - Entry 12

I upgraded to TypeScript 2.0.0 and turned on strictNullChecks. Better sooner than later, I figure. So for the past several days I've been going through pages of error messages like these and fixing them one by one:

src/main/ts/togos-game21/ObjectImageManager.ts(147,21): error TS2345: Argument of type 'Uint8Array | undefined' is not assignable to parameter of type 'Uint8Array'.
  Type 'undefined' is not assignable to type 'Uint8Array'.
src/main/ts/togos-game21/ObjectImageManager.ts(165,7): error TS2322: Type 'null' is not assignable to type 'ObjectVisualState'.
src/main/ts/togos-game21/ObjectImageManager.ts(211,10): error TS2322: Type '(string | undefined)[]' is not assignable to type 'string[]'.
  Type 'string | undefined' is not assignable to type 'string'.
    Type 'undefined' is not assignable to type 'string'.
src/main/ts/togos-game21/ObjectImageManager.ts(249,40): error TS2345: Argument of type 'MAObjectVisual | null' is not assignable to parameter of type 'MAObjectVisual'.
  Type 'null' is not assignable to type 'MAObjectVisual'.
src/main/ts/togos-game21/ObjectImageManager.ts(252,45): error TS2345: Argument of type '{}' is not assignable to parameter of type 'ObjectVisualFrame'.
  Property 'visualBasisType' is missing in type '{}'.
src/main/ts/togos-game21/ObjectImageManager.ts(254,11): error TS2531: Object is possibly 'null'.
src/main/ts/togos-game21/QuaternionDemo.ts(38,75): error TS2345: Argument of type 'null' is not assignable to parameter of type 'Game'.
src/main/ts/togos-game21/RailDemo.ts(123,6): error TS2345: Argument of type 'null' is not assignable to parameter of type '((x: number, y: number, z: number, rad: number) => void) | undefined'.
src/main/ts/togos-game21/RailDemo.ts(198,5): error TS2345: Argument of type 'null' is not assignable to parameter of type '((x: number, y: number, z: number, rad: number) => void) | undefined'.
src/main/ts/togos-game21/RoomGroupSimulator.ts(19,9): error TS2322: Type 'T | undefined' is not assignable to type 'T'.
  Type 'undefined' is not assignable to type 'T'.
src/main/ts/togos-game21/RoomGroupSimulator.ts(185,18): error TS2532: Object is possibly 'undefined'.
src/main/ts/togos-game21/RoomGroupSimulator.ts(185,36): error TS2532: Object is possibly 'undefined'.
src/main/ts/togos-game21/RoomGroupSimulator.ts(186,18): error TS2532: Object is possibly 'undefined'.
src/main/ts/togos-game21/RoomGroupSimulator.ts(186,36): error TS2532: Object is possibly 'undefined'.
src/main/ts/togos-game21/RoomGroupSimulator.ts(187,18): error TS2532: Object is possibly 'undefined'.
src/main/ts/togos-game21/RoomGroupSimulator.ts(187,36): error TS2532: Object is possibly 'undefined'.
src/main/ts/togos-game21/RoomGroupSimulator.ts(223,39): error TS2345: Argument of type 'Vector3D | undefined' is not assignable to parameter 

Which isn't very exciting. No new synthwave tracks, either. Though I may have decided that saturn1601cj doesn't really need any more work after all. (The NewRetroWave YouTube channel rejected it as my submission even though it's objectively a better track than half of the stuff they play. Boo.)

next: Secondary action invocation in Phrebar