From 90125566bbaed8b5c6e55ca8dbc432e3433fb73c Mon Sep 17 00:00:00 2001 From: Maximilien Mellen Date: Wed, 19 Feb 2020 21:36:18 +0100 Subject: Enable TS strict mode by default (#3899) Fixes #3324 Co-authored-by: Kitson Kelly --- cli/js/test_util.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'cli/js/test_util.ts') diff --git a/cli/js/test_util.ts b/cli/js/test_util.ts index dbb7bf2c4..3e089486b 100644 --- a/cli/js/test_util.ts +++ b/cli/js/test_util.ts @@ -62,7 +62,10 @@ function permissionsMatch( requiredPerms: Permissions ): boolean { for (const permName in processPerms) { - if (processPerms[permName] !== requiredPerms[permName]) { + if ( + processPerms[permName as keyof Permissions] !== + requiredPerms[permName as keyof Permissions] + ) { return false; } } @@ -302,7 +305,7 @@ testPerm( async function assertAllUnitTestFilesImported(): Promise { const directoryTestFiles = Deno.readDirSync("./cli/js") .map(k => k.name) - .filter(file => file.endsWith("_test.ts")); + .filter(file => file!.endsWith("_test.ts")); const unitTestsFile: Uint8Array = Deno.readFileSync( "./cli/js/unit_tests.ts" ); @@ -311,11 +314,11 @@ testPerm( .split("\n") .filter(line => line.startsWith("import") && line.includes("_test.ts")); const importedTestFiles = importLines.map( - relativeFilePath => relativeFilePath.match(/\/([^\/]+)";/)[1] + relativeFilePath => relativeFilePath.match(/\/([^\/]+)";/)![1] ); directoryTestFiles.forEach(dirFile => { - if (!importedTestFiles.includes(dirFile)) { + if (!importedTestFiles.includes(dirFile!)) { throw new Error( "cil/js/unit_tests.ts is missing import of test file: cli/js/" + dirFile -- cgit v1.2.3