Browse Source

Add strict TS checking

Alexandru Dima 5 years ago
parent
commit
c0fb272a34
3 changed files with 9 additions and 8 deletions
  1. 2 2
      src/apex/apex.ts
  2. 6 6
      src/mocha.d.ts
  3. 1 0
      src/tsconfig.json

+ 2 - 2
src/apex/apex.ts

@@ -189,9 +189,9 @@ const keywords = [
 
 
 // create case variations of the keywords - apex is case insensitive, but we can't make the highlighter case insensitive
 // create case variations of the keywords - apex is case insensitive, but we can't make the highlighter case insensitive
 // because we use a heuristic to assume that identifiers starting with an upper case letter are types.
 // because we use a heuristic to assume that identifiers starting with an upper case letter are types.
-const uppercaseFirstLetter = (lowercase) => lowercase.charAt(0).toUpperCase() + lowercase.substr(1);
+const uppercaseFirstLetter = (lowercase: string) => lowercase.charAt(0).toUpperCase() + lowercase.substr(1);
 
 
-let keywordsWithCaseVariations = [];
+let keywordsWithCaseVariations: string[] = [];
 keywords.forEach(lowercase => {
 keywords.forEach(lowercase => {
 	keywordsWithCaseVariations.push(lowercase);
 	keywordsWithCaseVariations.push(lowercase);
 	keywordsWithCaseVariations.push(lowercase.toUpperCase());
 	keywordsWithCaseVariations.push(lowercase.toUpperCase());

+ 6 - 6
src/mocha.d.ts

@@ -5,9 +5,9 @@
 
 
 declare function run(): void;
 declare function run(): void;
 
 
-declare function suite(name: string, fn: (err?)=>void);
-declare function test(name: string, fn: (done?: (err?)=>void)=>void);
-declare function suiteSetup(fn: (done?: (err?)=>void)=>void);
-declare function suiteTeardown(fn: (done?: (err?)=>void)=>void);
-declare function setup(fn: (done?: (err?)=>void)=>void);
-declare function teardown(fn: (done?: (err?)=>void)=>void);
+declare function suite(name: string, fn: (err?: any)=>void): void;
+declare function test(name: string, fn: (done: (err?: any)=>void)=>void): void;
+declare function suiteSetup(fn: (done: (err?: any)=>void)=>void): void;
+declare function suiteTeardown(fn: (done: (err?: any)=>void)=>void): void;
+declare function setup(fn: (done: (err?: any)=>void)=>void): void;
+declare function teardown(fn: (done: (err?: any)=>void)=>void): void;

+ 1 - 0
src/tsconfig.json

@@ -3,6 +3,7 @@
     "module": "amd",
     "module": "amd",
     "outDir": "../release/dev",
     "outDir": "../release/dev",
     "target": "es5",
     "target": "es5",
+	"strict": true,
     "lib": [
     "lib": [
       "dom",
       "dom",
       "es5",
       "es5",