Skip to content

Commit cc2b0f2

Browse files
committed
Require ESM and Node.js 20
1 parent 98d24fa commit cc2b0f2

File tree

296 files changed

+717
-732
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+717
-732
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
node-version:
19+
- 24
1920
- 22
2021
- 20
21-
- 18
2222
steps:
2323
- uses: actions/checkout@v4
2424
- uses: actions/setup-node@v4
@@ -33,20 +33,13 @@ jobs:
3333
fail-fast: false
3434
matrix:
3535
typescript-version:
36-
- "latest"
37-
- "~5.8.0"
38-
- "~5.7.0"
39-
- "~5.6.0"
40-
- "~5.5.0"
41-
- "~5.4.0"
42-
- "~5.3.0"
43-
- "~5.2.0"
44-
- "~5.1.0"
36+
- 'latest'
37+
- '~5.8.0'
4538
steps:
4639
- uses: actions/checkout@v4
4740
- uses: actions/setup-node@v4
4841
with:
49-
node-version: 18
42+
node-version: 20
5043
- run: npm install
5144
- run: npm install typescript@${{ matrix.typescript-version }}
5245
- run: npx tsc

index.d.ts

Lines changed: 154 additions & 154 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
"email": "[email protected]",
1111
"url": "https://sindresorhus.com"
1212
},
13+
"type": "module",
14+
"exports": {
15+
"types": "./index.d.ts"
16+
},
1317
"types": "./index.d.ts",
1418
"sideEffects": false,
1519
"engines": {
16-
"node": ">=16"
20+
"node": ">=20"
1721
},
1822
"scripts": {
1923
"test:source-files-extension": "node script/test/source-files-extension.js",
@@ -41,8 +45,9 @@
4145
"generics"
4246
],
4347
"devDependencies": {
44-
"expect-type": "^1.1.0",
45-
"npm-run-all2": "^7.0.1",
48+
"@sindresorhus/tsconfig": "^7.0.0",
49+
"expect-type": "^1.2.1",
50+
"npm-run-all2": "^8.0.1",
4651
"tsd": "^0.32.0",
4752
"typescript": "~5.8.3",
4853
"xo": "^0.60.0"
@@ -53,7 +58,6 @@
5358
"@typescript-eslint/ban-ts-comment": "off",
5459
"@typescript-eslint/ban-types": "off",
5560
"@typescript-eslint/naming-convention": "off",
56-
"import/extensions": "off",
5761
"@typescript-eslint/no-redeclare": "off",
5862
"@typescript-eslint/no-confusing-void-expression": "off",
5963
"@typescript-eslint/no-unsafe-argument": "off",

readme.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ PR welcome for additional commonly needed types and docs improvements. Read the
8383
npm install type-fest
8484
```
8585

86-
*Requires TypeScript >=5.1 and [`{strict: true}`](https://www.typescriptlang.org/tsconfig#strict) in your tsconfig.*
86+
*Requires TypeScript >=5.8, [ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c), and [`{strict: true}`](https://www.typescriptlang.org/tsconfig#strict) in your tsconfig.*
87+
88+
> [!NOTE]
89+
> This readme shows the current development version. For docs about the latest version, see the [npm page](https://www.npmjs.com/package/type-fest).
8790
8891
## Usage
8992

script/test/source-files-extension.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/* eslint-disable unicorn/prefer-module */
2-
const fs = require('node:fs');
3-
const process = require('node:process');
1+
import fs from 'node:fs';
2+
import process from 'node:process';
43

54
const checkSourceFilesExtension = async () => {
65
try {

source/all-union-fields.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type {NonRecursiveType, ReadonlyKeysOfUnion, ValueOfUnion} from './internal';
2-
import type {KeysOfUnion} from './keys-of-union';
3-
import type {SharedUnionFields} from './shared-union-fields';
4-
import type {Simplify} from './simplify';
5-
import type {UnknownArray} from './unknown-array';
1+
import type {NonRecursiveType, ReadonlyKeysOfUnion, ValueOfUnion} from './internal/index.d.ts';
2+
import type {KeysOfUnion} from './keys-of-union.d.ts';
3+
import type {SharedUnionFields} from './shared-union-fields.d.ts';
4+
import type {Simplify} from './simplify.d.ts';
5+
import type {UnknownArray} from './unknown-array.d.ts';
66

77
/**
88
Create a type with all fields from a union of object types.

source/and.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {IsEqual} from './is-equal';
1+
import type {IsEqual} from './is-equal.d.ts';
22

33
/**
44
Returns a boolean for whether two given types are both true.

source/array-slice.d.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type {Sum} from './sum';
2-
import type {LessThanOrEqual} from './less-than-or-equal';
3-
import type {GreaterThanOrEqual} from './greater-than-or-equal';
4-
import type {GreaterThan} from './greater-than';
5-
import type {IsNegative} from './numeric';
6-
import type {Not, TupleMin} from './internal';
7-
import type {IsEqual} from './is-equal';
8-
import type {And} from './and';
9-
import type {ArraySplice} from './array-splice';
1+
import type {Sum} from './sum.d.ts';
2+
import type {LessThanOrEqual} from './less-than-or-equal.d.ts';
3+
import type {GreaterThanOrEqual} from './greater-than-or-equal.d.ts';
4+
import type {GreaterThan} from './greater-than.d.ts';
5+
import type {IsNegative} from './numeric.d.ts';
6+
import type {Not, TupleMin} from './internal/index.d.ts';
7+
import type {IsEqual} from './is-equal.d.ts';
8+
import type {And} from './and.d.ts';
9+
import type {ArraySplice} from './array-splice.d.ts';
1010

1111
/**
1212
Returns an array slice of a given range, just like `Array#slice()`.

source/array-splice.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type {BuildTuple, StaticPartOfArray, VariablePartOfArray} from './internal';
2-
import type {GreaterThanOrEqual} from './greater-than-or-equal';
3-
import type {Subtract} from './subtract';
4-
import type {UnknownArray} from './unknown-array';
1+
import type {BuildTuple, StaticPartOfArray, VariablePartOfArray} from './internal/index.d.ts';
2+
import type {GreaterThanOrEqual} from './greater-than-or-equal.d.ts';
3+
import type {Subtract} from './subtract.d.ts';
4+
import type {UnknownArray} from './unknown-array.d.ts';
55

66
/**
77
The implementation of `SplitArrayByIndex` for fixed length arrays.

source/array-tail.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type {ApplyDefaultOptions, IfArrayReadonly} from './internal';
2-
import type {UnknownArray} from './unknown-array';
1+
import type {ApplyDefaultOptions, IfArrayReadonly} from './internal/index.d.ts';
2+
import type {UnknownArray} from './unknown-array.d.ts';
33

44
/**
55
@see {@link ArrayTail}

0 commit comments

Comments
 (0)