diff --git a/packages/fast-check/README.md b/packages/fast-check/README.md index 299c8dddc44..f159d17ba15 100644 --- a/packages/fast-check/README.md +++ b/packages/fast-check/README.md @@ -118,7 +118,7 @@ Here are the minimal requirements to use fast-check properly without any polyfil | fast-check | node | ECMAScript version | _TypeScript (optional)_ | | ---------- | ------------------- | ------------------ | ----------------------- | -| **4.x** | ≥8(1) | ES2017 | ≥5.0 | +| **4.x** | ≥10.5.0 | ES2020 | ≥5.0 | | **3.x** | ≥8(1) | ES2017 | ≥4.1(2) | | **2.x** | ≥8(1) | ES2017 | ≥3.2(3) | | **1.x** | ≥0.12(1) | ES3 | ≥3.0(3) | diff --git a/packages/fast-check/package.json b/packages/fast-check/package.json index 73f42a69398..326d985cf24 100644 --- a/packages/fast-check/package.json +++ b/packages/fast-check/package.json @@ -36,7 +36,7 @@ "e2e": "vitest --config vitest.e2e.config.mjs", "update:documentation": "cross-env UPDATE_CODE_SNIPPETS=true vitest --config vitest.documentation.config.mjs", "test-bundle": "node test-bundle/run.cjs && node test-bundle/run.mjs && node test-bundle/run-advanced.cjs", - "test-legacy-bundle": "nvs add 8 && $(nvs which 8) test-bundle/run.cjs && $(nvs which 8) test-bundle/run-advanced.cjs", + "test-legacy-bundle": "nvs add 10.5 && $(nvs which 10.5) test-bundle/run.cjs && $(nvs which 10.5) test-bundle/run-advanced.cjs", "docs": "api-extractor run --local && rm docs/fast-check.api.json && typedoc --out docs src/fast-check-default.ts && node postbuild/main.mjs", "docs-ci": "cross-env EXPECT_GITHUB_SHA=true yarn docs", "docs:serve": "yarn dlx serve docs/" diff --git a/packages/fast-check/src/utils/globals.ts b/packages/fast-check/src/utils/globals.ts index 08e3660e2b2..36b66ee5559 100644 --- a/packages/fast-check/src/utils/globals.ts +++ b/packages/fast-check/src/utils/globals.ts @@ -2,67 +2,45 @@ import { safeApply } from './apply'; // Globals -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SArray: typeof Array = typeof Array !== 'undefined' ? Array : undefined!; +const SArray: typeof Array = Array; export { SArray as Array }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SBigInt: typeof BigInt = typeof BigInt !== 'undefined' ? BigInt : undefined!; +const SBigInt: typeof BigInt = BigInt; export { SBigInt as BigInt }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SBigInt64Array: typeof BigInt64Array = typeof BigInt64Array !== 'undefined' ? BigInt64Array : undefined!; +const SBigInt64Array: typeof BigInt64Array = BigInt64Array; export { SBigInt64Array as BigInt64Array }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SBigUint64Array: typeof BigUint64Array = typeof BigUint64Array !== 'undefined' ? BigUint64Array : undefined!; +const SBigUint64Array: typeof BigUint64Array = BigUint64Array; export { SBigUint64Array as BigUint64Array }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SBoolean: typeof Boolean = typeof Boolean !== 'undefined' ? Boolean : undefined!; +const SBoolean: typeof Boolean = Boolean; export { SBoolean as Boolean }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SDate: typeof Date = typeof Date !== 'undefined' ? Date : undefined!; +const SDate: typeof Date = Date; export { SDate as Date }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SError: typeof Error = typeof Error !== 'undefined' ? Error : undefined!; +const SError: typeof Error = Error; export { SError as Error }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SFloat32Array: typeof Float32Array = typeof Float32Array !== 'undefined' ? Float32Array : undefined!; +const SFloat32Array: typeof Float32Array = Float32Array; export { SFloat32Array as Float32Array }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SFloat64Array: typeof Float64Array = typeof Float64Array !== 'undefined' ? Float64Array : undefined!; +const SFloat64Array: typeof Float64Array = Float64Array; export { SFloat64Array as Float64Array }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SInt8Array: typeof Int8Array = typeof Int8Array !== 'undefined' ? Int8Array : undefined!; +const SInt8Array: typeof Int8Array = Int8Array; export { SInt8Array as Int8Array }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SInt16Array: typeof Int16Array = typeof Int16Array !== 'undefined' ? Int16Array : undefined!; +const SInt16Array: typeof Int16Array = Int16Array; export { SInt16Array as Int16Array }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SInt32Array: typeof Int32Array = typeof Int32Array !== 'undefined' ? Int32Array : undefined!; +const SInt32Array: typeof Int32Array = Int32Array; export { SInt32Array as Int32Array }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SNumber: typeof Number = typeof Number !== 'undefined' ? Number : undefined!; +const SNumber: typeof Number = Number; export { SNumber as Number }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SString: typeof String = typeof String !== 'undefined' ? String : undefined!; +const SString: typeof String = String; export { SString as String }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SSet: typeof Set = typeof Set !== 'undefined' ? Set : undefined!; +const SSet: typeof Set = Set; export { SSet as Set }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SUint8Array: typeof Uint8Array = typeof Uint8Array !== 'undefined' ? Uint8Array : undefined!; +const SUint8Array: typeof Uint8Array = Uint8Array; export { SUint8Array as Uint8Array }; -const SUint8ClampedArray: typeof Uint8ClampedArray = - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - typeof Uint8ClampedArray !== 'undefined' ? Uint8ClampedArray : undefined!; +const SUint8ClampedArray: typeof Uint8ClampedArray = Uint8ClampedArray; export { SUint8ClampedArray as Uint8ClampedArray }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SUint16Array: typeof Uint16Array = typeof Uint16Array !== 'undefined' ? Uint16Array : undefined!; +const SUint16Array: typeof Uint16Array = Uint16Array; export { SUint16Array as Uint16Array }; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const SUint32Array: typeof Uint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : undefined!; +const SUint32Array: typeof Uint32Array = Uint32Array; export { SUint32Array as Uint32Array }; -const SencodeURIComponent: typeof encodeURIComponent = - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - typeof encodeURIComponent !== 'undefined' ? encodeURIComponent : undefined!; +const SencodeURIComponent: typeof encodeURIComponent = encodeURIComponent; export { SencodeURIComponent as encodeURIComponent }; const SMap = Map; export { SMap as Map }; diff --git a/website/docs/migration/from-3.x-to-4.x.md b/website/docs/migration/from-3.x-to-4.x.md index 6984e65ab34..8a048e20cb8 100644 --- a/website/docs/migration/from-3.x-to-4.x.md +++ b/website/docs/migration/from-3.x-to-4.x.md @@ -9,11 +9,13 @@ Simple migration guide to fast-check v4 starting from fast-check v3 ## Changes in minimal requirements -| Name | New requirement | Previous requirement | -| ----------------------- | --------------- | -------------------- | -| TypeScript _(optional)_ | ≥5.0 | ≥4.1 | +| Name | New requirement | Previous requirement | +| ------------------------ | --------------- | -------------------- | +| Node | ≥10.5.0 | ≥8 | +| ECMAScript specification | ES2020 | ES2017 | +| TypeScript _(optional)_ | ≥5.0 | ≥4.1 | -Related pull requests: [#5577](https://github.com/dubzzz/fast-check/pull/5577), [#5605](https://github.com/dubzzz/fast-check/pull/5605) +Related pull requests: [#5577](https://github.com/dubzzz/fast-check/pull/5577), [#5605](https://github.com/dubzzz/fast-check/pull/5605), [#5617](https://github.com/dubzzz/fast-check/pull/5617) ## Update to latest v3.x