diff --git a/.github/workflows/build-status.yml b/.github/workflows/build-status.yml index 3edac84c..27175b49 100644 --- a/.github/workflows/build-status.yml +++ b/.github/workflows/build-status.yml @@ -34,6 +34,27 @@ jobs: run: yarn format:check - name: Check lint run: yarn lint:check + typecheck: + name: 'Typecheck' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: '**/node_modules' + key: ${{runner.os}}-modules-${{hashFiles('**/yarn.lock')}} + - name: Using Node v16.x + uses: actions/setup-node@v3 + with: + node-version: '16.x' + - name: Install dependencies + run: yarn --frozen-lockfile + - name: Build the library (dev version) + run: | + yarn prebuild + yarn build + - name: Typecheck + run: yarn typecheck test: name: 'Test' runs-on: ubuntu-latest @@ -197,6 +218,10 @@ jobs: uses: ./.github/actions/install-deps-with-current-fc with: path: 'example' + - name: Typecheck example/ + run: | + cd example + yarn typecheck - name: Test example/ run: | cd example @@ -392,6 +417,7 @@ jobs: - production_package - documentation - format_lint + - typecheck - test - test_e2e - test_cjs_esm diff --git a/example/package.json b/example/package.json index 83ad1972..1dd50af7 100644 --- a/example/package.json +++ b/example/package.json @@ -3,7 +3,8 @@ "version": "1.0.0", "description": "Examples of usage of fast-check", "scripts": { - "test": "jest" + "test": "jest", + "typecheck": "tsc --noEmit" }, "dependencies": { "@testing-library/dom": "^8.12.0", diff --git a/package.json b/package.json index c1604dfe..0bb91e7e 100644 --- a/package.json +++ b/package.json @@ -23,21 +23,21 @@ "perf": "node perf/benchmark.js", "profile": "node --prof --no-logfile-per-isolate --trace-deopt --trace-opt-verbose perf/profiler.js > deopt.out && node --prof-process v8.log > v8.out", "prebuild": "node prebuild/prebuild.cjs", - "build": "tsc", - "build:watch": "tsc -w", + "build": "tsc -p tsconfig.nospec.json", + "build:watch": "tsc -p tsconfig.nospec.json -w", "build:publish-types": "tsc -p tsconfig.publish.types.json", "build:publish-cjs": "tsc -p tsconfig.publish.json", "build:publish-esm": "tsc -p tsconfig.publish.json --module es2015 --moduleResolution node --outDir lib/esm && cp package.esm-template.json lib/esm/package.json", "build:prod": "yarn prebuild && yarn build:publish-cjs && yarn build:publish-esm && yarn build:publish-types && node postbuild/main.cjs", "build:prod-ci": "cross-env EXPECT_GITHUB_SHA=true yarn build:prod", - "watch": "tsc -w", + "typecheck": "tsc --noEmit", "test": "jest --config jest.unit.config.cjs --coverage --verbose", "test:watch": "jest --config jest.unit.config.cjs --watch", "test:debug": "node --inspect node_modules/jest/bin/jest.js --config jest.unit.config.cjs --watch --runInBand", "e2e": "jest --config jest.e2e.config.cjs --coverage --verbose", "e2e:watch": "jest --config jest.e2e.config.cjs --watch", "update:examples": "cross-env UPDATE_CODE_SNIPPETS=true jest --config jest.examples.config.cjs", - "docs": "api-extractor run --local && rm docs/fast-check.api.json && typedoc --out docs src/fast-check-default.ts && node postbuild/main.cjs", + "docs": "api-extractor run --local && rm docs/fast-check.api.json && typedoc --tsconfig tsconfig.nospec.json --out docs src/fast-check-default.ts && node postbuild/main.cjs", "docs-ci": "cross-env EXPECT_GITHUB_SHA=true yarn docs", "docs:serve": "npx serve docs/", "format": "prettier --write \"**/*.{js,ts}\"", diff --git a/tsconfig.json b/tsconfig.json index 20e530fa..8e55fe76 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,12 +15,10 @@ "target": "es2017", "outDir": "lib/", }, - "include": [ - "src/**/*" - ], "exclude": [ "example", - "node_modules", - "**/*.spec.ts" + "test/esm", + "test/legacy", + "test/type" ] } diff --git a/tsconfig.nospec.json b/tsconfig.nospec.json new file mode 100644 index 00000000..d6f5cbf3 --- /dev/null +++ b/tsconfig.nospec.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*"] +} \ No newline at end of file diff --git a/tsconfig.publish.json b/tsconfig.publish.json index 069d98be..bca4d0c1 100644 --- a/tsconfig.publish.json +++ b/tsconfig.publish.json @@ -1,5 +1,5 @@ { - "extends": "./tsconfig.json", + "extends": "./tsconfig.nospec.json", "compilerOptions": { "declaration": false, "incremental": false,