Skip to content

Commit

Permalink
Allow to write typetests by tsd
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Jul 7, 2022
1 parent ffff105 commit 69cf11b
Show file tree
Hide file tree
Showing 11 changed files with 372 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm nx affected:test
- run: pnpm nx affected --target=typetest
- run: pnpm nx affected:lint
- run: pnpm nx format:check
- run: pnpm typecheck
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Continue reading about `farfetched` in the [documentation](./docs/README.md). It
- make changes
- make sure that your changes is passing checks:
- run tests via `pnpm nx affected:test`
- run type tests via `pnpm nx affected --target=typetest`
- run linter via `pnpm nx affected:lint`
- format code via `pnpm nx format:write`
- type correctness via `pnpm typecheck`
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"private": true,
"devDependencies": {
"@nrwl/cli": "14.4.1",
"@nrwl/devkit": "^14.4.2",
"@nrwl/eslint-plugin-nx": "14.4.1",
"@nrwl/jest": "14.4.1",
"@nrwl/js": "14.4.1",
Expand All @@ -25,6 +26,7 @@
"prettier": "^2.6.2",
"ts-jest": "27.1.4",
"ts-node": "~10.8.0",
"tsd": "^0.22.0",
"typescript": "~4.7.2"
}
}
29 changes: 10 additions & 19 deletions packages/core/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": [
"{options.outputPath}"
],
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/core",
"main": "packages/core/src/index.ts",
"tsConfig": "packages/core/tsconfig.lib.json",
"assets": [
"packages/core/*.md"
]
"assets": ["packages/core/*.md"]
}
},
"publish": {
Expand All @@ -31,28 +27,23 @@
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": [
"{options.outputFile}"
],
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/core/**/*.ts"
]
"lintFilePatterns": ["packages/core/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": [
"coverage/packages/core"
],
"outputs": ["coverage/packages/core"],
"options": {
"jestConfig": "packages/core/jest.config.ts",
"passWithNoTests": true
}
},
"typetest": {
"executor": "./tools/executors/tsd:tsd"
}
},
"implicitDependencies": [
"!test-utils"
],
"implicitDependencies": ["!test-utils"],
"tags": []
}
}
2 changes: 1 addition & 1 deletion packages/core/src/query/__tests__/create_query.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { allSettled, createEffect, fork } from 'effector';
import { Contract } from '../../contract/type';

import { createQuery } from '../create_query';

describe('core/createQuery/handler', () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/query/__tests__/create_query.type_spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { expectType } from 'tsd';

expectType<number>(1 as number);
Loading

0 comments on commit 69cf11b

Please sign in to comment.