diff --git a/packages/facade/package.json b/packages/facade/package.json index 0d01c1a2a..44aa98aec 100644 --- a/packages/facade/package.json +++ b/packages/facade/package.json @@ -3,6 +3,14 @@ "version": "1.1.0", "main": "lib/es5/index.js", "types": "typings/index.d.ts", + "typesVersions": { + ">=3.1": { + "*": [ + "typings/index.d.ts", + "src/test/*" + ] + } + }, "license": "MIT", "scripts": { "clean": "rm -rf lib flow-typed", @@ -14,8 +22,9 @@ "libdeffix": "node -r esm ../../scripts/libdef-import-fix.js --flow=./typings/index.flow.js --dts=./typings/index.d.ts", "dtsgen": "dts-generator --project ./ --out typings/index.d.ts --prefix @qiwi/substrate/lib/es5 --name @qiwi/substrate --main @qiwi/substrate/lib/es5/index --moduleResolution node", "flowgen": "flowgen typings/index.d.ts --output-file typings/index.flow.js", - "test": "exit 0", - "jest": "jest --config=jest.config.json" + "test": "cp typings/index.d.ts src/test/index.d.ts && yarn dtslint", + "jest": "jest --config=jest.config.json", + "dtslint": "dtslint src/test --onlyTestTsNext" }, "files": [ "README.md", @@ -34,6 +43,7 @@ "ts-loader": "^5.3.3", "ts-node": "^8.0.2", "ts-to-flow": "^0.0.3", - "typescript": "3.2.4" + "typescript": "3.2.4", + "dtslint": "^0.4.2" } } diff --git a/packages/facade/src/test/index.ts b/packages/facade/src/test/index.ts new file mode 100644 index 000000000..1cf949d7c --- /dev/null +++ b/packages/facade/src/test/index.ts @@ -0,0 +1,5 @@ +import { IStringMap } from '@qiwi/substrate'; + +const map: IStringMap = { + foo: 1 // $ExpectError +}; diff --git a/packages/facade/src/test/tsconfig.json b/packages/facade/src/test/tsconfig.json new file mode 100644 index 000000000..108379054 --- /dev/null +++ b/packages/facade/src/test/tsconfig.json @@ -0,0 +1,34 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "noImplicitThis": true, + "alwaysStrict": true, + /* Additional Checks */ + /* next line commented out because we need unused vars for type tests */ + // "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "lib": ["es6"], + "skipLibCheck": true, + "baseUrl": ".", + "paths": { + "@qiwi/substrate-types": [ + ".." + ] + }, + "typeRoots": [".", "../../../types/typings"] + }, + "files": [ + "index.d.ts", + "index.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/packages/facade/src/test/tslint.json b/packages/facade/src/test/tslint.json new file mode 100644 index 000000000..75a9cbad7 --- /dev/null +++ b/packages/facade/src/test/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dtslint.json", + "rules": { + "interface-over-type-literal": false + } +} diff --git a/packages/types/package.json b/packages/types/package.json index 3003d00d4..debaa22e8 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -6,6 +6,7 @@ "typesVersions": { ">=3.1": { "*": [ + "typings/index.d.ts", "src/test/*" ] }