Skip to Content
ProjectCompiler Options

Compiler Options

The compiler options are loaded from the nearest tsconfig.json.

TSConfig File

TSTyche searches for the nearest tsconfig.json that includes the file in question. The path of the discovered TSConfig file is included in the report:

uses TypeScript 5.8.3 with ./typetests/tsconfig.json

If a particular test file is not included in any of the TSConfig files found in enclosing directories, default compiler options are set. The report will look like this:

uses TypeScript 5.8.3

To specify the path to tsconfig.json explicitly, pass it with the --tsconfig command line option or use the tsconfig configuration option.

To inspect the resolved compiler configuration, pass the path of the TSConfig file to tsc together with the --showConfig option:

tsc --project ./typetests/tsconfig.json --showConfig

Language Service Plugins

To work smoothly with Svelte, Vue or similar projects, a code editor needs an additional extension to be installed. Usually, the extension provides a TypeScript language service plugin , which helps the editor to reason about typings of a project.

TSTyche makes sure the plugins are loaded, but they must be installed and explicitly listed in a TSConfig file. For example, if your type tests import from .svelte files, install the typescript-svelte-plugin package:

npm add -D typescript-svelte-plugin

And add it to the language service plugins list in tsconfig.json:

{ "compilerOptions": { "plugins": [{ "name": "typescript-svelte-plugin" }] } }

Default Compiler Options

TSTyche sets the following default compiler options:

{ "allowImportingTsExtensions": true, // not set for TypeScript 4.x "allowJs": true, "checkJs": true, "exactOptionalPropertyTypes": true, "jsx": "preserve", "module": "nodenext", "moduleResolution": "nodenext", "noUncheckedIndexedAccess": true, "noUncheckedSideEffectImports": true, // only for TypeScript >=5.6 "resolveJsonModule": true, "strict": true, "target": "esnext", "verbatimModuleSyntax": true // not set for TypeScript 4.x }

Your code editor may have set different default compiler options. This is the reason why TSTyche might see typings different from the editor. If that is an issue, add a tsconfig.json file to a project and it will be used by both TSTyche and the editor.

Last updated on