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
Parameter | Type | Description |
---|---|---|
configFilePath | string | The relative path to a tsconfig.json file. |
extraCompilerOptions | ts.CompilerOptions | Additional TypeScript configuration to enable. |
Returns
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')
};