From 90dca911c0395c0941ce7399130836e9325d4a1e Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Fri, 23 Jan 2026 23:31:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5(expect-type)=20Drop=20the=20projec?= =?UTF-8?q?t=20(#6485)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** The package has been marked as deprecated. We recommend users to prefer using expectTypeOf coming with vitest. This package has been initially done for internal use and replaced a previous tool that we used for quite a few times but that got stopped. When stopped we have not found any equivalent option and thus we attempted to implement our own... until vitest came to the scene with that being built-in. **Checklist** — _Don't delete this checklist and make sure you do the following before opening the PR_ - [x] The name of my PR follows [gitmoji](https://gitmoji.dev/) specification - [x] My PR references one of several related issues (if any) - [x] New features or breaking changes must come with an associated Issue or Discussion - [x] My PR does not add any new dependency without an associated Issue or Discussion - [x] My PR includes bumps details, please run `pnpm run bump` and flag the impacts properly - [x] My PR adds relevant tests and they would have failed without my PR (when applicable) **Advanced** - [ ] Category: ... - [ ] Impacts: ... --- .github/copilot-instructions.md | 2 +- .github/workflows/build-status.yml | 74 ---------------- .github/zizmor.yml | 2 - eslint.config.mjs | 1 - packages/expect-type/.gitignore | 1 - packages/expect-type/CHANGELOG.md | 79 ----------------- packages/expect-type/LICENSE | 21 ----- packages/expect-type/README.md | 21 ----- packages/expect-type/package.json | 63 -------------- packages/expect-type/src/cjs/main.js | 9 -- packages/expect-type/src/cjs/package.json | 3 - packages/expect-type/src/internals.d.ts | 42 --------- packages/expect-type/src/main.d.ts | 9 -- packages/expect-type/src/main.js | 8 -- packages/expect-type/test-types/main.ts | 4 - packages/expect-type/test/internals.spec.ts | 95 --------------------- packages/expect-type/test/main.spec.ts | 77 ----------------- packages/expect-type/tsconfig.json | 3 - pnpm-lock.yaml | 9 -- vitest.config.mjs | 1 - 20 files changed, 1 insertion(+), 523 deletions(-) delete mode 100644 packages/expect-type/.gitignore delete mode 100644 packages/expect-type/CHANGELOG.md delete mode 100644 packages/expect-type/LICENSE delete mode 100644 packages/expect-type/README.md delete mode 100644 packages/expect-type/package.json delete mode 100644 packages/expect-type/src/cjs/main.js delete mode 100644 packages/expect-type/src/cjs/package.json delete mode 100644 packages/expect-type/src/internals.d.ts delete mode 100644 packages/expect-type/src/main.d.ts delete mode 100644 packages/expect-type/src/main.js delete mode 100644 packages/expect-type/test-types/main.ts delete mode 100644 packages/expect-type/test/internals.spec.ts delete mode 100644 packages/expect-type/test/main.spec.ts delete mode 100644 packages/expect-type/tsconfig.json diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 25de0344..0675677e 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -10,7 +10,7 @@ When creating or naming pull requests, follow the [gitmoji](https://gitmoji.dev/ - Example: `✨ Add new arbitrary for dates` - Example: `🐛 Fix edge case in integer shrinking` -- **For changes to other packages** (ava, vitest, jest, worker, poisoning, packaged, expect-type): Use the format `emoji(package-name) Description` +- **For changes to other packages** (ava, vitest, jest, worker, poisoning, packaged): Use the format `emoji(package-name) Description` - Example: `👷(vitest) Add support for new vitest features` - Example: `🐛(jest) Fix compatibility with jest 29` - Example: `📝(ava) Update documentation for ava integration` diff --git a/.github/workflows/build-status.yml b/.github/workflows/build-status.yml index 02ad0dc9..c3298b70 100644 --- a/.github/workflows/build-status.yml +++ b/.github/workflows/build-status.yml @@ -1121,78 +1121,4 @@ jobs: packages/worker/${{env.TGZ_NAME}}.sigstore.json body: | - [View attestation](${{steps.attest.outputs.attestation-url}}) • [Documentation](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations) - check_publish_expect_type: - name: Check publish @fast-check/expect-type - needs: check_any_package - if: needs.check_any_package.outputs.tag_count != '0' - runs-on: ubuntu-latest - outputs: - status: ${{steps.check_has_tag.outcome}} - tag: ${{steps.check_has_tag.outputs.tag}} - steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - with: - persist-credentials: false - fetch-depth: 0 - - id: check_has_tag - name: Check if one tag matches the package - run: echo "tag=$(git tag --points-at HEAD | grep '^expect-type/v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*')" >> "$GITHUB_OUTPUT" - continue-on-error: true - publish_package_expect_type: - name: Publish @fast-check/expect-type - needs: check_publish_expect_type - if: needs.check_publish_expect_type.outputs.status == 'success' - runs-on: ubuntu-latest - permissions: - contents: write - id-token: write - attestations: write - steps: - - name: Using Node v24.x - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 - with: - node-version: '24.x' - registry-url: 'https://registry.npmjs.org' - check-latest: true - - name: Download production packages - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 - with: - name: bundles - path: packages/ - - uses: step-security/wait-for-secrets@084b3ae774c0e0003a9307ae4f487c10f1f998fe # v1.2.1 - id: wait-for-secrets - with: - secrets: | - OTP: - name: 'OTP to publish package' - description: 'OTP from authenticator app' - - name: Set package filename - run: echo "TGZ_NAME=expect-type-$(tar -xzOf packages/expect-type/package.tgz package/package.json | jq -r '.version').tgz" >> $GITHUB_ENV - - name: Rename package for publication - run: mv packages/expect-type/package.tgz "packages/expect-type/$TGZ_NAME" - - name: Publish @fast-check/expect-type - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - PUBLISH_TAG: ${{github.ref == 'refs/heads/main' && 'latest' || startsWith(github.ref, 'refs/heads/next-') && 'next' || 'legacy'}} - OTP_VALUE: ${{steps.wait-for-secrets.outputs.OTP}} - run: npm publish --access public --otp "$OTP_VALUE" --tag "$PUBLISH_TAG" "packages/expect-type/$TGZ_NAME" - - uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0 - id: attest - with: - subject-path: packages/expect-type/${{env.TGZ_NAME}} - - name: Rename attestation bundle - run: mv "${{steps.attest.outputs.bundle-path}}" "packages/expect-type/${{env.TGZ_NAME}}.sigstore.json" - - name: Update GitHub Release - uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 - with: - tag_name: ${{needs.check_publish_expect_type.outputs.tag}} - append_body: true - fail_on_unmatched_files: true - overwrite_files: false - files: | - packages/expect-type/${{env.TGZ_NAME}} - packages/expect-type/${{env.TGZ_NAME}}.sigstore.json - body: | - [View attestation](${{steps.attest.outputs.attestation-url}}) • [Documentation](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations) diff --git a/.github/zizmor.yml b/.github/zizmor.yml index 1a0b287d..8a210744 100644 --- a/.github/zizmor.yml +++ b/.github/zizmor.yml @@ -16,7 +16,6 @@ rules: - build-status.yml:931 # poisoning - build-status.yml:1005 # vitest - build-status.yml:1079 # worker - - build-status.yml:1153 # expect-type template-injection: ignore: # These are safe - TGZ_NAME is set from package.json version in controlled environment @@ -28,4 +27,3 @@ rules: - build-status.yml:963 # poisoning - build-status.yml:1037 # vitest - build-status.yml:1111 # worker - - build-status.yml:1185 # expect-type diff --git a/eslint.config.mjs b/eslint.config.mjs index fb2b3e67..bc923b1e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -56,7 +56,6 @@ export default [ 'packages/ava/test/ava-specs/testProp.js', '**/ava.config.js', '**/jest.config.js', - 'packages/expect-type/src/*.js', 'packages/packaged/bin/*.js', ], languageOptions: { diff --git a/packages/expect-type/.gitignore b/packages/expect-type/.gitignore deleted file mode 100644 index 76ec7482..00000000 --- a/packages/expect-type/.gitignore +++ /dev/null @@ -1 +0,0 @@ -src/cjs/**/*.d.ts \ No newline at end of file diff --git a/packages/expect-type/CHANGELOG.md b/packages/expect-type/CHANGELOG.md deleted file mode 100644 index 3486514f..00000000 --- a/packages/expect-type/CHANGELOG.md +++ /dev/null @@ -1,79 +0,0 @@ -# 0.2.1 - -_Adapted some build scripts_ -[[Code](https://github.com/dubzzz/fast-check/tree/expect-type%2Fv0.2.1)][[Diff](https://github.com/dubzzz/fast-check/compare/expect-type%2Fv0.2.0...expect-type%2Fv0.2.1)] - -## Fixes - -- ([PR#5808](https://github.com/dubzzz/fast-check/pull/5808)) CI: Update tsconfig to ES2020 - -# 0.2.0 - -_Declare root of the package as ESM_ -[[Code](https://github.com/dubzzz/fast-check/tree/expect-type%2Fv0.2.0)][[Diff](https://github.com/dubzzz/fast-check/compare/expect-type%2Fv0.1.0...expect-type%2Fv0.2.0)] - -## Breaking changes - -- ([PR#4587](https://github.com/dubzzz/fast-check/pull/4587)) CI: Move build chain to ESM - ---- - -# 0.1.0 - -_Lighter import with less internals to load_ -[[Code](https://github.com/dubzzz/fast-check/tree/expect-type%2Fv0.1.0)][[Diff](https://github.com/dubzzz/fast-check/compare/expect-type%2Fv0.0.5...expect-type%2Fv0.1.0)] - -## Features - -- ([PR#4422](https://github.com/dubzzz/fast-check/pull/4422)) Prefer "import type" over raw "import" - -## Fixes - -- ([PR#4284](https://github.com/dubzzz/fast-check/pull/4284)) Test: Confirm basic typings work well - ---- - -# 0.0.5 - -_Fix typings for node native esm_ -[[Code](https://github.com/dubzzz/fast-check/tree/expect-type%2Fv0.0.5)][[Diff](https://github.com/dubzzz/fast-check/compare/expect-type%2Fv0.0.4...expect-type%2Fv0.0.5)] - -## Fixes - -- ([PR#4263](https://github.com/dubzzz/fast-check/pull/4263)) Bug: Fix typings for node native esm - -# 0.0.4 - -_Better support for types on ESM targets_ -[[Code](https://github.com/dubzzz/fast-check/tree/expect-type%2Fv0.0.4)][[Diff](https://github.com/dubzzz/fast-check/compare/expect-type%2Fv0.0.3...expect-type%2Fv0.0.4)] - -## Fixes - -- ([PR#4175](https://github.com/dubzzz/fast-check/pull/4175)) Bug: Better declare ESM's types -- ([PR#4033](https://github.com/dubzzz/fast-check/pull/4033)) Tooling: Update formatting - -# 0.0.3 - -_Attach provenance to the packages_ -[[Code](https://github.com/dubzzz/fast-check/tree/expect-type%2Fv0.0.3)][[Diff](https://github.com/dubzzz/fast-check/compare/expect-type%2Fv0.0.2...expect-type%2Fv0.0.3)] - -## Fixes - -- ([PR#3774](https://github.com/dubzzz/fast-check/pull/3774)) Security: Attach provenance to the packages - -# 0.0.2 - -_Fix broken links in README_ -[[Code](https://github.com/dubzzz/fast-check/tree/expect-type%2Fv0.0.2)][[Diff](https://github.com/dubzzz/fast-check/compare/expect-type%2Fv0.0.1...expect-type%2Fv0.0.2)] - -## Fixes - -- ([PR#3397](https://github.com/dubzzz/fast-check/pull/3397)) Doc: Fix links in README -- ([PR#3473](https://github.com/dubzzz/fast-check/pull/3473)) Funding: Re-order links in funding section - -# 0.0.1 - -_First stable release of `@fast-check/expect-type`_ -[[Code](https://github.com/dubzzz/fast-check/tree/expect-type%2Fv0.0.1)] - -Make sure your types are the ones you expect (similar to `tsd`) diff --git a/packages/expect-type/LICENSE b/packages/expect-type/LICENSE deleted file mode 100644 index 74391e0b..00000000 --- a/packages/expect-type/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 Nicolas DUBIEN - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/packages/expect-type/README.md b/packages/expect-type/README.md deleted file mode 100644 index 3c98370c..00000000 --- a/packages/expect-type/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# `@fast-check/expect-type` - -Make sure your types are the ones you expect (similar to `tsd`) - -npm version -monthly downloads -License - ---- - -## Easy to use - -This package performs compilation time checks only. Running the check functions at runtime is a no-op. - -```ts -import { expectType, expectTypeAssignable } from '@fast-check/expect-type'; -// your code or you own imports - -expectType()(f(1, 2), 'expect the output of f when passed 1 and 2 to be number'); -expectTypeAssignable()(f(1, 2), 'expect the output of f when passed 1 and 2 to be assignable to number'); -``` diff --git a/packages/expect-type/package.json b/packages/expect-type/package.json deleted file mode 100644 index d9ccc892..00000000 --- a/packages/expect-type/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@fast-check/expect-type", - "description": "Make sure your types are the ones you expect (similar to tsd)", - "version": "0.2.1", - "type": "module", - "main": "src/main.js", - "exports": { - "./package.json": "./package.json", - ".": { - "require": { - "types": "./src/cjs/main.d.ts", - "default": "./src/cjs/main.js" - }, - "import": { - "types": "./src/main.d.ts", - "default": "./src/main.js" - } - } - }, - "module": "src/main.js", - "types": "src/main.d.ts", - "files": [ - "src" - ], - "scripts": { - "build": "pnpm run build:publish-types", - "build-ci": "pnpm run build", - "build:publish-types": "cp src/*.d.ts src/cjs/", - "typecheck": "tsc --noEmit" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/dubzzz/fast-check.git", - "directory": "packages/expect-type" - }, - "author": "Nicolas DUBIEN ", - "license": "MIT", - "bugs": { - "url": "https://github.com/dubzzz/fast-check/issues" - }, - "homepage": "https://github.com/dubzzz/fast-check/tree/main/packages/expect-type#readme", - "devDependencies": { - "@fast-check/expect-type": "workspace:*", - "typescript": "~5.9.3" - }, - "keywords": [ - "type", - "checker", - "tsd", - "assert", - "typescript" - ], - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/dubzzz" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" - } - ] -} diff --git a/packages/expect-type/src/cjs/main.js b/packages/expect-type/src/cjs/main.js deleted file mode 100644 index 77793828..00000000 --- a/packages/expect-type/src/cjs/main.js +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable @typescript-eslint/no-empty-function */ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.expectType = function expectType() { - return function () {}; -}; -exports.expectTypeAssignable = function expectTypeAssignable() { - return function () {}; -}; diff --git a/packages/expect-type/src/cjs/package.json b/packages/expect-type/src/cjs/package.json deleted file mode 100644 index 5bbefffb..00000000 --- a/packages/expect-type/src/cjs/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "commonjs" -} diff --git a/packages/expect-type/src/internals.d.ts b/packages/expect-type/src/internals.d.ts deleted file mode 100644 index b6ce6133..00000000 --- a/packages/expect-type/src/internals.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export declare type Not = T extends true ? false : true; -export declare type And = T extends true ? (U extends true ? true : false) : false; -export declare type Or = T extends false ? (U extends false ? false : true) : true; -export declare type IsNever = [T] extends [never] ? true : false; -export declare type Extends = T extends U ? true : false; -export declare type ExtendsString = - Extends extends boolean ? (boolean extends Extends ? true : false) : false; // Extends is: false for unknown but boolean for any -export declare type IsUnknown = And< - And>, Extends>, - And, Not>> ->; -export declare type IsAny = And< - And>, Not>>, - And, Extends extends true ? true : false> ->; - -declare type DeeperIsSame = - IsAny extends false - ? T extends object - ? { [K in keyof (T | U)]: IsSame } extends { [K in keyof (T | U)]: true } - ? true - : false - : true - : false; - -export declare type IsSame = [T, U] extends [U, T] - ? Or< - // T and U are either both any or both unknown or both never - // (T is any & U is any) OR (T is unknown & U is unknown) - Or, IsAny>, And, IsUnknown>>, And, IsNever>>, - // Neither T nor U is any or unknown and if they are objects their values are deeply equal - And< - // T is not any & U is not any & T is no unknown & U is not unknown & T is no never & U is not never - And< - And>, Not>>, And>, Not>>>, - And>, Not>> - >, - // T and U are deeply equal - DeeperIsSame - > - > - : false; diff --git a/packages/expect-type/src/main.d.ts b/packages/expect-type/src/main.d.ts deleted file mode 100644 index c13faf0d..00000000 --- a/packages/expect-type/src/main.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { IsSame, Extends } from './internals.js'; -export declare function expectType(): ( - arg: TReal, - ...noArgs: IsSame extends true ? [string] : [{ expected: TExpectedType; got: TReal }] -) => void; -export declare function expectTypeAssignable(): ( - arg: TReal, - ...noArgs: Extends extends true ? [string] : [{ expected: TExpectedType; got: TReal }] -) => void; diff --git a/packages/expect-type/src/main.js b/packages/expect-type/src/main.js deleted file mode 100644 index 70cc468a..00000000 --- a/packages/expect-type/src/main.js +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -/* eslint-disable @typescript-eslint/no-empty-function */ -export function expectType() { - return function () {}; -} -export function expectTypeAssignable() { - return function () {}; -} diff --git a/packages/expect-type/test-types/main.ts b/packages/expect-type/test-types/main.ts deleted file mode 100644 index 335f2e76..00000000 --- a/packages/expect-type/test-types/main.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { expectType, expectTypeAssignable } from '@fast-check/expect-type'; - -expectType()(''.toLowerCase(), 'toLowerCase outputs a string'); -expectTypeAssignable()(''.toLowerCase(), 'toLowerCase outputs a type is assignable to string|number'); diff --git a/packages/expect-type/test/internals.spec.ts b/packages/expect-type/test/internals.spec.ts deleted file mode 100644 index 122f4cd8..00000000 --- a/packages/expect-type/test/internals.spec.ts +++ /dev/null @@ -1,95 +0,0 @@ -import type { Not, And, Or, IsNever, IsUnknown, IsAny, IsSame } from '../src/internals'; - -export const Test_Not_true: Not = false; -export const Test_Not_false: Not = true; - -export const Test_And_false_false: And = false; -export const Test_And_false_true: And = false; -export const Test_And_true_false: And = false; -export const Test_And_true_true: And = true; - -export const Test_Or_false_false: Or = false; -export const Test_Or_false_true: Or = true; -export const Test_Or_true_false: Or = true; -export const Test_Or_true_true: Or = true; - -export const Test_IsNever_null: IsNever = false; -export const Test_IsNever_undefined: IsNever = false; -export const Test_IsNever_number: IsNever = false; -export const Test_IsNever_any: IsNever = false; -export const Test_IsNever_unknown: IsNever = false; -export const Test_IsNever_never: IsNever = true; - -export const Test_IsUnknown_null: IsUnknown = false; -export const Test_IsUnknown_undefined: IsUnknown = false; -export const Test_IsUnknown_number: IsUnknown = false; -export const Test_IsUnknown_any: IsUnknown = false; -export const Test_IsUnknown_unknown: IsUnknown = true; -export const Test_IsUnknown_never: IsUnknown = false; - -export const Test_IsAny_null: IsAny = false; -export const Test_IsAny_undefined: IsAny = false; -export const Test_IsAny_number: IsAny = false; -export const Test_IsAny_any: IsAny = true; -export const Test_IsAny_unknown: IsAny = false; -export const Test_IsAny_never: IsAny = false; - -export const Test_IsSame_true_true: IsSame = true; -export const Test_IsSame_tuple_true_tuple_true: IsSame<[true], [true]> = true; -export const Test_IsSame_return_true_return_true: IsSame<() => true, () => true> = true; -export const Test_IsSame_take_true_take_true: IsSame<(v: true) => void, (v: true) => void> = true; -export const Test_IsSame_true_false: IsSame = false; -export const Test_IsSame_return_true_return_false: IsSame<() => true, () => false> = false; -export const Test_IsSame_take_true_take_false: IsSame<(v: true) => void, (v: false) => void> = false; -export const Test_IsSame_take_true_take_true_and_false: IsSame<(v: true) => void, (v: true, u: false) => void> = false; -// @ts-expect-error - Variadic arguments are somehow ignored at the moment -export const Test_IsSame_take_1_take_1_and_others: IsSame<(v: 1) => 0, (v: 1, ...u: unknown[]) => 0> = false; -export const Test_IsSame_true_boolean: IsSame = false; -export const Test_IsSame_never_boolean: IsSame = false; -export const Test_IsSame_never_any: IsSame = false; -export const Test_IsSame_never_unknown: IsSame = false; -export const Test_IsSame_never_never: IsSame = true; -export const Test_IsSame_tuple_never_tuple_never: IsSame<[never], [never]> = true; -export const Test_IsSame_any_boolean: IsSame = false; -export const Test_IsSame_any_any: IsSame = true; -export const Test_IsSame_any_any_Bis: IsSame, true> = true; -export const Test_IsSame_tuple_any_tuple_any: IsSame<[any], [any]> = true; -export const Test_IsSame_set_any_set_any: IsSame, Set> = true; -export const Test_IsSame_any_tuple_any: IsSame = false; -export const Test_IsSame_tuple_any_any: IsSame<[any], any> = false; -export const Test_IsSame_any_unknown: IsSame = false; -export const Test_IsSame_any_never: IsSame = false; -export const Test_IsSame_unknown_boolean: IsSame = false; -export const Test_IsSame_unknown_any: IsSame = false; -export const Test_IsSame_unknown_unknown: IsSame = true; -export const Test_IsSame_tuple_unknown_tuple_unknown: IsSame<[unknown], [unknown]> = true; -export const Test_IsSame_set_unknown_set_unknown: IsSame, Set> = true; -export const Test_IsSame_unknown_never: IsSame = false; -export const Test_IsSame_set_unknown_set_number: IsSame, Set> = false; -export const Test_IsSame_tuple_number_tuple_string: IsSame<[number], [string]> = false; -export const Test_IsSame_tuple_any_tuple_unknown: IsSame<[any], [unknown]> = false; -export const Test_IsSame_tuple_unknown_tuple_any: IsSame<[unknown], [any]> = false; -export const Test_IsSame_tuple_2_any_tuple_2_unknown: IsSame<[any, any], [unknown, unknown]> = false; -export const Test_IsSame_deep_tuple_any_deep_tuple_unknown: IsSame<[[any]], [[unknown]]> = false; -export const Test_IsSame_object_any_object_unknown: IsSame<{ a: any }, { a: unknown }> = false; -export const Test_IsSame_object_any_partial_object_unknown: IsSame<{ a: any }, { a?: unknown }> = false; -// @ts-expect-error - Set is assignable to Set and vice-versa and deep equality fails for -export const Test_IsSame_set_any_set_unknown: IsSame, Set> = false; - -type Tree = { value: T } | { left: Tree; right: Tree }; -export const Test_IsSame_tree_number_tree_number: IsSame, Tree> = true; -export const Test_IsSame_tree_tuple_number_tree_tuple_number: IsSame, Tree<[number]>> = true; -export const Test_IsSame_tree_never_tree_never: IsSame, Tree> = true; -export const Test_IsSame_tree_tuple_never_tree_tuple_never: IsSame, Tree<[never]>> = true; -export const Test_IsSame_tree_any_tree_any: IsSame, Tree> = true; -export const Test_IsSame_tree_tuple_any_tree_tuple_any: IsSame, Tree<[any]>> = true; -export const Test_IsSame_tree_unknown_tree_unknown: IsSame, Tree> = true; -export const Test_IsSame_tree_tuple_unknown_tree_tuple_unknown: IsSame, Tree<[unknown]>> = true; -export const Test_IsSame_tree_number_tree_string: IsSame, Tree> = false; -export const Test_IsSame_tree_number_tree_unknown: IsSame, Tree> = false; -// @ts-expect-error - Tree is assignable to Tree and vice-versa and deep equality fails for -export const Test_IsSame_tree_number_tree_any: IsSame, Tree> = false; -// @ts-expect-error - Tree is assignable to Tree and vice-versa and deep equality fails for -export const Test_IsSame_tree_unknown_tree_any: IsSame, Tree> = false; -// @ts-expect-error - Tree is assignable to Tree and vice-versa and deep equality fails for -export const Test_IsSame_tree_any_tree_unknown: IsSame, Tree> = false; diff --git a/packages/expect-type/test/main.spec.ts b/packages/expect-type/test/main.spec.ts deleted file mode 100644 index 5d9d89da..00000000 --- a/packages/expect-type/test/main.spec.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { expectType, expectTypeAssignable } from '../src/main'; - -function type() { - return null as any as T; -} - -// expectType - -expectType<5>()(type<5>(), '5 is 5'); -expectType()(type(), 'number is number'); -expectType()(type(), 'never is never'); -expectType()(type(), 'any is any'); -expectType()(type(), 'unknown is unknown'); -expectType<{ a: number }>()(type<{ a: number }>(), '{a:number} is {a:number}'); -expectType>()(type>(), 'Promise<5> is Promise<5>'); -expectType<[5]>()(type<[5]>(), '[5] is [5]'); -expectType<[any]>()(type<[any]>(), '[any] is [any]'); - -// @ts-expect-error - 5 is not number -expectType()(type<5>(), '5 is not number'); -// @ts-expect-error - number is not 5 -expectType<5>()(type(), 'number is not 5'); -// @ts-expect-error - number is not never -expectType()(type(), 'number is not never'); -// @ts-expect-error - any is not never -expectType()(type(), 'any is not never'); -// @ts-expect-error - unknown is not never -expectType()(type(), 'unknown is not never'); -// @ts-expect-error - number is not any -expectType()(type(), 'number is not any'); -// @ts-expect-error - never is not any -expectType()(type(), 'never is not any'); -// @ts-expect-error - unknown is not any -expectType()(type(), 'unknown is not any'); -// @ts-expect-error - number is not unknown -expectType()(type(), 'number is not unknown'); -// @ts-expect-error - never is not unknown -expectType()(type(), 'never is not unknown'); -// @ts-expect-error - any is not unknown -expectType()(type(), 'any is not unknown'); -// @ts-expect-error - {a?:number} is not {a:number} -expectType<{ a: number }>()(type<{ a?: number }>(), '{a?:number} is not {a:number}'); -// @ts-expect-error - {a:number} is not {a?:number} -expectType<{ a?: number }>()(type<{ a: number }>(), '{a:number} is not {a?:number}'); -// @ts-expect-error - {a:number} is not {} -expectType<{}>()(type<{ a: number }>(), '{a:number} is not {}'); -// @ts-expect-error - Promise is not Promise<5> -expectType>()(type>(), 'Promise is not Promise<5>'); -// @ts-expect-error - Promise<5> is not Promise -expectType>()(type>(), 'Promise<5> is not Promise'); -// @ts-expect-error - [15] is not [5] -expectType<[5]>()(type<[15]>(), '[15] is not [5]'); -//// @ts-expect-error - [unknown] is not [any] -//expectType<[any]>()(type<[unknown]>(), '[unknown] is not [any]'); -//// @ts-expect-error - [any] is not [unknown] -//expectType<[unknown]>()(type<[any]>(), '[any] is not [unknown]'); - -// expectTypeAssignable - -expectTypeAssignable()(type(), 'number is assignable to number'); -expectTypeAssignable()(type<5>(), '5 is assignable to number'); -expectTypeAssignable<3 | 5>()(type<5>(), '5 is assignable to 3|5'); -expectTypeAssignable()(type(), 'number is assignable to unknown'); -expectTypeAssignable()(type(), 'number is assignable to any'); -expectTypeAssignable<{ a?: number }>()(type<{ a: number }>(), '{a:number} is assignable to {a?:number}'); -expectTypeAssignable<{}>()(type<{ a: number }>(), '{a:number} is assignable to {}'); - -// @ts-expect-error - number is not assignable to 5 -expectTypeAssignable<5>()(type(), 'number is not assignable to 5'); -// @ts-expect-error - 3|5 is not assignable to 5 -expectTypeAssignable<5>()(type<3 | 5>(), '3|5 is not assignable to 5'); -// @ts-expect-error - {a?:number} is not assignable to {a:number} -expectTypeAssignable<{ a: number }>()(type<{ a?: number }>(), '{a?:number} is not assignable to {a:number}'); -// @ts-expect-error - unknown is not assignable to number -expectTypeAssignable()(type(), 'unknown is not assignable to number'); -// @ts-expect-error - unknown is not assignable to never -expectTypeAssignable()(type(), 'unknown is not assignable to never'); diff --git a/packages/expect-type/tsconfig.json b/packages/expect-type/tsconfig.json deleted file mode 100644 index 51bf44c3..00000000 --- a/packages/expect-type/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.common.json" -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f115a419..dfeae454 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -142,15 +142,6 @@ importers: specifier: ^4.0.5 version: 4.0.5(@types/debug@4.1.12)(@types/node@24.10.7)(happy-dom@20.3.4)(jiti@1.21.7)(lightningcss@1.30.1)(terser@5.43.1)(yaml@2.8.1) - packages/expect-type: - devDependencies: - '@fast-check/expect-type': - specifier: workspace:* - version: 'link:' - typescript: - specifier: ~5.9.3 - version: 5.9.3 - packages/fast-check: dependencies: pure-rand: diff --git a/vitest.config.mjs b/vitest.config.mjs index 66256af3..1a90e976 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -6,7 +6,6 @@ const allProjects = [ // All packages ...readdirSync(join(import.meta.dirname, 'packages'), { withFileTypes: true }) .filter((file) => file.isDirectory()) - .filter((dir) => dir.name !== 'expect-type') .map((dir) => join(dir.parentPath, dir.name)), // Other directories join(import.meta.dirname, 'examples'), -- 2.51.2