• Error
  • Reported by the tsconfig loader

TS5110

Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'.

`moduleResolution` is `node16` or `nodenext` but `module` doesn't match. Set `module` to the same value.

What it means

Node's resolution modes only make sense together with the matching module format: with "moduleResolution": "nodenext", module must be nodenext too (and node16 with node16). The error is reported on the module setting.

ts-r's config loader has this check, but ts-r-check doesn't print program-level option diagnostics yet, so it doesn't report this code today. tsc 7 does.

How to fix

  • Set module to the same value as moduleResolution, or remove moduleResolution and let "module": "nodenext" imply it.
  • If a bundler builds the code, use "module": "esnext" with "moduleResolution": "bundler".