fix(integration-ever-works): develop's API image builds again (narrowing without strictNullChecks)

Merged
EV
11d ago
+31-23

Fix-forward: develop's API image does not build. Found by gw-gauzy-followups while checking the Upgrade Test runs for item (e). Owned by 7dae55c0/gw-gauzy-followups — other lanes please don't push to this branch.

What broke

yarn build:api:dev:docker (webpack with the API's non-strict app tsconfig, strict: false from tsconfig.base.json) fails with 29 errors, all in @gauzy/plugin-integration-ever-works — e.g. the Upgrade Test after-image builds of develop c1c53f16e2 (run 38982212983) and ffb81f6fae (run 38986643748). The plugin's own strict tsc is clean, which is why the lanes' checks did not see it: the narrowing below only works with strictNullChecks.

  • tasks/ever-works-tasks.service.ts: outgoing() returns { wait: string } | { wait?: undefined; g; teamIds; … } and createInEverWorks / the update path narrowed it with out.wait !== undefined. Without strictNullChecks an optional undefined member does not discriminate the union → TS2339 on out.g, out.teamIds, out.watchers, … (28 errors, lines 1065–1208).
  • goals/ever-works-goals.service.ts:519: findOne(...) as Record<string, unknown> | null → TS2352 without strictNullChecks.

Fix (no behaviour change)

  • The two shapes are named (TaskOutgoingWait, TaskOutgoing) and the callers narrow with a type guard waitsFor(out), which narrows in both modes.
  • The goals cast goes through unknown.

Checked

tsc --noEmit of the plugin with its strict config and with the app's loose settings (strict: false, the API build's): 0 errors in the plugin on this branch; the loose run reproduces exactly the 29 errors on develop bae71421f9. Egress static scan ok; no hostnames in the diff.

🤖 Generated with Claude Code


Summary by cubic

Fixes develop's API image build, which was failing with 29 TypeScript errors in @gauzy/plugin-integration-ever-works. The API build compiles the plugin with strictNullChecks off, where out.wait !== undefined no longer discriminates the union returned by outgoing(), causing TS2339 on fields like out.g and out.teamIds. The two shapes are now named types, and callers narrow with the type guard waitsFor(out), which works under both strict and loose settings; the goals cast now goes through unknown. No behavior change.