#TIL 31 - Fix build error on oclif CLI for Typescript 4.8.3

Sep 14, 2022 · Dung Huynh

What

Fix error TS2344: Type 'F' does not satisfy the constraint 'FlagOutput' in oclif with TypeScript 4.8+.

Why

TypeScript 4.8 introduced stricter type checking that breaks oclif's default tsc build.

How

Replace tsc with tsup:

package.json:

{
  "build": "tsup"
}

tsup.config.json:

{
  "entry": ["src/**/*.ts"],
  "splitting": false,
  "sourcemap": true,
  "clean": true
}