#6998·sst

Platform source does not type-check under strict: TS18048 in aws/function.ts

Author: leo-lemCreated Sep 13, 2026Updated Sep 13, 2026

A consumer project that type-checks its own infra/ sources has to include .sst/platform/config.d.ts, because that is what declares $app, $dev, $util and the component classes. That declaration file references the platform's own TypeScript source under .sst/platform/src/, which therefore enters the program through the reference graph rather than through the consumer's include globs.

One diagnostic comes with it:

.sst/platform/src/components/aws/function.ts(2689,37): error TS18048: 'v' is possibly 'undefined'.

The code is the description transform in the dev branch:

typescript
description: transformed[1].description
  ? output(transformed[1].description).apply(
      (v) => `${v.substring(0, 240)} (live)`,
    )
  : "live",

v is narrowed from transformed[1].description, but the .apply callback parameter is typed independently, so the outer truthiness check does not reach it.

Versions

  • sst 4.14.3
  • Reproduced with both TypeScript 6.0.3 and the TS 7 native compiler (@typescript/native-preview, 7.0.0-dev.20260707.2), so it is not specific to the native preview.

Why the usual escapes do not apply

  • exclude does not remove it: the file arrives through the reference graph, not the include globs.
  • skipLibCheck does not apply: this is .ts source, not a .d.ts.
  • Patching locally does not survive: .sst/ is generated by sst install and gitignored, so the patch is gone on the next install and never exists on a fresh CI runner.

Note that .sst/platform/tsconfig.json extends @tsconfig/node18, which sets strict: true, so this is reachable under the platform's own strictness rather than only under an unusually strict consumer config.

What we do meanwhile We filter diagnostics whose path lies under .sst/platform/, by path prefix and never by error code, so a diagnostic of the same code in our own files still fails the build. That suppresses a genuine incompatibility SST might one day report inside its own source, which is why a fix upstream is worth more than the workaround.