diff --git a/RoboFile.php b/RoboFile.php index 1491c71dc7..58475b1fad 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -363,7 +363,7 @@ class RoboFile extends \Robo\Tasks { } public function qaLintJavascript() { - return $this->_exec('npm run lint'); + return $this->_exec('npm run check-types && npm run lint'); } public function qaLintCss() { diff --git a/assets/js/src/notices/notice.tsx b/assets/js/src/notices/notice.tsx index 8861ecc1c8..4f038c13e3 100644 --- a/assets/js/src/notices/notice.tsx +++ b/assets/js/src/notices/notice.tsx @@ -4,13 +4,13 @@ import MailPoet from 'mailpoet'; type Props = { type: 'success' | 'info' | 'warning' | 'error'; - scroll: boolean; - closable: boolean; - renderInPlace: boolean; + children: ReactNode; + scroll?: boolean; + closable?: boolean; + renderInPlace?: boolean; onDisplay?: () => void; onClose?: () => void; - timeout: number | false; - children: ReactNode; + timeout?: number | false; }; const Notice: FC = ({ diff --git a/package.json b/package.json index eea2a9933e..2f580a3336 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "not dead" ], "scripts": { - "lint": "npm run lint6 && npm run lint5 && npm run lint-tests", + "lint": "npm run lint6 && npm run lint-ts && npm run lint5 && npm run lint-tests", "lint6": "eslint -c .eslintrc.es6.json --max-warnings 0 'assets/js/src/**/*.jsx' 'tests/javascript/**/*.js'", "lint-ts": "eslint -c .eslintrc.ts.json --max-warnings 0 'assets/js/src/**/*.tsx' 'assets/js/src/**/*.ts'", "lint5": "eslint -c .eslintrc.es5.json --ignore-pattern helpscout.js --max-warnings 0 'assets/js/src/**/*.js'", @@ -18,7 +18,8 @@ "autoprefixer": "postcss assets/dist/css/*.css --use autoprefixer --no-map --replace", "scss": "node-sass assets/css/src/ --output assets/dist/css/ --output-style compact", "stylelint": "stylelint --fix", - "test": "mocha --require @babel/register tests/javascript/**/*.spec.js" + "test": "mocha --require @babel/register tests/javascript/**/*.spec.js", + "check-types": "tsc --noEmit" }, "dependencies": { "@babel/runtime": "^7.8.4", diff --git a/tsconfig.json b/tsconfig.json index 7fdacce9b9..5ee02b9422 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,8 +20,10 @@ "strictPropertyInitialization": false, /* Enable strict checking of property initialization in classes. */ "noImplicitThis": false, /* Raise error on 'this' expressions with an implied 'any' type. */ "alwaysStrict": false, /* Parse in strict mode and emit "use strict" for each source file. */ + "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ + // "incremental": true, /* Enable incremental compilation */ // "lib": [], /* Specify library files to be included in the compilation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ @@ -43,7 +45,6 @@ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ /* Module Resolution Options */ - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */