How to use the tsconfig.resolve function in tsconfig

To help you get started, we’ve selected a few tsconfig examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mike-north / jsonapi-typescript / tests / helpers.ts View on Github external
async function tsFileAssert(
	fileName: string,
	errType?: string | RegExp | Function,
	message?: string | RegExp,
	assertMethod = assert.throws
): Promise {
	let typescriptConfig = await tsconfig.resolve(dirname(fileName));
	let cb = () => {
		check([fileName], typescriptConfig as string);
	};
	if (!errType) {
		assertMethod(cb);
	} else if (typeof errType === 'string') {
		assertMethod(cb, errType);
	} else if (message && typeof message === 'string') {
		assertMethod(cb, errType, message);
	} else if (errType instanceof Function && message instanceof RegExp) {
		assertMethod(cb, errType, message);
	} else {
		assertMethod(cb, errType);
	}
}

tsconfig

Resole and parse `tsconfig.json`, replicating to TypeScript's behaviour

MIT
Latest version published 7 years ago

Package Health Score

71 / 100
Full package analysis