Skip to main content

typescript()

API > @betterer/typescript > typescript

Use this test to incrementally introduce TypeScript configuration to your codebase.

Signature

export declare function typescript(configFilePath: string, extraCompilerOptions?: ts.CompilerOptions): BettererFileTest;

Parameters

ParameterTypeDescription
configFilePathstringThe relative path to a tsconfig.json file.
extraCompilerOptionsts.CompilerOptionsAdditional TypeScript configuration to enable.

Returns

BettererFileTest

Exceptions

BettererError Will throw if the user doesn't pass configFilePath or extraCompilerOptions.

Remarks

typescript is a BettererFileTest, so you can use include(), exclude(), only(), and skip().

Example

import { typescript } from '@betterer/typescript';

export default {
'stricter compilation': () =>
typescript('./tsconfig.json', {
strict: true
})
.include('./src/*.ts')
};