| Offset 1, 5 lines modified | Offset 1, 5 lines modified | ||
| 1 | Zip·file·size:·445 | 1 | Zip·file·size:·4457075·bytes,·number·of·entries:·3 |
| 2 | -rw-r--r--··4.5·unx·······30·bx·stor·26-Apr-14·11:07·metadata.json | 2 | -rw-r--r--··4.5·unx·······30·bx·stor·26-Apr-14·11:07·metadata.json |
| 3 | -rw-r--r--··4.5·unx··428 | 3 | -rw-r--r--··4.5·unx··4284055·bx·stor·26-Apr-14·11:07·pkg-cucumber-js-12.8.1-hfa286de_0.tar.zst |
| 4 | -rw-r--r--··4.5·unx···172 | 4 | -rw-r--r--··4.5·unx···172428·bx·stor·26-Apr-14·11:07·info-cucumber-js-12.8.1-hfa286de_0.tar.zst |
| 5 | 3·files,·4456 | 5 | 3·files,·4456513·bytes·uncompressed,·4456513·bytes·compressed:··0.0% |
| Offset 19, 125 lines modified | Offset 19, 125 lines modified | ||
| 19 | 00005D·LOCAL·HEADER·#2·······04034B50 | 19 | 00005D·LOCAL·HEADER·#2·······04034B50 |
| 20 | 000061·Extract·Zip·Spec······2D·'4.5' | 20 | 000061·Extract·Zip·Spec······2D·'4.5' |
| 21 | 000062·Extract·OS············00·'MS-DOS' | 21 | 000062·Extract·OS············00·'MS-DOS' |
| 22 | 000063·General·Purpose·Flag··0000 | 22 | 000063·General·Purpose·Flag··0000 |
| 23 | 000065·Compression·Method····0000·'Stored' | 23 | 000065·Compression·Method····0000·'Stored' |
| 24 | 000067·Last·Mod·Time·········5C8E58F2·'Tue·Apr·14·11:07:36·2026' | 24 | 000067·Last·Mod·Time·········5C8E58F2·'Tue·Apr·14·11:07:36·2026' |
| 25 | 00006B·CRC··················· | 25 | 00006B·CRC···················C13F7DD6 |
| 26 | 00006F·Compressed·Length·····FFFFFFFF | 26 | 00006F·Compressed·Length·····FFFFFFFF |
| 27 | 000073·Uncompressed·Length···FFFFFFFF | 27 | 000073·Uncompressed·Length···FFFFFFFF |
| 28 | 000077·Filename·Length·······0029 | 28 | 000077·Filename·Length·······0029 |
| 29 | 000079·Extra·Length··········0014 | 29 | 000079·Extra·Length··········0014 |
| 30 | 00007B·Filename··············'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | 30 | 00007B·Filename··············'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 31 | ·····························XX' | 31 | ·····························XX' |
| 32 | 0000A4·Extra·ID·#0001········0001·'ZIP64' | 32 | 0000A4·Extra·ID·#0001········0001·'ZIP64' |
| 33 | 0000A6···Length··············0010 | 33 | 0000A6···Length··············0010 |
| 34 | 0000A8···Uncompressed·Size···0000000000415 | 34 | 0000A8···Uncompressed·Size···0000000000415E97 |
| 35 | 0000B0···Compressed·Size·····0000000000415 | 35 | 0000B0···Compressed·Size·····0000000000415E97 |
| 36 | 0000B8·PAYLOAD | 36 | 0000B8·PAYLOAD |
| 37 | 415 | 37 | 415F4F·LOCAL·HEADER·#3·······04034B50 |
| 38 | 415 | 38 | 415F53·Extract·Zip·Spec······2D·'4.5' |
| 39 | 415 | 39 | 415F54·Extract·OS············00·'MS-DOS' |
| 40 | 415 | 40 | 415F55·General·Purpose·Flag··0000 |
| 41 | 415 | 41 | 415F57·Compression·Method····0000·'Stored' |
| 42 | 415 | 42 | 415F59·Last·Mod·Time·········5C8E58F2·'Tue·Apr·14·11:07:36·2026' |
| 43 | 415 | 43 | 415F5D·CRC···················C58260E0 |
| 44 | 415 | 44 | 415F61·Compressed·Length·····FFFFFFFF |
| 45 | 415 | 45 | 415F65·Uncompressed·Length···FFFFFFFF |
| 46 | 415 | 46 | 415F69·Filename·Length·······002A |
| 47 | 415 | 47 | 415F6B·Extra·Length··········0014 |
| 48 | 415 | 48 | 415F6D·Filename··············'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 49 | ·····························XXX' | 49 | ·····························XXX' |
| 50 | 415 | 50 | 415F97·Extra·ID·#0001········0001·'ZIP64' |
| 51 | 415 | 51 | 415F99···Length··············0010 |
| 52 | 415 | 52 | 415F9B···Uncompressed·Size···000000000002A18C |
| 53 | 415 | 53 | 415FA3···Compressed·Size·····000000000002A18C |
| 54 | 415 | 54 | 415FAB·PAYLOAD |
| 55 | 4 | 55 | 440137·CENTRAL·HEADER·#1·····02014B50 |
| 56 | 4 | 56 | 44013B·Created·Zip·Spec······2D·'4.5' |
| 57 | 4 | 57 | 44013C·Created·OS············03·'Unix' |
| 58 | 4 | 58 | 44013D·Extract·Zip·Spec······2D·'4.5' |
| 59 | 4 | 59 | 44013E·Extract·OS············00·'MS-DOS' |
| 60 | 4 | 60 | 44013F·General·Purpose·Flag··0000 |
| 61 | 4 | 61 | 440141·Compression·Method····0000·'Stored' |
| 62 | 4 | 62 | 440143·Last·Mod·Time·········5C8E58F2·'Tue·Apr·14·11:07:36·2026' |
| 63 | 4 | 63 | 440147·CRC···················2E6500CB |
| 64 | 4 | 64 | 44014B·Compressed·Length·····FFFFFFFF |
| 65 | 4 | 65 | 44014F·Uncompressed·Length···FFFFFFFF |
| 66 | 4 | 66 | 440153·Filename·Length·······000D |
| 67 | 4 | 67 | 440155·Extra·Length··········0014 |
| 68 | 4 | 68 | 440157·Comment·Length········0000 |
| 69 | 4 | 69 | 440159·Disk·Start············0000 |
| 70 | 4 | 70 | 44015B·Int·File·Attributes···0000 |
| 71 | ·······[Bit·0]···············0·'Binary·Data' | 71 | ·······[Bit·0]···············0·'Binary·Data' |
| 72 | 4 | 72 | 44015D·Ext·File·Attributes···81A40000 |
| 73 | 4 | 73 | 440161·Local·Header·Offset···00000000 |
| 74 | 4 | 74 | 440165·Filename··············'XXXXXXXXXXXXX' |
| 75 | 4 | 75 | 440172·Extra·ID·#0001········0001·'ZIP64' |
| 76 | 4 | 76 | 440174···Length··············0010 |
| 77 | 4 | 77 | 440176···Uncompressed·Size···000000000000001E |
| 78 | 4 | 78 | 44017E···Compressed·Size·····000000000000001E |
| 79 | 4 | 79 | 440186·CENTRAL·HEADER·#2·····02014B50 |
| 80 | 4 | 80 | 44018A·Created·Zip·Spec······2D·'4.5' |
| 81 | 4 | 81 | 44018B·Created·OS············03·'Unix' |
| 82 | 4 | 82 | 44018C·Extract·Zip·Spec······2D·'4.5' |
| 83 | 4 | 83 | 44018D·Extract·OS············00·'MS-DOS' |
| 84 | 4 | 84 | 44018E·General·Purpose·Flag··0000 |
| 85 | 4 | 85 | 440190·Compression·Method····0000·'Stored' |
| 86 | 4 | 86 | 440192·Last·Mod·Time·········5C8E58F2·'Tue·Apr·14·11:07:36·2026' |
| 87 | 4 | 87 | 440196·CRC···················C13F7DD6 |
| 88 | 4 | 88 | 44019A·Compressed·Length·····FFFFFFFF |
| 89 | 4 | 89 | 44019E·Uncompressed·Length···FFFFFFFF |
| 90 | 4 | 90 | 4401A2·Filename·Length·······0029 |
| 91 | 4 | 91 | 4401A4·Extra·Length··········0014 |
| 92 | 4 | 92 | 4401A6·Comment·Length········0000 |
| 93 | 4 | 93 | 4401A8·Disk·Start············0000 |
| 94 | 4 | 94 | 4401AA·Int·File·Attributes···0000 |
| 95 | ·······[Bit·0]···············0·'Binary·Data' | 95 | ·······[Bit·0]···············0·'Binary·Data' |
| 96 | 4 | 96 | 4401AC·Ext·File·Attributes···81A40000 |
| 97 | 440 | 97 | 4401B0·Local·Header·Offset···0000005D |
| 98 | 440 | 98 | 4401B4·Filename··············'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 99 | ·····························XX' | 99 | ·····························XX' |
| 100 | 440 | 100 | 4401DD·Extra·ID·#0001········0001·'ZIP64' |
| 101 | 440 | 101 | 4401DF···Length··············0010 |
| 102 | 440 | 102 | 4401E1···Uncompressed·Size···0000000000415E97 |
| 103 | 440 | 103 | 4401E9···Compressed·Size·····0000000000415E97 |
| 104 | 440 | 104 | 4401F1·CENTRAL·HEADER·#3·····02014B50 |
| 105 | 440 | 105 | 4401F5·Created·Zip·Spec······2D·'4.5' |
| 106 | 440 | 106 | 4401F6·Created·OS············03·'Unix' |
| 107 | 440 | 107 | 4401F7·Extract·Zip·Spec······2D·'4.5' |
| 108 | 440 | 108 | 4401F8·Extract·OS············00·'MS-DOS' |
| 109 | 440 | 109 | 4401F9·General·Purpose·Flag··0000 |
| 110 | 440 | 110 | 4401FB·Compression·Method····0000·'Stored' |
| 111 | 440 | 111 | 4401FD·Last·Mod·Time·········5C8E58F2·'Tue·Apr·14·11:07:36·2026' |
| 112 | 440 | 112 | 440201·CRC···················C58260E0 |
| Max diff block lines reached; 1271/8866 bytes (14.34%) of diff not shown. | |||
| Offset 2410, 433 lines modified | Offset 2410, 439 lines modified | ||
| 2410 | -rw-r--r--···0········0········0·····1443·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/compiler.js | 2410 | -rw-r--r--···0········0········0·····1443·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/compiler.js |
| 2411 | -rw-r--r--···0········0········0······661·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/index.d.ts | 2411 | -rw-r--r--···0········0········0······661·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/index.d.ts |
| 2412 | -rw-r--r--···0········0········0·····3439·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/index.js | 2412 | -rw-r--r--···0········0········0·····3439·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/index.js |
| 2413 | -rw-r--r--···0········0········0······700·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/package.json | 2413 | -rw-r--r--···0········0········0······700·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/package.json |
| 2414 | -rw-r--r--···0········0········0·····1833·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/index.d.ts | 2414 | -rw-r--r--···0········0········0·····1833·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/index.d.ts |
| 2415 | -rw-r--r--···0········0········0······626·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/index.js | 2415 | -rw-r--r--···0········0········0······626·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/index.js |
| 2416 | -rw-r--r--···0········0········0·····1117·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/license | 2416 | -rw-r--r--···0········0········0·····1117·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/license |
| 2417 | -rw-r--r--···0········0········0····12 | 2417 | -rw-r--r--···0········0········0····12928·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/index.d.ts |
| 2418 | -rw-r--r--···0········0········0·····7048·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-cc0 | 2418 | -rw-r--r--···0········0········0·····7048·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-cc0 |
| 2419 | -rw-r--r--···0········0········0·····1117·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-mit | 2419 | -rw-r--r--···0········0········0·····1117·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-mit |
| 2420 | -rw-r--r--···0········0········0·····1 | 2420 | -rw-r--r--···0········0········0·····1654·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/package.json |
| 2421 | -rw-r--r--···0········0········0····62 | 2421 | -rw-r--r--···0········0········0····62264·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/readme.md |
| 2422 | -rw-r--r--···0········0········0·····1000·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/absolute.d.ts | ||
| 2422 | -rw-r--r--···0········0········0·····3343·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-extend.d.ts | 2423 | -rw-r--r--···0········0········0·····3343·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-extend.d.ts |
| 2423 | -rw-r--r--···0········0········0·····2 | 2424 | -rw-r--r--···0········0········0·····2462·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-union-fields.d.ts |
| 2424 | -rw-r--r--···0········0········0·····2050·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and-all.d.ts | 2425 | -rw-r--r--···0········0········0·····2050·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and-all.d.ts |
| 2425 | -rw-r--r--···0········0········0·····150 | 2426 | -rw-r--r--···0········0········0·····1509·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and.d.ts |
| 2426 | -rw-r--r--···0········0········0·····1219·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-element.d.ts | 2427 | -rw-r--r--···0········0········0·····1219·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-element.d.ts |
| 2427 | -rw-r--r--···0········0········0······737·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-indices.d.ts | 2428 | -rw-r--r--···0········0········0······737·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-indices.d.ts |
| 2428 | -rw-r--r--···0········0········0······882·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-length.d.ts | 2429 | -rw-r--r--···0········0········0······882·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-length.d.ts |
| 2429 | -rw-r--r--···0········0········0·····3170·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-reverse.d.ts | 2430 | -rw-r--r--···0········0········0·····3170·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-reverse.d.ts |
| 2430 | -rw-r--r--···0········0········0·····4320·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-slice.d.ts | 2431 | -rw-r--r--···0········0········0·····4320·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-slice.d.ts |
| 2431 | -rw-r--r--···0········0········0·····31 | 2432 | -rw-r--r--···0········0········0·····3171·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-splice.d.ts |
| 2432 | -rw-r--r--···0········0········0·····1873·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-tail.d.ts | 2433 | -rw-r--r--···0········0········0·····1873·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-tail.d.ts |
| 2433 | -rw-r--r--···0········0········0······660·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-values.d.ts | 2434 | -rw-r--r--···0········0········0······660·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-values.d.ts |
| 2434 | -rw-r--r--···0········0········0······668·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/arrayable.d.ts | 2435 | -rw-r--r--···0········0········0······668·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/arrayable.d.ts |
| 2435 | -rw-r--r--···0········0········0······762·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/async-return-type.d.ts | 2436 | -rw-r--r--···0········0········0······762·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/async-return-type.d.ts |
| 2436 | -rw-r--r--···0········0········0······859·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/asyncify.d.ts | 2437 | -rw-r--r--···0········0········0······859·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/asyncify.d.ts |
| 2437 | -rw-r--r--···0········0········0·····1293·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/basic.d.ts | 2438 | -rw-r--r--···0········0········0·····1293·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/basic.d.ts |
| 2438 | -rw-r--r--···0········0········0····· | 2439 | -rw-r--r--···0········0········0·····3403·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-case.d.ts |
| 2439 | -rw-r--r--···0········0········0·····2 | 2440 | -rw-r--r--···0········0········0·····2942·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-cased-properties-deep.d.ts |
| 2440 | -rw-r--r--···0········0········0·····1 | 2441 | -rw-r--r--···0········0········0·····1211·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-cased-properties.d.ts |
| 2441 | -rw-r--r--···0········0········0·····1655·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/characters.d.ts | 2442 | -rw-r--r--···0········0········0·····1655·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/characters.d.ts |
| 2442 | -rw-r--r--···0········0········0·····1124·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-except.d.ts | 2443 | -rw-r--r--···0········0········0·····1124·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-except.d.ts |
| 2443 | -rw-r--r--···0········0········0·····1810·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-keys.d.ts | 2444 | -rw-r--r--···0········0········0·····1810·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-keys.d.ts |
| 2444 | -rw-r--r--···0········0········0·····3195·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-pick-deep.d.ts | 2445 | -rw-r--r--···0········0········0·····3195·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-pick-deep.d.ts |
| 2445 | -rw-r--r--···0········0········0·····1167·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-pick.d.ts | 2446 | -rw-r--r--···0········0········0·····1167·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-pick.d.ts |
| 2446 | -rw-r--r--···0········0········0·····1294·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-simplify-deep.d.ts | 2447 | -rw-r--r--···0········0········0·····1294·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-simplify-deep.d.ts |
| 2447 | -rw-r--r--···0········0········0·····1199·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-simplify.d.ts | 2448 | -rw-r--r--···0········0········0·····1199·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-simplify.d.ts |
| 2448 | -rw-r--r--···0········0········0·····2 | 2449 | -rw-r--r--···0········0········0·····2236·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/delimiter-case.d.ts |
| 2449 | -rw-r--r--···0········0········0·····3 | 2450 | -rw-r--r--···0········0········0·····3499·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/delimiter-cased-properties-deep.d.ts |
| 2450 | -rw-r--r--···0········0········0·····1 | 2451 | -rw-r--r--···0········0········0·····1325·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/delimiter-cased-properties.d.ts |
| 2451 | -rw-r--r--···0········0········0·····2407·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/distributed-omit.d.ts | 2452 | -rw-r--r--···0········0········0·····2407·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/distributed-omit.d.ts |
| 2452 | -rw-r--r--···0········0········0·····2248·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/distributed-pick.d.ts | 2453 | -rw-r--r--···0········0········0·····2248·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/distributed-pick.d.ts |
| 2453 | -rw-r--r--···0········0········0·····158 | 2454 | -rw-r--r--···0········0········0·····1587·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/empty-object.d.ts |
| 2454 | -rw-r--r--···0········0········0·····2 | 2455 | -rw-r--r--···0········0········0·····2495·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/entries.d.ts |
| 2455 | -rw-r--r--···0········0········0·····2 | 2456 | -rw-r--r--···0········0········0·····2769·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/entry.d.ts |
| 2456 | -rw-r--r--···0········0········0·····3473·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exact.d.ts | 2457 | -rw-r--r--···0········0········0·····3473·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exact.d.ts |
| 2457 | -rw-r--r--···0········0········0·····3393·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/except.d.ts | 2458 | -rw-r--r--···0········0········0·····3393·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/except.d.ts |
| 2458 | -rw-r--r--···0········0········0·····1808·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-exactly.d.ts | 2459 | -rw-r--r--···0········0········0·····1808·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-exactly.d.ts |
| 2459 | -rw-r--r--···0········0········0·····1168·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-rest-element.d.ts | 2460 | -rw-r--r--···0········0········0·····1168·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-rest-element.d.ts |
| 2460 | -rw-r--r--···0········0········0·····1781·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-strict.d.ts | 2461 | -rw-r--r--···0········0········0·····1781·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-strict.d.ts |
| 2461 | -rw-r--r--···0········0········0·····3604·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclusify-union.d.ts | 2462 | -rw-r--r--···0········0········0·····3604·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclusify-union.d.ts |
| 2462 | -rw-r--r--···0········0········0·····1273·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/extends-strict.d.ts | 2463 | -rw-r--r--···0········0········0·····1273·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/extends-strict.d.ts |
| 2463 | -rw-r--r--···0········0········0······785·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/extract-rest-element.d.ts | 2464 | -rw-r--r--···0········0········0······785·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/extract-rest-element.d.ts |
| 2464 | -rw-r--r--···0········0········0·····1772·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/extract-strict.d.ts | 2465 | -rw-r--r--···0········0········0·····1772·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/extract-strict.d.ts |
| 2465 | -rw-r--r--···0········0········0·····2073·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/find-global-type.d.ts | 2466 | -rw-r--r--···0········0········0·····2073·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/find-global-type.d.ts |
| 2466 | -rw-r--r--···0········0········0·····2998·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/fixed-length-array.d.ts | 2467 | -rw-r--r--···0········0········0·····2998·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/fixed-length-array.d.ts |
| 2467 | -rw-r--r--···0········0········0·····75 | 2468 | -rw-r--r--···0········0········0·····7567·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/get.d.ts |
| 2468 | -rw-r--r--···0········0········0······732·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/global-this.d.ts | 2469 | -rw-r--r--···0········0········0······732·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/global-this.d.ts |
| 2469 | -rw-r--r--···0········0········0·······57·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/globals/index.d.ts | 2470 | -rw-r--r--···0········0········0·······57·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/globals/index.d.ts |
| 2470 | -rw-r--r--···0········0········0·····2494·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/globals/observable-like.d.ts | 2471 | -rw-r--r--···0········0········0·····2494·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/globals/observable-like.d.ts |
| 2471 | -rw-r--r--···0········0········0·····1426·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/greater-than-or-equal.d.ts | 2472 | -rw-r--r--···0········0········0·····1426·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/greater-than-or-equal.d.ts |
| 2472 | -rw-r--r--···0········0········0·····24 | 2473 | -rw-r--r--···0········0········0·····2476·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/greater-than.d.ts |
| 2473 | -rw-r--r--···0········0········0······6 | 2474 | -rw-r--r--···0········0········0······646·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/has-optional-keys.d.ts |
| 2474 | -rw-r--r--···0········0········0······6 | 2475 | -rw-r--r--···0········0········0······646·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/has-readonly-keys.d.ts |
| 2475 | -rw-r--r--···0········0········0·····1 | 2476 | -rw-r--r--···0········0········0·····1176·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/has-required-keys.d.ts |
| 2476 | -rw-r--r--···0········0········0······6 | 2477 | -rw-r--r--···0········0········0······646·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/has-writable-keys.d.ts |
| 2477 | -rw-r--r--···0········0········0······584·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-any.d.ts | 2478 | -rw-r--r--···0········0········0······584·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-any.d.ts |
| 2478 | -rw-r--r--···0········0········0······678·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-empty-object.d.ts | 2479 | -rw-r--r--···0········0········0······678·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-empty-object.d.ts |
| 2479 | -rw-r--r--···0········0········0······614·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-never.d.ts | 2480 | -rw-r--r--···0········0········0······614·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-never.d.ts |
| 2480 | -rw-r--r--···0········0········0······599·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-null.d.ts | 2481 | -rw-r--r--···0········0········0······599·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-null.d.ts |
| 2481 | -rw-r--r--···0········0········0······644·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-unknown.d.ts | 2482 | -rw-r--r--···0········0········0······644·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if-unknown.d.ts |
| 2482 | -rw-r--r--···0········0········0·····2802·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if.d.ts | 2483 | -rw-r--r--···0········0········0·····2802·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/if.d.ts |
| 2483 | -rw-r--r--···0········0········0······578·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/includes.d.ts | 2484 | -rw-r--r--···0········0········0······578·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/includes.d.ts |
| 2484 | -rw-r--r--···0········0········0·····14 | 2485 | -rw-r--r--···0········0········0·····1422·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/int-closed-range.d.ts |
| 2485 | -rw-r--r--···0········0········0·····25 | 2486 | -rw-r--r--···0········0········0·····2552·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/int-range.d.ts |
| 2486 | -rw-r--r--···0········0········0·····491 | 2487 | -rw-r--r--···0········0········0·····4918·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/array.d.ts |
| 2487 | -rw-r--r--···0········0········0······741·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/characters.d.ts | 2488 | -rw-r--r--···0········0········0······741·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/characters.d.ts |
| 2488 | -rw-r--r--···0········0········0·····1120·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/enforce-optional.d.ts | 2489 | -rw-r--r--···0········0········0·····1120·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/enforce-optional.d.ts |
| 2489 | -rw-r--r--···0········0········0······345·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/index.d.ts | 2490 | -rw-r--r--···0········0········0······345·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/index.d.ts |
| 2490 | -rw-r--r--···0········0········0·····28 | 2491 | -rw-r--r--···0········0········0·····2814·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/keys.d.ts |
| 2491 | -rw-r--r--···0········0········0·····3 | 2492 | -rw-r--r--···0········0········0·····3034·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/numeric.d.ts |
| 2492 | -rw-r--r--···0········0········0·····9243·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/object.d.ts | 2493 | -rw-r--r--···0········0········0·····9243·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/object.d.ts |
| 2493 | -rw-r--r--···0········0········0·····4774·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/string.d.ts | 2494 | -rw-r--r--···0········0········0·····4774·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/string.d.ts |
| 2494 | -rw-r--r--···0········0········0·····2048·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/tuple.d.ts | 2495 | -rw-r--r--···0········0········0·····2048·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/tuple.d.ts |
| 2495 | -rw-r--r--···0········0········0·····4681·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/type.d.ts | 2496 | -rw-r--r--···0········0········0·····4681·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/internal/type.d.ts |
| 2496 | -rw-r--r--···0········0········0·····2409·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/invariant-of.d.ts | 2497 | -rw-r--r--···0········0········0·····2409·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/invariant-of.d.ts |
| 2497 | -rw-r--r--···0········0········0······693·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-any.d.ts | 2498 | -rw-r--r--···0········0········0······693·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-any.d.ts |
| 2498 | -rw-r--r--···0········0········0·····1223·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-equal.d.ts | 2499 | -rw-r--r--···0········0········0·····1223·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-equal.d.ts |
| 2499 | -rw-r--r--···0········0········0······777·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-float.d.ts | 2500 | -rw-r--r--···0········0········0······777·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-float.d.ts |
| 2500 | -rw-r--r--···0········0········0·····1 | 2501 | -rw-r--r--···0········0········0·····1101·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-integer.d.ts |
| 2501 | -rw-r--r--···0········0········0·····84 | 2502 | -rw-r--r--···0········0········0·····8430·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-literal.d.ts |
| 2502 | -rw-r--r--···0········0········0·····1026·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-lowercase.d.ts | 2503 | -rw-r--r--···0········0········0·····1026·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-lowercase.d.ts |
| 2503 | -rw-r--r--···0········0········0·····1217·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-never.d.ts | 2504 | -rw-r--r--···0········0········0·····1217·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-never.d.ts |
| 2504 | -rw-r--r--···0········0········0······431·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-null.d.ts | 2505 | -rw-r--r--···0········0········0······431·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-null.d.ts |
| 2505 | -rw-r--r--···0········0········0······647·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-nullable.d.ts | 2506 | -rw-r--r--···0········0········0······647·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-nullable.d.ts |
| 2506 | -rw-r--r--···0········0········0·····1006·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-optional-key-of.d.ts | 2507 | -rw-r--r--···0········0········0·····1006·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-optional-key-of.d.ts |
| 2507 | -rw-r--r--···0········0········0······545·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-optional.d.ts | 2508 | -rw-r--r--···0········0········0······545·2026-04-14·11:07:36.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/is-optional.d.ts |
| Max diff block lines reached; 82254/105502 bytes (77.96%) of diff not shown. | |||
| Offset 48, 14 lines modified | Offset 48, 15 lines modified | ||
| 48 | export·type·{InvariantOf}·from·'./source/invariant-of.d.ts'; | 48 | export·type·{InvariantOf}·from·'./source/invariant-of.d.ts'; |
| 49 | export·type·{SetOptional}·from·'./source/set-optional.d.ts'; | 49 | export·type·{SetOptional}·from·'./source/set-optional.d.ts'; |
| 50 | export·type·{SetReadonly}·from·'./source/set-readonly.d.ts'; | 50 | export·type·{SetReadonly}·from·'./source/set-readonly.d.ts'; |
| 51 | export·type·{SetRequired}·from·'./source/set-required.d.ts'; | 51 | export·type·{SetRequired}·from·'./source/set-required.d.ts'; |
| 52 | export·type·{SetRequiredDeep}·from·'./source/set-required-deep.d.ts'; | 52 | export·type·{SetRequiredDeep}·from·'./source/set-required-deep.d.ts'; |
| 53 | export·type·{SetNonNullable}·from·'./source/set-non-nullable.d.ts'; | 53 | export·type·{SetNonNullable}·from·'./source/set-non-nullable.d.ts'; |
| 54 | export·type·{SetNonNullableDeep}·from·'./source/set-non-nullable-deep.d.ts'; | 54 | export·type·{SetNonNullableDeep}·from·'./source/set-non-nullable-deep.d.ts'; |
| 55 | export·type·{NonNullableDeep}·from·'./source/non-nullable-deep.d.ts'; | ||
| 55 | export·type·{ValueOf}·from·'./source/value-of.d.ts'; | 56 | export·type·{ValueOf}·from·'./source/value-of.d.ts'; |
| 56 | export·type·{AsyncReturnType}·from·'./source/async-return-type.d.ts'; | 57 | export·type·{AsyncReturnType}·from·'./source/async-return-type.d.ts'; |
| 57 | export·type·{ConditionalExcept}·from·'./source/conditional-except.d.ts'; | 58 | export·type·{ConditionalExcept}·from·'./source/conditional-except.d.ts'; |
| 58 | export·type·{ConditionalKeys}·from·'./source/conditional-keys.d.ts'; | 59 | export·type·{ConditionalKeys}·from·'./source/conditional-keys.d.ts'; |
| 59 | export·type·{ConditionalPick}·from·'./source/conditional-pick.d.ts'; | 60 | export·type·{ConditionalPick}·from·'./source/conditional-pick.d.ts'; |
| 60 | export·type·{ConditionalPickDeep,·ConditionalPickDeepOptions}·from·'./source/conditional-pick-deep.d.ts'; | 61 | export·type·{ConditionalPickDeep,·ConditionalPickDeepOptions}·from·'./source/conditional-pick-deep.d.ts'; |
| 61 | export·type·{UnionToIntersection}·from·'./source/union-to-intersection.d.ts'; | 62 | export·type·{UnionToIntersection}·from·'./source/union-to-intersection.d.ts'; |
| Offset 169, 14 lines modified | Offset 170, 16 lines modified | ||
| 169 | export·type·{IsUppercase}·from·'./source/is-uppercase.d.ts'; | 170 | export·type·{IsUppercase}·from·'./source/is-uppercase.d.ts'; |
| 170 | export·type·{IsOptional}·from·'./source/is-optional.d.ts'; | 171 | export·type·{IsOptional}·from·'./source/is-optional.d.ts'; |
| 171 | export·type·{IsNullable}·from·'./source/is-nullable.d.ts'; | 172 | export·type·{IsNullable}·from·'./source/is-nullable.d.ts'; |
| 172 | export·type·{TupleOf}·from·'./source/tuple-of.d.ts'; | 173 | export·type·{TupleOf}·from·'./source/tuple-of.d.ts'; |
| 173 | export·type·{ExclusifyUnion}·from·'./source/exclusify-union.d.ts'; | 174 | export·type·{ExclusifyUnion}·from·'./source/exclusify-union.d.ts'; |
| 174 | export·type·{ArrayReverse}·from·'./source/array-reverse.d.ts'; | 175 | export·type·{ArrayReverse}·from·'./source/array-reverse.d.ts'; |
| 175 | export·type·{UnionMember}·from·'./source/union-member.d.ts'; | 176 | export·type·{UnionMember}·from·'./source/union-member.d.ts'; |
| 177 | export·type·{Absolute}·from·'./source/absolute.d.ts'; | ||
| 178 | export·type·{UnionLength}·from·'./source/union-length.d.ts'; | ||
| 176 | //·Template·literal·types | 179 | //·Template·literal·types |
| 177 | export·type·{CamelCase,·CamelCaseOptions}·from·'./source/camel-case.d.ts'; | 180 | export·type·{CamelCase,·CamelCaseOptions}·from·'./source/camel-case.d.ts'; |
| 178 | export·type·{CamelCasedProperties}·from·'./source/camel-cased-properties.d.ts'; | 181 | export·type·{CamelCasedProperties}·from·'./source/camel-cased-properties.d.ts'; |
| 179 | export·type·{CamelCasedPropertiesDeep}·from·'./source/camel-cased-properties-deep.d.ts'; | 182 | export·type·{CamelCasedPropertiesDeep}·from·'./source/camel-cased-properties-deep.d.ts'; |
| 180 | export·type·{KebabCase}·from·'./source/kebab-case.d.ts'; | 183 | export·type·{KebabCase}·from·'./source/kebab-case.d.ts'; |
| 181 | export·type·{KebabCasedProperties}·from·'./source/kebab-cased-properties.d.ts'; | 184 | export·type·{KebabCasedProperties}·from·'./source/kebab-cased-properties.d.ts'; |
| Offset 5, 25 lines modified | Offset 5, 27 lines modified | ||
| 5 | ········"url":·"https://sindresorhus.com" | 5 | ········"url":·"https://sindresorhus.com" |
| 6 | ····}, | 6 | ····}, |
| 7 | ····"dependencies":·{ | 7 | ····"dependencies":·{ |
| 8 | ········"tagged-tag":·"^1.0.0" | 8 | ········"tagged-tag":·"^1.0.0" |
| 9 | ····}, | 9 | ····}, |
| 10 | ····"description":·"A·collection·of·essential·TypeScript·types", | 10 | ····"description":·"A·collection·of·essential·TypeScript·types", |
| 11 | ····"devDependencies":·{ | 11 | ····"devDependencies":·{ |
| 12 | ········"@eslint/markdown":·"^8.0.1", | ||
| 12 | ········"@sindresorhus/tsconfig":·"^8.0.1", | 13 | ········"@sindresorhus/tsconfig":·"^8.0.1", |
| 14 | ········"@types/node":·"^25.5.0", | ||
| 13 | ········"@typescript-eslint/parser":·"^8.44.0", | 15 | ········"@typescript-eslint/parser":·"^8.44.0", |
| 14 | ········"@typescript/vfs":·"^1.6.1", | 16 | ········"@typescript/vfs":·"^1.6.1", |
| 15 | ········"dedent":·"^1.7.0", | 17 | ········"dedent":·"^1.7.0", |
| 16 | ········"eslint":·"^ | 18 | ········"eslint":·"^10.1.0", |
| 17 | ········"expect-type":·"^1.2.2", | 19 | ········"expect-type":·"^1.2.2", |
| 18 | ········"npm-run-all2":·"^8.0.4", | 20 | ········"npm-run-all2":·"^8.0.4", |
| 19 | ········"tsd":·"^0.33.0", | 21 | ········"tsd":·"^0.33.0", |
| 20 | ········"typescript":·"^5.9.2", | 22 | ········"typescript":·"^5.9.2", |
| 21 | ········"typescript-eslint":·"^8.47.0", | 23 | ········"typescript-eslint":·"^8.47.0", |
| 22 | ········"xo":·"^ | 24 | ········"xo":·"^2.0.2" |
| 23 | ····}, | 25 | ····}, |
| 24 | ····"engines":·{ | 26 | ····"engines":·{ |
| 25 | ········"node":·">=20" | 27 | ········"node":·">=20" |
| 26 | ····}, | 28 | ····}, |
| 27 | ····"exports":·{ | 29 | ····"exports":·{ |
| 28 | ········".":·{ | 30 | ········".":·{ |
| 29 | ············"types":·"./index.d.ts" | 31 | ············"types":·"./index.d.ts" |
| Offset 55, 19 lines modified | Offset 57, 19 lines modified | ||
| 55 | ····"name":·"type-fest", | 57 | ····"name":·"type-fest", |
| 56 | ····"repository":·"sindresorhus/type-fest", | 58 | ····"repository":·"sindresorhus/type-fest", |
| 57 | ····"scripts":·{ | 59 | ····"scripts":·{ |
| 58 | ········"test":·"run-p·test:*", | 60 | ········"test":·"run-p·test:*", |
| 59 | ········"test:linter":·"node·--test", | 61 | ········"test:linter":·"node·--test", |
| 60 | ········"test:tsc":·"node·--max-old-space-size=6144·./node_modules/.bin/tsc", | 62 | ········"test:tsc":·"node·--max-old-space-size=6144·./node_modules/.bin/tsc", |
| 61 | ········"test:tsd":·"node·--max-old-space-size=6144·./node_modules/.bin/tsd", | 63 | ········"test:tsd":·"node·--max-old-space-size=6144·./node_modules/.bin/tsd", |
| 62 | ········"test:xo":·"node·--max-old-space-size=6144·./node_modules/.bin/xo·--ignores=lint-processors/fixtures/**/*.d.ts" | 64 | ········"test:xo":·"node·--max-old-space-size=6144·./node_modules/.bin/xo·--ignores=lint-processors/fixtures/**/*.d.ts·'**/*.{js,ts,md}'" |
| 63 | ····}, | 65 | ····}, |
| 64 | ····"sideEffects":·false, | 66 | ····"sideEffects":·false, |
| 65 | ····"tsd":·{ | 67 | ····"tsd":·{ |
| 66 | ········"compilerOptions":·{ | 68 | ········"compilerOptions":·{ |
| 67 | ············"noUnusedLocals":·false | 69 | ············"noUnusedLocals":·false |
| 68 | ········} | 70 | ········} |
| 69 | ····}, | 71 | ····}, |
| 70 | ····"type":·"module", | 72 | ····"type":·"module", |
| 71 | ····"types":·"./index.d.ts", | 73 | ····"types":·"./index.d.ts", |
| 72 | ····"version":·"5. | 74 | ····"version":·"5.6.0" |
| 73 | } | 75 | } |
| Offset 25, 14 lines modified | Offset 25, 25 lines modified | ||
| 25 | » » » » » <img·width="230"·src="https://sindresorhus.com/assets/thanks/nitric-logo.svg"·alt="nitric·logo"> | 25 | » » » » » <img·width="230"·src="https://sindresorhus.com/assets/thanks/nitric-logo.svg"·alt="nitric·logo"> |
| 26 | » » » » </div> | 26 | » » » » </div> |
| 27 | » » » » <b>Effortless·backends·with·infrastructure·from·code</b> | 27 | » » » » <b>Effortless·backends·with·infrastructure·from·code</b> |
| 28 | » » » » <div> | 28 | » » » » <div> |
| 29 | » » » » » <sup>An·open-source·framework·that·supports·any·programming·language,·cloud·provider,·or·deployment·automation·tool.</sup> | 29 | » » » » » <sup>An·open-source·framework·that·supports·any·programming·language,·cloud·provider,·or·deployment·automation·tool.</sup> |
| 30 | » » » » </div> | 30 | » » » » </div> |
| 31 | » » » </a> | 31 | » » » </a> |
| 32 | » » » <br> | ||
| 33 | » » » <br> | ||
| 34 | » » » <a·href="https://circleback.ai?utm_source=sindresorhus&utm_medium=sponsorship&utm_campaign=awesome-list&utm_id=type-fest"> | ||
| 35 | » » » » <div> | ||
| 36 | » » » » » <img·width="300"·src="https://sindresorhus.com/assets/thanks/circleback-logo.png?x"·alt="Circleback·logo"> | ||
| 37 | » » » » </div> | ||
| 38 | » » » » <b>Get·the·most·out·of·every·conversation.</b> | ||
| 39 | » » » » <div> | ||
| 40 | » » » » » <sup>AI-powered·meeting·notes,·automations,·and·search.·Give·AI·agents·the·context·they·need·to·get·things·done.</sup> | ||
| 41 | » » » » </div> | ||
| 42 | » » » </a> | ||
| 32 | » » </p> | 43 | » » </p> |
| 33 | » </div> | 44 | » </div> |
| 34 | » <br> | 45 | » <br> |
| 35 | » <hr> | 46 | » <hr> |
| 36 | </div> | 47 | </div> |
| 37 | <br> | 48 | <br> |
| 38 | <br> | 49 | <br> |
| Offset 98, 92 lines modified | Offset 109, 93 lines modified | ||
| 98 | -·[`EmptyObject`](source/empty-object.d.ts)·-·Represents·a·strictly·empty·plain·object,·the·`{}`·value. | 109 | -·[`EmptyObject`](source/empty-object.d.ts)·-·Represents·a·strictly·empty·plain·object,·the·`{}`·value. |
| 99 | -·[`NonEmptyObject`](source/non-empty-object.d.ts)·-·Represents·an·object·with·at·least·1·non-optional·key. | 110 | -·[`NonEmptyObject`](source/non-empty-object.d.ts)·-·Represents·an·object·with·at·least·1·non-optional·key. |
| 100 | -·[`UnknownRecord`](source/unknown-record.d.ts)·-·Represents·an·object·with·`unknown`·value.·You·probably·want·this·instead·of·`{}`. | 111 | -·[`UnknownRecord`](source/unknown-record.d.ts)·-·Represents·an·object·with·`unknown`·value.·You·probably·want·this·instead·of·`{}`. |
| 101 | -·[`UnknownArray`](source/unknown-array.d.ts)·-·Represents·an·array·with·`unknown`·value. | 112 | -·[`UnknownArray`](source/unknown-array.d.ts)·-·Represents·an·array·with·`unknown`·value. |
| 102 | -·[`UnknownMap`](source/unknown-map.d.ts)·-·Represents·a·map·with·`unknown`·key·and·value. | 113 | -·[`UnknownMap`](source/unknown-map.d.ts)·-·Represents·a·map·with·`unknown`·key·and·value. |
| 103 | -·[`UnknownSet`](source/unknown-set.d.ts)·-·Represents·a·set·with·`unknown`·value. | 114 | -·[`UnknownSet`](source/unknown-set.d.ts)·-·Represents·a·set·with·`unknown`·value. |
| 104 | -·[`Except`](source/except.d.ts)·-·Create·a·type·from·an·object·type·without·certain·keys. | 115 | -·[`Except`](source/except.d.ts)·-·Create·a·type·from·an·object·type·without·certain·keys. |
| 105 | -·[`Writable`](source/writable.d.ts)·-·Create·a·type·that·strips·`readonly`·from·the·given·type.·Inverse·of·`Readonly<T>`. | 116 | -·[`Writable`](source/writable.d.ts)·-·Create·a·type·that·strips·`readonly`·from·the·given·type.·Inverse·of·`Readonly<T>`. |
| 106 | -·[`WritableDeep`](source/writable-deep.d.ts)·-·Create·a·deeply·mutable·version·of·an·`object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray`·type.·The·inverse·of·`ReadonlyDeep<T>`.·Use·`Writable<T>`·if·you·only·need·one·level·deep. | 117 | -·[`WritableDeep`](source/writable-deep.d.ts)·-·Create·a·deeply·mutable·version·of·an·`object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray`·type.·The·inverse·of·`ReadonlyDeep<T>`.·Use·`Writable<T>`·if·you·only·need·one·level·deep. |
| 107 | -·[`Merge`](source/merge.d.ts)·-·Merge·two·types·into·a·new·type.·Keys·of·the·second·type·overrides·keys·of·the·first·type. | 118 | -·[`Merge`](source/merge.d.ts)·-·Merge·two·types·into·a·new·type.·Keys·of·the·second·type·overrides·keys·of·the·first·type. |
| 108 | -·[`ObjectMerge`](source/object-merge.d.ts)·-·Merge·two·object·types·into·a·new·object·type,·where·keys·from·the·second·override·keys·from·the·first. | 119 | -·[`ObjectMerge`](source/object-merge.d.ts)·-·Merge·two·object·types·into·a·new·object·type,·where·keys·from·the·second·override·keys·from·the·first. |
| 109 | -·[`MergeDeep`](source/merge-deep.d.ts)·-·Merge·two·objects·or·two·arrays/tuples·recursively·into·a·new·type. | 120 | -·[`MergeDeep`](source/merge-deep.d.ts)·-·Merge·two·objects·or·two·arrays/tuples·recursively·into·a·new·type. |
| 110 | -·[`MergeExclusive`](source/merge-exclusive.d.ts)·-·Create·a·type·that·has·mutually·exclusive·keys. | 121 | -·[`MergeExclusive`](source/merge-exclusive.d.ts)·-·Create·a·type·that·has·mutually·exclusive·keys. |
| 111 | -·[`OverrideProperties`](source/override-properties.d.ts)·-·Override· | 122 | -·[`OverrideProperties`](source/override-properties.d.ts)·-·Override·existing·properties·of·the·given·type.·Similar·to·`Merge`,·but·enforces·that·the·original·type·has·the·properties·you·want·to·override. |
| 112 | -·[`RequireAtLeastOne`](source/require-at-least-one.d.ts)·-·Create·a·type·that·requires·at·least·one·of·the·given·keys. | 123 | -·[`RequireAtLeastOne`](source/require-at-least-one.d.ts)·-·Create·a·type·that·requires·at·least·one·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 113 | -·[`RequireExactlyOne`](source/require-exactly-one.d.ts)·-·Create·a·type·that·requires·exactly· | 124 | -·[`RequireExactlyOne`](source/require-exactly-one.d.ts)·-·Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more,·while·keeping·the·remaining·keys·as·is. |
| 114 | -·[`RequireAllOrNone`](source/require-all-or-none.d.ts)·-·Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys. | 125 | -·[`RequireAllOrNone`](source/require-all-or-none.d.ts)·-·Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 115 | -·[`RequireOneOrNone`](source/require-one-or-none.d.ts)·-·Create·a·type·that·requires·exactly· | 126 | -·[`RequireOneOrNone`](source/require-one-or-none.d.ts)·-·Create·a·type·that·requires·exactly·one·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 116 | -·[`SingleKeyObject`](source/single-key-object.d.ts)·-·Create·a·type·that·only·accepts·an·object·with·a·single·key. | 127 | -·[`SingleKeyObject`](source/single-key-object.d.ts)·-·Create·a·type·that·only·accepts·an·object·with·a·single·key. |
| 117 | -·[`RequiredDeep`](source/required-deep.d.ts)·-·Create·a·deeply·required·version·of·another·type.·Use·[`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype)·if·you·only·need·one·level·deep. | ||
| 118 | -·[`PickDeep`](source/pick-deep.d.ts)·-·Pick·properties·from·a·deeply-nested·object.·Use·[`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)·if·you·only·need·one·level·deep. | ||
| 119 | -·[` | 128 | -·[`RequiredDeep`](source/required-deep.d.ts)·-·Create·a·deeply·required·version·of·another·type. |
| 129 | -·[`PickDeep`](source/pick-deep.d.ts)·-·Pick·properties·from·a·deeply-nested·object. | ||
| 130 | -·[`OmitDeep`](source/omit-deep.d.ts)·-·Omit·properties·from·a·deeply-nested·object. | ||
| 120 | -·[`OmitIndexSignature`](source/omit-index-signature.d.ts)·-·Omit·any·index·signatures·from·the·given·object·type,·leaving·only·explicitly·defined·properties. | 131 | -·[`OmitIndexSignature`](source/omit-index-signature.d.ts)·-·Omit·any·index·signatures·from·the·given·object·type,·leaving·only·explicitly·defined·properties. |
| 121 | -·[`PickIndexSignature`](source/pick-index-signature.d.ts)·-·Pick·only·index·signatures·from·the·given·object·type,·leaving·out·all·explicitly·defined·properties. | 132 | -·[`PickIndexSignature`](source/pick-index-signature.d.ts)·-·Pick·only·index·signatures·from·the·given·object·type,·leaving·out·all·explicitly·defined·properties. |
| 122 | -·[`PartialDeep`](source/partial-deep.d.ts)·-·Create·a·deeply·optional·version·of·another·type. | 133 | -·[`PartialDeep`](source/partial-deep.d.ts)·-·Create·a·deeply·optional·version·of·another·type. |
| 123 | -·[`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·keys·accepting·`undefined`·type·are·set·to·optional. | 134 | -·[`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·keys·accepting·`undefined`·type·are·set·to·optional. |
| 124 | -·[`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·optional·keys·are·set·to·also·accept·`undefined`. | 135 | -·[`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·optional·keys·are·set·to·also·accept·`undefined`. |
| 125 | -·[`UnwrapPartial`](source/unwrap-partial.d.ts)·-·Revert·the·`Partial`·modifier·on·an·object·type. | 136 | -·[`UnwrapPartial`](source/unwrap-partial.d.ts)·-·Revert·the·`Partial`·modifier·on·an·object·type. |
| 126 | -·[`ReadonlyDeep`](source/readonly-deep.d.ts)·-·Create·a·deeply·immutable·version·of·an | 137 | -·[`ReadonlyDeep`](source/readonly-deep.d.ts)·-·Create·a·deeply·immutable·version·of·another·type. |
| 127 | -·[`LiteralUnion`](source/literal-union.d.ts)·-·Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. | 138 | -·[`LiteralUnion`](source/literal-union.d.ts)·-·Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. |
| 128 | -·[`Tagged`](source/tagged.d.ts)·-·Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). | 139 | -·[`Tagged`](source/tagged.d.ts)·-·Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). |
| 129 | -·[`UnwrapTagged`](source/tagged.d.ts)·-·Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. | 140 | -·[`UnwrapTagged`](source/tagged.d.ts)·-·Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. |
| 130 | -·[`InvariantOf`](source/invariant-of.d.ts)·-·Create·an·[invariant·type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance),·which·is·a·type·that·does·not·accept·supertypes·and·subtypes. | 141 | -·[`InvariantOf`](source/invariant-of.d.ts)·-·Create·an·[invariant·type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance),·which·is·a·type·that·does·not·accept·supertypes·and·subtypes. |
| 131 | -·[`SetOptional`](source/set-optional.d.ts)·-·Create·a·type·that·makes·the·given·keys·optional. | 142 | -·[`SetOptional`](source/set-optional.d.ts)·-·Create·a·type·that·makes·the·given·keys·optional,·while·keeping·the·remaining·keys·as·is. |
| 132 | -·[`SetReadonly`](source/set-readonly.d.ts)·-·Create·a·type·that·makes·the·given·keys·readonly. | 143 | -·[`SetReadonly`](source/set-readonly.d.ts)·-·Create·a·type·that·makes·the·given·keys·readonly,·while·keeping·the·remaining·keys·as·is. |
| 133 | -·[`SetRequired`](source/set-required.d.ts)·-·Create·a·type·that·makes·the·given·keys·required. | 144 | -·[`SetRequired`](source/set-required.d.ts)·-·Create·a·type·that·makes·the·given·keys·required,·while·keeping·the·remaining·keys·as·is. |
| 134 | -·[`SetRequiredDeep`](source/set-required-deep.d.ts)·-· | 145 | -·[`SetRequiredDeep`](source/set-required-deep.d.ts)·-·Create·a·type·that·makes·the·given·keys·required,·with·support·for·deeply·nested·key·paths,·while·keeping·the·remaining·keys·as·is. |
| 135 | -·[`SetNonNullable`](source/set-non-nullable.d.ts)·-·Create·a·type·that·makes·the·given·keys·non-nullable. | 146 | -·[`SetNonNullable`](source/set-non-nullable.d.ts)·-·Create·a·type·that·makes·the·given·keys·non-nullable,·while·keeping·the·remaining·keys·as·is. |
| 136 | -·[`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts)·-·Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. | 147 | -·[`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts)·-·Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. |
| 148 | -·[`NonNullableDeep`](source/non-nullable-deep.d.ts)·-·Recursively·removes·`null`·and·`undefined`·from·the·specified·type. | ||
| 137 | -·[`ValueOf`](source/value-of.d.ts)·-·Create·a·union·of·the·given·object's·values,·and·optionally·specify·which·keys·to·get·the·values·from. | 149 | -·[`ValueOf`](source/value-of.d.ts)·-·Create·a·union·of·the·given·object's·values,·and·optionally·specify·which·keys·to·get·the·values·from. |
| 138 | -·[`ConditionalKeys`](source/conditional-keys.d.ts)·-·Extract·keys·from·a· | 150 | -·[`ConditionalKeys`](source/conditional-keys.d.ts)·-·Extract·the·keys·from·a·type·where·the·value·type·of·the·key·extends·the·given·`Condition`. |
| 139 | -·[`ConditionalPick`](source/conditional-pick.d.ts)·-·Like·`Pick`·except·it·selects·properties·from·a·shape·where·the·values·extend·the·given·`Condition`·type. | ||
| 140 | -·[`ConditionalPickDeep`](source/conditional-pick-deep.d.ts)·-·Like·`ConditionalPick`·except·that·it·selects·the·properties·deeply. | ||
| 141 | -·[`Conditional | 151 | -·[`ConditionalPick`](source/conditional-pick.d.ts)·-·Pick·keys·from·the·shape·that·matches·the·given·`Condition`. |
| 152 | -·[`ConditionalPickDeep`](source/conditional-pick-deep.d.ts)·-·Pick·keys·recursively·from·the·shape·that·matches·the·given·condition. | ||
| 153 | -·[`ConditionalExcept`](source/conditional-except.d.ts)·-·Exclude·keys·from·a·shape·that·matches·the·given·`Condition`. | ||
| 142 | -·[`UnionToIntersection`](source/union-to-intersection.d.ts)·-·Convert·a·union·type·to·an·intersection·type. | 154 | -·[`UnionToIntersection`](source/union-to-intersection.d.ts)·-·Convert·a·union·type·to·an·intersection·type. |
| 143 | -·[`LiteralToPrimitive`](source/literal-to-primitive.d.ts)·-· | 155 | -·[`LiteralToPrimitive`](source/literal-to-primitive.d.ts)·-·Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the·[primitive·type](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)·it·belongs·to,·or·`never`·if·it's·not·a·primitive. |
| 144 | -·[`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts)·-·Like·`LiteralToPrimitive`·except·it·converts·literal·types·inside·an·object·or·array·deeply. | 156 | -·[`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts)·-·Like·`LiteralToPrimitive`·except·it·converts·literal·types·inside·an·object·or·array·deeply. |
| 145 | -·[`Stringified`](source/stringified.d.ts)·-·Create·a·type·with·the·keys·of·the·given·type·changed·to·`string`·type. | 157 | -·[`Stringified`](source/stringified.d.ts)·-·Create·a·type·with·the·keys·of·the·given·type·changed·to·`string`·type. |
| 146 | -·[`IterableElement`](source/iterable-element.d.ts)·-·Get·the·element·type·of·an·`Iterable`/`AsyncIterable`.·For·example,·`Array`,·`Set`,·`Map`,·generator,·stream,·etc. | 158 | -·[`IterableElement`](source/iterable-element.d.ts)·-·Get·the·element·type·of·an·`Iterable`/`AsyncIterable`.·For·example,·`Array`,·`Set`,·`Map`,·generator,·stream,·etc. |
| 147 | -·[`Entry`](source/entry.d.ts)·-·Create·a·type·that·represents·the·type·of·an·entry·of·a·collection. | ||
| 148 | -·[`Entr | 159 | -·[`Entry`](source/entry.d.ts)·-·Create·a·type·that·describes·a·single·key-value·pair·produced·when·calling·a·collection’s·`entries`·method. |
| 160 | -·[`Entries`](source/entries.d.ts)·-·Create·a·type·that·describes·the·key-value·pairs·produced·when·calling·a·collection’s·`entries`·method. | ||
| 149 | -·[`SetReturnType`](source/set-return-type.d.ts)·-·Create·a·function·type·with·a·return·type·of·your·choice·and·the·same·parameters·as·the·given·function·type. | 161 | -·[`SetReturnType`](source/set-return-type.d.ts)·-·Create·a·function·type·with·a·return·type·of·your·choice·and·the·same·parameters·as·the·given·function·type. |
| 150 | -·[`SetParameterType`](source/set-parameter-type.d.ts)·-·Create·a·function·that·replaces·some·parameters·with·the·given·parameters. | 162 | -·[`SetParameterType`](source/set-parameter-type.d.ts)·-·Create·a·function·that·replaces·some·parameters·with·the·given·parameters. |
| 151 | -·[`Simplify`](source/simplify.d.ts)·-·Useful·to·flatten·the·type·output·to·improve·type·hints·shown·in·editors.·And·also·to·transform·an·interface·into·a·type·to·aide·with·assignability. | 163 | -·[`Simplify`](source/simplify.d.ts)·-·Useful·to·flatten·the·type·output·to·improve·type·hints·shown·in·editors.·And·also·to·transform·an·interface·into·a·type·to·aide·with·assignability. |
| 152 | -·[`SimplifyDeep`](source/simplify-deep.d.ts)·-·Deeply·simplifies·an·object·type. | 164 | -·[`SimplifyDeep`](source/simplify-deep.d.ts)·-·Deeply·simplifies·an·object·type. |
| 153 | -·[`Get`](source/get.d.ts)·-·Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. | 165 | -·[`Get`](source/get.d.ts)·-·Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. |
| 154 | -·[`KeyAsString`](source/key-as-string.d.ts)·-·Get·keys·of·the·given·type·as·strings. | 166 | -·[`KeyAsString`](source/key-as-string.d.ts)·-·Get·keys·of·the·given·type·as·strings. |
| 155 | -·[`Schema`](source/schema.d.ts)·-·Create·a·deep·version·of·another·object·type·where·property·values·are·recursively·replaced·into·a·given·value·type. | 167 | -·[`Schema`](source/schema.d.ts)·-·Create·a·deep·version·of·another·object·type·where·property·values·are·recursively·replaced·into·a·given·value·type. |
| 156 | -·[`Exact`](source/exact.d.ts)·-·Create·a·type·that·does·not·allow·extra·properties. | 168 | -·[`Exact`](source/exact.d.ts)·-·Create·a·type·that·does·not·allow·extra·properties,·meaning·it·only·allows·properties·that·are·explicitly·declared. |
| 157 | -·[`KeysOfUnion`](source/keys-of-union.d.ts)·-·Create·a·union·of·all·keys·from·a·given·type,·even·those·exclusive·to·specific·union·members. | 169 | -·[`KeysOfUnion`](source/keys-of-union.d.ts)·-·Create·a·union·of·all·keys·from·a·given·type,·even·those·exclusive·to·specific·union·members. |
| 158 | -·[`OptionalKeysOf`](source/optional-keys-of.d.ts)·-·Extract·all·optional·keys·from·the·given·type. | 170 | -·[`OptionalKeysOf`](source/optional-keys-of.d.ts)·-·Extract·all·optional·keys·from·the·given·type. |
| 159 | -·[`HasOptionalKeys`](source/has-optional-keys.d.ts)·-· | 171 | -·[`HasOptionalKeys`](source/has-optional-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·optional·fields. |
| 160 | -·[`RequiredKeysOf`](source/required-keys-of.d.ts)·-·Extract·all·required·keys·from·the·given·type. | 172 | -·[`RequiredKeysOf`](source/required-keys-of.d.ts)·-·Extract·all·required·keys·from·the·given·type. |
| 161 | -·[`HasRequiredKeys`](source/has-required-keys.d.ts)·-· | 173 | -·[`HasRequiredKeys`](source/has-required-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·required·fields. |
| 162 | -·[`ReadonlyKeysOf`](source/readonly-keys-of.d.ts)·-·Extract·all·readonly·keys·from·the·given·type. | 174 | -·[`ReadonlyKeysOf`](source/readonly-keys-of.d.ts)·-·Extract·all·readonly·keys·from·the·given·type. |
| 163 | -·[`HasReadonlyKeys`](source/has-readonly-keys.d.ts)·-· | 175 | -·[`HasReadonlyKeys`](source/has-readonly-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·readonly·fields. |
| Max diff block lines reached; 17177/33503 bytes (51.27%) of diff not shown. | |||
| Offset 65, 27 lines modified | Offset 65, 27 lines modified | ||
| 65 | @see·{@link·SharedUnionFields} | 65 | @see·{@link·SharedUnionFields} |
| 66 | @category·Object | 66 | @category·Object |
| 67 | @category·Union | 67 | @category·Union |
| 68 | */ | 68 | */ |
| 69 | export·type·AllUnionFields<Union>·= | 69 | export·type·AllUnionFields<Union>·= |
| 70 | Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers | 70 | » Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers |
| 71 | » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers | 71 | » » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers |
| 72 | » » ? | 72 | » » » ?·//·eslint-disable-line·@stylistic/operator-linebreak |
| 73 | » » |·SkippedMembers | 73 | » » » |·SkippedMembers |
| 74 | » » |·Simplify< | 74 | » » » |·Simplify< |
| 75 | » » //·Include·fields·that·are·common·in·all·union·members | 75 | » » » » //·Include·fields·that·are·common·in·all·union·members |
| 76 | » » » SharedUnionFields<RelevantMembers> | 76 | » » » » SharedUnionFields<RelevantMembers> |
| 77 | » » //·Include·readonly·fields·present·in·any·union·member | 77 | » » » » //·Include·readonly·fields·present·in·any·union·member |
| 78 | » » » { | 78 | » » » » &·{ |
| 79 | » » » » readonly·[P·in·ReadonlyKeysOfUnion<RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P·&·KeysOfUnion<RelevantMembers>> | 79 | » » » » » readonly·[P·in·ReadonlyKeysOfUnion<RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P·&·KeysOfUnion<RelevantMembers>> |
| 80 | » » » | 80 | » » » » } |
| 81 | » » //·Include·remaining·fields·that·are·neither·common·nor·readonly | 81 | » » » » //·Include·remaining·fields·that·are·neither·common·nor·readonly |
| 82 | » » » { | 82 | » » » » &·{ |
| 83 | » » » » [P·in·Exclude<KeysOfUnion<RelevantMembers>,·ReadonlyKeysOfUnion<RelevantMembers>·|·keyof·RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P> | 83 | » » » » » [P·in·Exclude<KeysOfUnion<RelevantMembers>,·ReadonlyKeysOfUnion<RelevantMembers>·|·keyof·RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P> |
| 84 | » » » } | 84 | » » » » } |
| 85 | » » > | 85 | » » » > |
| 86 | » » :·never | 86 | » » » :·never |
| 87 | » :·never; | 87 | » » :·never; |
| 88 | export·{}; | 88 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{AndAll}·from·'./and-all.d.ts'; | 1 | import·type·{AndAll}·from·'./and-all.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | Returns·a·boolean·for·whether·two·given·types·are·both·true. | 3 | Returns·a·boolean·for·whether·two·given·types·are·both·`true`. |
| 4 | Use-case:·Constructing·complex·conditional·types·where·multiple·conditions·must·be·satisfied. | 4 | Use-case:·Constructing·complex·conditional·types·where·multiple·conditions·must·be·satisfied. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{And}·from·'type-fest'; | 7 | import·type·{And}·from·'type-fest'; |
| Offset 4, 49 lines modified | Offset 4, 49 lines modified | ||
| 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 5 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 5 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | The·implementation·of·`SplitArrayByIndex`·for·fixed·length·arrays. | 7 | The·implementation·of·`SplitArrayByIndex`·for·fixed·length·arrays. |
| 8 | */ | 8 | */ |
| 9 | type·SplitFixedArrayByIndex<T·extends·UnknownArray,·SplitIndex·extends·number>·= | 9 | type·SplitFixedArrayByIndex<T·extends·UnknownArray,·SplitIndex·extends·number>·= |
| 10 | SplitIndex·extends·0 | 10 | » SplitIndex·extends·0 |
| 11 | » ?·[[],·T] | 11 | » » ?·[[],·T] |
| 12 | » :·T·extends·readonly·[...TupleOf<SplitIndex>,·...infer·V] | 12 | » » :·T·extends·readonly·[...TupleOf<SplitIndex>,·...infer·V] |
| 13 | » » ?·T·extends·readonly·[...infer·U,·...V] | 13 | » » » ?·T·extends·readonly·[...infer·U,·...V] |
| 14 | » » » ?·[U,·V] | 14 | » » » » ?·[U,·V] |
| 15 | » » » :·[never,·never] | 15 | » » » » :·[never,·never] |
| 16 | » » :·[never,·never]; | 16 | » » » :·[never,·never]; |
| 17 | /** | 17 | /** |
| 18 | The·implementation·of·`SplitArrayByIndex`·for·variable·length·arrays. | 18 | The·implementation·of·`SplitArrayByIndex`·for·variable·length·arrays. |
| 19 | */ | 19 | */ |
| 20 | type·SplitVariableArrayByIndex<T·extends·UnknownArray, | 20 | type·SplitVariableArrayByIndex<T·extends·UnknownArray, |
| 21 | » SplitIndex·extends·number, | 21 | » SplitIndex·extends·number, |
| 22 | » T1·=·Subtract<SplitIndex,·StaticPartOfArray<T>['length']>, | 22 | » T1·=·Subtract<SplitIndex,·StaticPartOfArray<T>['length']>, |
| 23 | » T2·=·T1·extends·number | 23 | » T2·=·T1·extends·number |
| 24 | » » ?·TupleOf<GreaterThanOrEqual<T1,·0>·extends·true·?·T1·:·number,·VariablePartOfArray<T>[number]> | 24 | » » ?·TupleOf<GreaterThanOrEqual<T1,·0>·extends·true·?·T1·:·number,·VariablePartOfArray<T>[number]> |
| 25 | » » :·[], | 25 | » » :·[], |
| 26 | >·= | 26 | >·= |
| 27 | SplitIndex·extends·0 | 27 | » SplitIndex·extends·0 |
| 28 | » ?·[[],·T] | 28 | » » ?·[[],·T] |
| 29 | » :·GreaterThanOrEqual<StaticPartOfArray<T>['length'],·SplitIndex>·extends·true | 29 | » » :·GreaterThanOrEqual<StaticPartOfArray<T>['length'],·SplitIndex>·extends·true |
| 30 | » » ?·[ | 30 | » » » ?·[ |
| 31 | » » » SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[0], | 31 | » » » » SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[0], |
| 32 | » » » [ | 32 | » » » » [ |
| 33 | » » » » ...SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[1], | 33 | » » » » » ...SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[1], |
| 34 | » » » » ...VariablePartOfArray<T>, | 34 | » » » » » ...VariablePartOfArray<T>, |
| 35 | » » » ], | 35 | » » » » ], |
| 36 | » » ] | 36 | » » » ] |
| 37 | » » :·[ | 37 | » » » :·[ |
| 38 | » » » [ | 38 | » » » » [ |
| 39 | » » » » ...StaticPartOfArray<T>, | 39 | » » » » » ...StaticPartOfArray<T>, |
| 40 | » » » » ...(T2·extends·UnknownArray·?·T2·:·[]), | 40 | » » » » » ...(T2·extends·UnknownArray·?·T2·:·[]), |
| 41 | » » » ], | 41 | » » » » ], |
| 42 | » » » VariablePartOfArray<T>, | 42 | » » » » VariablePartOfArray<T>, |
| 43 | » » ]; | 43 | » » » ]; |
| 44 | /** | 44 | /** |
| 45 | Split·the·given·array·`T`·by·the·given·`SplitIndex`. | 45 | Split·the·given·array·`T`·by·the·given·`SplitIndex`. |
| 46 | @example | 46 | @example |
| 47 | ``` | 47 | ``` |
| 48 | type·A·=·SplitArrayByIndex<[1,·2,·3,·4],·2>; | 48 | type·A·=·SplitArrayByIndex<[1,·2,·3,·4],·2>; |
| Offset 1, 30 lines modified | Offset 1, 56 lines modified | ||
| 1 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 1 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 2 | import·type·{Words,·WordsOptions}·from·'./words.d.ts'; | 2 | import·type·{_DefaultWordsOptions,·Words,·WordsOptions}·from·'./words.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | CamelCase·options. | 4 | CamelCase·options. |
| 5 | @see·{@link·CamelCase} | 5 | @see·{@link·CamelCase} |
| 6 | */ | 6 | */ |
| 7 | export·type·CamelCaseOptions·=·WordsOptions·&·{ | 7 | export·type·CamelCaseOptions·=·WordsOptions·&·{ |
| 8 | » /** | 8 | » /** |
| 9 | » Whether·to·preserved·consecutive·uppercase·letter. | 9 | » Whether·to·preserved·consecutive·uppercase·letter. |
| 10 | » @default·false | 10 | » @default·false |
| 11 | » */ | 11 | » */ |
| 12 | » preserveConsecutiveUppercase?:·boolean; | 12 | » preserveConsecutiveUppercase?:·boolean; |
| 13 | » /** | ||
| 14 | » Whether·to·preserve·leading·underscores. | ||
| 15 | » This·matches·the·behavior·of·the·[`camelcase`](https://github.com/sindresorhus/camelcase)·package·v9+. | ||
| 16 | » @default·false | ||
| 17 | » */ | ||
| 18 | » preserveLeadingUnderscores?:·boolean; | ||
| 13 | }; | 19 | }; |
| 14 | export·type·_DefaultCamelCaseOptions·=·{ | 20 | export·type·_DefaultCamelCaseOptions·=·_DefaultWordsOptions·&·{ |
| 15 | » splitOnNumbers:·true; | ||
| 16 | » preserveConsecutiveUppercase:·false; | 21 | » preserveConsecutiveUppercase:·false; |
| 22 | » preserveLeadingUnderscores:·false; | ||
| 17 | }; | 23 | }; |
| 18 | /** | 24 | /** |
| 25 | Extract·leading·underscores·from·a·string. | ||
| 26 | @example | ||
| 27 | ``` | ||
| 28 | type·A·=·LeadingUnderscores<'__foo_bar'>; | ||
| 29 | //=>·'__' | ||
| 30 | type·B·=·LeadingUnderscores<'foo_bar'>; | ||
| 31 | //=>·'' | ||
| 32 | ``` | ||
| 33 | */ | ||
| 34 | type·LeadingUnderscores<Type·extends·string,·Underscores·extends·string·=·''>·= | ||
| 35 | » Type·extends·`_${infer·Rest}` | ||
| 36 | » » ?·LeadingUnderscores<Rest,·`_${Underscores}`> | ||
| 37 | » » :·Underscores; | ||
| 38 | /** | ||
| 19 | Convert·an·array·of·words·to·camel-case. | 39 | Convert·an·array·of·words·to·camel-case. |
| 20 | */ | 40 | */ |
| 21 | type·CamelCaseFromArray< | 41 | type·CamelCaseFromArray< |
| 22 | » Words·extends·string[], | 42 | » Words·extends·string[], |
| 23 | » Options·extends·Required<CamelCaseOptions>, | 43 | » Options·extends·Required<CamelCaseOptions>, |
| 24 | » OutputString·extends·string·=·'', | 44 | » OutputString·extends·string·=·'', |
| 25 | >·=·Words·extends·[ | 45 | >·=·Words·extends·[ |
| Offset 39, 22 lines modified | Offset 65, 26 lines modified | ||
| 39 | /** | 65 | /** |
| 40 | Convert·a·string·literal·to·camel-case. | 66 | Convert·a·string·literal·to·camel-case. |
| 41 | This·can·be·useful·when,·for·example,·converting·some·kebab-cased·command-line·flags·or·a·snake-cased·database·result. | 67 | This·can·be·useful·when,·for·example,·converting·some·kebab-cased·command-line·flags·or·a·snake-cased·database·result. |
| 42 | By·default,·consecutive·uppercase·letter·are·preserved.·See·{@link·CamelCaseOptions.preserveConsecutiveUppercase·preserveConsecutiveUppercase}·option·to·change·this·behaviour. | 68 | By·default,·consecutive·uppercase·letter·are·preserved.·See·{@link·CamelCaseOptions.preserveConsecutiveUppercase·preserveConsecutiveUppercase}·option·to·change·this·behaviour. |
| 69 | Use·the·`preserveLeadingUnderscores`·option·to·retain·leading·underscores,·matching·the·runtime·behavior·of·[`camelcase`](https://github.com/sindresorhus/camelcase)·v9+. | ||
| 43 | @example | 70 | @example |
| 44 | ``` | 71 | ``` |
| 45 | import·type·{CamelCase}·from·'type-fest'; | 72 | import·type·{CamelCase}·from·'type-fest'; |
| 46 | //·Simple | 73 | //·Simple |
| 47 | const·someVariable:·CamelCase<'foo-bar'>·=·'fooBar'; | 74 | const·someVariable:·CamelCase<'foo-bar'>·=·'fooBar'; |
| 48 | const·preserveConsecutiveUppercase:·CamelCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'fooBARBaz'; | 75 | const·preserveConsecutiveUppercase:·CamelCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'fooBARBaz'; |
| 76 | const·splitOnPunctuation:·CamelCase<'foo-bar:BAZ',·{splitOnPunctuation:·true}>·=·'fooBarBaz'; | ||
| 77 | const·preserveLeadingUnderscores:·CamelCase<'_foo_bar',·{preserveLeadingUnderscores:·true}>·=·'_fooBar'; | ||
| 49 | //·Advanced | 78 | //·Advanced |
| 50 | type·CamelCasedProperties<T>·=·{ | 79 | type·CamelCasedProperties<T>·=·{ |
| 51 | » [K·in·keyof·T·as·CamelCase<K>]:·T[K] | 80 | » [K·in·keyof·T·as·CamelCase<K>]:·T[K] |
| 52 | }; | 81 | }; |
| Offset 79, 14 lines modified | Offset 109, 17 lines modified | ||
| 79 | @category·Change·case | 109 | @category·Change·case |
| 80 | @category·Template·literal | 110 | @category·Template·literal |
| 81 | */ | 111 | */ |
| 82 | export·type·CamelCase<Type,·Options·extends·CamelCaseOptions·=·{}>·=·Type·extends·string | 112 | export·type·CamelCase<Type,·Options·extends·CamelCaseOptions·=·{}>·=·Type·extends·string |
| 83 | » ?·string·extends·Type | 113 | » ?·string·extends·Type |
| 84 | » » ?·Type | 114 | » » ?·Type |
| 115 | » » :·`${Options['preserveLeadingUnderscores']·extends·true | ||
| 116 | » » » ?·LeadingUnderscores<Type> | ||
| 117 | » » » :·'' | ||
| 85 | » » | 118 | » » }${Uncapitalize<CamelCaseFromArray< |
| 86 | » » » Words<Type·extends·Uppercase<Type>·?·Lowercase<Type>·:·Type,·Options>, | 119 | » » » Words<Type·extends·Uppercase<Type>·?·Lowercase<Type>·:·Type,·Options>, |
| 87 | » » » ApplyDefaultOptions<CamelCaseOptions,·_DefaultCamelCaseOptions,·Options> | 120 | » » » ApplyDefaultOptions<CamelCaseOptions,·_DefaultCamelCaseOptions,·Options> |
| 88 | » » >> | 121 | » » >>}` |
| Max diff block lines reached; 14/3107 bytes (0.45%) of diff not shown. | |||
| Offset 44, 14 lines modified | Offset 44, 21 lines modified | ||
| 44 | const·preserveConsecutiveUppercase:·CamelCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ | 44 | const·preserveConsecutiveUppercase:·CamelCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 45 | » fooBAR:·{ | 45 | » fooBAR:·{ |
| 46 | » » fooBARBiz:·[{ | 46 | » » fooBARBiz:·[{ |
| 47 | » » » fooBARBaz:·'string', | 47 | » » » fooBARBaz:·'string', |
| 48 | » » }], | 48 | » » }], |
| 49 | » }, | 49 | » }, |
| 50 | }; | 50 | }; |
| 51 | const·splitOnPunctuation:·CamelCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 52 | » userInfo:·{ | ||
| 53 | » » userId:·1, | ||
| 54 | » » userName:·'Tom', | ||
| 55 | » }, | ||
| 56 | }; | ||
| 51 | ``` | 57 | ``` |
| 52 | @category·Change·case | 58 | @category·Change·case |
| 53 | @category·Template·literal | 59 | @category·Template·literal |
| 54 | @category·Object | 60 | @category·Object |
| 55 | */ | 61 | */ |
| 56 | export·type·CamelCasedPropertiesDeep< | 62 | export·type·CamelCasedPropertiesDeep< |
| Offset 82, 18 lines modified | Offset 89, 18 lines modified | ||
| 82 | >·=·Value·extends·[] | 89 | >·=·Value·extends·[] |
| 83 | » ?·[] | 90 | » ?·[] |
| 84 | » //·Trailing·spread·array | 91 | » //·Trailing·spread·array |
| 85 | » :·Value·extends·[infer·U,·...infer·V] | 92 | » :·Value·extends·[infer·U,·...infer·V] |
| 86 | » » ?·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] | 93 | » » ?·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] |
| 87 | » » :·Value·extends·readonly·[infer·U,·...infer·V] | 94 | » » :·Value·extends·readonly·[infer·U,·...infer·V] |
| 88 | » » » ?·readonly·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] | 95 | » » » ?·readonly·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] |
| 89 | » » » | 96 | » » » //·Leading·spread·array |
| 90 | » » » Value·extends·readonly·[...infer·U,·infer·V] | 97 | » » » :·Value·extends·readonly·[...infer·U,·infer·V] |
| 91 | » » » » ?·[..._CamelCasedPropertiesDeep<U,·Options>,·_CamelCasedPropertiesDeep<V,·Options>] | 98 | » » » » ?·[..._CamelCasedPropertiesDeep<U,·Options>,·_CamelCasedPropertiesDeep<V,·Options>] |
| 92 | » » » » | 99 | » » » » //·Array |
| 93 | » » » » Value·extends·Array<infer·U> | 100 | » » » » :·Value·extends·Array<infer·U> |
| 94 | » » » » » ?·Array<_CamelCasedPropertiesDeep<U,·Options>> | 101 | » » » » » ?·Array<_CamelCasedPropertiesDeep<U,·Options>> |
| 95 | » » » » » :·Value·extends·ReadonlyArray<infer·U> | 102 | » » » » » :·Value·extends·ReadonlyArray<infer·U> |
| 96 | » » » » » » ?·ReadonlyArray<_CamelCasedPropertiesDeep<U,·Options>> | 103 | » » » » » » ?·ReadonlyArray<_CamelCasedPropertiesDeep<U,·Options>> |
| 97 | » » » » » » :·never; | 104 | » » » » » » :·never; |
| 98 | export·{}; | 105 | export·{}; |
| Offset 1, 12 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{CamelCase,·CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; | 1 | import·type·{CamelCase,·CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Convert·object·properties·to·camel·ca | 4 | Convert·top-level·object·properties·to·camel·case. |
| 5 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 5 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 6 | @see·{@link·CamelCasedPropertiesDeep} | 6 | @see·{@link·CamelCasedPropertiesDeep} |
| 7 | @see·{@link·CamelCase} | 7 | @see·{@link·CamelCase} |
| 8 | @example | 8 | @example |
| Offset 22, 14 lines modified | Offset 22, 18 lines modified | ||
| 22 | » userId:·1, | 22 | » userId:·1, |
| 23 | » userName:·'Tom', | 23 | » userName:·'Tom', |
| 24 | }; | 24 | }; |
| 25 | const·preserveConsecutiveUppercase:·CamelCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ | 25 | const·preserveConsecutiveUppercase:·CamelCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 26 | » fooBAR:·'string', | 26 | » fooBAR:·'string', |
| 27 | }; | 27 | }; |
| 28 | const·splitOnPunctuation:·CamelCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 29 | » fooBar:·'string', | ||
| 30 | }; | ||
| 28 | ``` | 31 | ``` |
| 29 | @category·Change·case | 32 | @category·Change·case |
| 30 | @category·Template·literal | 33 | @category·Template·literal |
| 31 | @category·Object | 34 | @category·Object |
| 32 | */ | 35 | */ |
| 33 | export·type·CamelCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function | 36 | export·type·CamelCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function |
| Offset 34, 14 lines modified | Offset 34, 15 lines modified | ||
| 34 | ``` | 34 | ``` |
| 35 | import·type·{DelimiterCase}·from·'type-fest'; | 35 | import·type·{DelimiterCase}·from·'type-fest'; |
| 36 | //·Simple | 36 | //·Simple |
| 37 | const·someVariable:·DelimiterCase<'fooBar',·'#'>·=·'foo#bar'; | 37 | const·someVariable:·DelimiterCase<'fooBar',·'#'>·=·'foo#bar'; |
| 38 | const·someVariableNoSplitOnNumbers:·DelimiterCase<'p2pNetwork',·'#',·{splitOnNumbers:·false}>·=·'p2p#network'; | 38 | const·someVariableNoSplitOnNumbers:·DelimiterCase<'p2pNetwork',·'#',·{splitOnNumbers:·false}>·=·'p2p#network'; |
| 39 | const·someVariableWithPunctuation:·DelimiterCase<'div.card::after',·'#',·{splitOnPunctuation:·true}>·=·'div#card#after'; | ||
| 39 | //·Advanced | 40 | //·Advanced |
| 40 | type·OddlyCasedProperties<T>·=·{ | 41 | type·OddlyCasedProperties<T>·=·{ |
| 41 | » [K·in·keyof·T·as·DelimiterCase<K,·'#'>]:·T[K] | 42 | » [K·in·keyof·T·as·DelimiterCase<K,·'#'>]:·T[K] |
| 42 | }; | 43 | }; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions,·NonRecursiveType}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions,·NonRecursiveType}·from·'./internal/index.d.ts'; |
| 3 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 3 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·delimiter·cas | 6 | Convert·object·properties·to·a·custom·string·delimiter·casing·recursively. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·DelimiterCase} | 8 | @see·{@link·DelimiterCase} |
| 9 | @see·{@link·DelimiterCasedProperties} | 9 | @see·{@link·DelimiterCasedProperties} |
| 10 | @example | 10 | @example |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » 'line-2':·[ | 47 | » » 'line-2':·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » 'line-3':·'string', | 49 | » » » » 'line-3':·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·DelimiterCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·'-',·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user-info':·{ | ||
| 56 | » » 'user-id':·1, | ||
| 57 | » » 'user-name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·DelimiterCasedPropertiesDeep< | 65 | export·type·DelimiterCasedPropertiesDeep< |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | import·type·{WordsOptions}·from·'./words.d.ts'; | 3 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Convert·object·properties·to· | 5 | Convert·object·properties·to·a·custom·string·delimiter·casing. |
| 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 7 | @see·{@link·DelimiterCase} | 7 | @see·{@link·DelimiterCase} |
| 8 | @see·{@link·DelimiterCasedPropertiesDeep} | 8 | @see·{@link·DelimiterCasedPropertiesDeep} |
| 9 | @example | 9 | @example |
| Offset 23, 14 lines modified | Offset 23, 18 lines modified | ||
| 23 | » 'user-id':·1, | 23 | » 'user-id':·1, |
| 24 | » 'user-name':·'Tom', | 24 | » 'user-name':·'Tom', |
| 25 | }; | 25 | }; |
| 26 | const·splitOnNumbers:·DelimiterCasedProperties<{line1:·string},·'-',·{splitOnNumbers:·true}>·=·{ | 26 | const·splitOnNumbers:·DelimiterCasedProperties<{line1:·string},·'-',·{splitOnNumbers:·true}>·=·{ |
| 27 | » 'line-1':·'string', | 27 | » 'line-1':·'string', |
| 28 | }; | 28 | }; |
| 29 | const·splitOnPunctuation:·DelimiterCasedProperties<{'foo::bar':·string},·'-',·{splitOnPunctuation:·true}>·=·{ | ||
| 30 | » 'foo-bar':·'string', | ||
| 31 | }; | ||
| 29 | ``` | 32 | ``` |
| 30 | @category·Change·case | 33 | @category·Change·case |
| 31 | @category·Template·literal | 34 | @category·Template·literal |
| 32 | @category·Object | 35 | @category·Object |
| 33 | */ | 36 | */ |
| 34 | export·type·DelimiterCasedProperties< | 37 | export·type·DelimiterCasedProperties< |
| Offset 28, 15 lines modified | Offset 28, 15 lines modified | ||
| 28 | Unfortunately,·`Record<string,·never>`,·`Record<keyof·any,·never>`·and·`Record<never,·never>`·do·not·work.·See·{@link·https://github.com/sindresorhus/type-fest/issues/395·#395}. | 28 | Unfortunately,·`Record<string,·never>`,·`Record<keyof·any,·never>`·and·`Record<never,·never>`·do·not·work.·See·{@link·https://github.com/sindresorhus/type-fest/issues/395·#395}. |
| 29 | @category·Object | 29 | @category·Object |
| 30 | */ | 30 | */ |
| 31 | export·type·EmptyObject·=·{[emptyObjectSymbol]?:·never}; | 31 | export·type·EmptyObject·=·{[emptyObjectSymbol]?:·never}; |
| 32 | /** | 32 | /** |
| 33 | Returns·a· | 33 | Returns·a·boolean·for·whether·the·type·is·strictly·equal·to·an·empty·plain·object,·the·`{}`·value. |
| 34 | @example | 34 | @example |
| 35 | ``` | 35 | ``` |
| 36 | import·type·{IsEmptyObject}·from·'type-fest'; | 36 | import·type·{IsEmptyObject}·from·'type-fest'; |
| 37 | type·Pass·=·IsEmptyObject<{}>;·//=>·true | 37 | type·Pass·=·IsEmptyObject<{}>;·//=>·true |
| 38 | type·Fail1·=·IsEmptyObject<[]>;·//=>·false | 38 | type·Fail1·=·IsEmptyObject<[]>;·//=>·false |
| Offset 2, 15 lines modified | Offset 2, 15 lines modified | ||
| 2 | type·ArrayEntries<BaseType·extends·readonly·unknown[]>·=·Array<_ArrayEntry<BaseType>>; | 2 | type·ArrayEntries<BaseType·extends·readonly·unknown[]>·=·Array<_ArrayEntry<BaseType>>; |
| 3 | type·MapEntries<BaseType>·=·Array<_MapEntry<BaseType>>; | 3 | type·MapEntries<BaseType>·=·Array<_MapEntry<BaseType>>; |
| 4 | type·ObjectEntries<BaseType>·=·Array<_ObjectEntry<BaseType>>; | 4 | type·ObjectEntries<BaseType>·=·Array<_ObjectEntry<BaseType>>; |
| 5 | type·SetEntries<BaseType·extends·Set<unknown>>·=·Array<_SetEntry<BaseType>>; | 5 | type·SetEntries<BaseType·extends·Set<unknown>>·=·Array<_SetEntry<BaseType>>; |
| 6 | /** | 6 | /** |
| 7 | 7 | Create·a·type·that·describes·the·key-value·pairs·produced·when·calling·a·collection’s·`entries`·method. | |
| 8 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. | 8 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. |
| 9 | @see·`Entry`·if·you·want·to·just·access·the·type·of·a·single·entry. | 9 | @see·`Entry`·if·you·want·to·just·access·the·type·of·a·single·entry. |
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| Offset 1, 1 lines modified | Offset 1, 1 lines modified | ||
| 1 | u | 1 | utf-8 |
| Offset 3, 15 lines modified | Offset 3, 15 lines modified | ||
| 3 | export·type·_ArrayEntry<BaseType·extends·readonly·unknown[]>·=·[number,·BaseType[number]]; | 3 | export·type·_ArrayEntry<BaseType·extends·readonly·unknown[]>·=·[number,·BaseType[number]]; |
| 4 | export·type·_MapEntry<BaseType>·=·[MapKey<BaseType>,·MapValue<BaseType>]; | 4 | export·type·_MapEntry<BaseType>·=·[MapKey<BaseType>,·MapValue<BaseType>]; |
| 5 | export·type·_ObjectEntry<BaseType>·=·[keyof·BaseType,·BaseType[keyof·BaseType]]; | 5 | export·type·_ObjectEntry<BaseType>·=·[keyof·BaseType,·BaseType[keyof·BaseType]]; |
| 6 | export·type·_SetEntry<BaseType>·=·BaseType·extends·Set<infer·ItemType>·?·[ItemType,·ItemType]·:·never; | 6 | export·type·_SetEntry<BaseType>·=·BaseType·extends·Set<infer·ItemType>·?·[ItemType,·ItemType]·:·never; |
| 7 | /** | 7 | /** |
| 8 | 8 | Create·a·type·that·describes·a·single·key-value·pair·produced·when·calling·a·collection’s·`entries`·method. | |
| 9 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. | 9 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. |
| 10 | @see·`Entries`·if·you·want·to·just·access·the·type·of·the·array·of·entries·(which·is·the·return·of·the·`.entries()`·method). | 10 | @see·`Entries`·if·you·want·to·just·access·the·type·of·the·array·of·entries·(which·is·the·return·of·the·`.entries()`·method). |
| 11 | @example | 11 | @example |
| 12 | ``` | 12 | ``` |
| Offset 1, 1 lines modified | Offset 1, 1 lines modified | ||
| 1 | u | 1 | utf-8 |
| Offset 157, 15 lines modified | Offset 157, 15 lines modified | ||
| 157 | » » » » » ) | 157 | » » » » » ) |
| 158 | » » » » » :·Key·extends·keyof·WithStringKeys<BaseType> | 158 | » » » » » :·Key·extends·keyof·WithStringKeys<BaseType> |
| 159 | » » » » » » ?·StrictPropertyOf<WithStringKeys<BaseType>,·Key,·Options> | 159 | » » » » » » ?·StrictPropertyOf<WithStringKeys<BaseType>,·Key,·Options> |
| 160 | » » » » » » :·unknown; | 160 | » » » » » » :·unknown; |
| 161 | //·This·works·by·first·splitting·the·path·based·on·`.`·and·`[...]`·characters·into·a·tuple·of·string·keys.·Then·it·recursively·uses·the·head·key·to·get·the·next·property·of·the·current·object,·until·there·are·no·keys·left.·Number·keys·extract·the·item·type·from·arrays,·or·are·converted·to·strings·to·extract·types·from·tuples·and·dictionaries·with·number·keys. | 161 | //·This·works·by·first·splitting·the·path·based·on·`.`·and·`[...]`·characters·into·a·tuple·of·string·keys.·Then·it·recursively·uses·the·head·key·to·get·the·next·property·of·the·current·object,·until·there·are·no·keys·left.·Number·keys·extract·the·item·type·from·arrays,·or·are·converted·to·strings·to·extract·types·from·tuples·and·dictionaries·with·number·keys. |
| 162 | /** | 162 | /** |
| 163 | Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·Lodash's·`.get()`·function. | 163 | Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. |
| 164 | Use-case:·Retrieve·a·property·from·deep·inside·an·API·response·or·some·other·complex·object. | 164 | Use-case:·Retrieve·a·property·from·deep·inside·an·API·response·or·some·other·complex·object. |
| 165 | @example | 165 | @example |
| 166 | ``` | 166 | ``` |
| 167 | import·type·{Get}·from·'type-fest'; | 167 | import·type·{Get}·from·'type-fest'; |
| Offset 1, 12 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{PositiveNumericStringGt}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 4 | import·type·{And}·from·'./and.d.ts'; | 4 | import·type·{And}·from·'./and.d.ts'; |
| 5 | import·type·{Or}·from·'./or.d.ts'; | 5 | import·type·{Or}·from·'./or.d.ts'; |
| 6 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 6 | /** | 7 | /** |
| 7 | Returns·a·boolean·for·whether·a·given·number·is·greater·than·another·number. | 8 | Returns·a·boolean·for·whether·a·given·number·is·greater·than·another·number. |
| 8 | @example | 9 | @example |
| 9 | ``` | 10 | ``` |
| 10 | import·type·{GreaterThan}·from·'type-fest'; | 11 | import·type·{GreaterThan}·from·'type-fest'; |
| Offset 78, 14 lines modified | Offset 79, 14 lines modified | ||
| 78 | » » » » » » » » :·[IsNegative<A>,·IsNegative<B>]·extends·infer·R·extends·[boolean,·boolean] | 79 | » » » » » » » » :·[IsNegative<A>,·IsNegative<B>]·extends·infer·R·extends·[boolean,·boolean] |
| 79 | » » » » » » » » » ?·[true,·false]·extends·R | 80 | » » » » » » » » » ?·[true,·false]·extends·R |
| 80 | » » » » » » » » » » ?·false | 81 | » » » » » » » » » » ?·false |
| 81 | » » » » » » » » » » :·[false,·true]·extends·R | 82 | » » » » » » » » » » :·[false,·true]·extends·R |
| 82 | » » » » » » » » » » » ?·true | 83 | » » » » » » » » » » » ?·true |
| 83 | » » » » » » » » » » » :·[false,·false]·extends·R | 84 | » » » » » » » » » » » :·[false,·false]·extends·R |
| 84 | » » » » » » » » » » » » ?·PositiveNumericStringGt<`${A}`,·`${B}`> | 85 | » » » » » » » » » » » » ?·PositiveNumericStringGt<`${A}`,·`${B}`> |
| 85 | » » » » » » » » » » » » :·PositiveNumericStringGt<`${ | 86 | » » » » » » » » » » » » :·PositiveNumericStringGt<`${Absolute<B>}`,·`${Absolute<A>}`> |
| 86 | » » » » » » » » » :·never | 87 | » » » » » » » » » :·never |
| 87 | » » » » » :·never | 88 | » » » » » :·never |
| 88 | » » » :·never·//·Should·never·happen | 89 | » » » :·never·//·Should·never·happen |
| 89 | » » :·never;·//·Should·never·happen | 90 | » » :·never;·//·Should·never·happen |
| 90 | export·{}; | 91 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; | 1 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·optional·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·optional·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·optional·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasOptionalKeys,·OptionalKeysOf}·from·'type-fest'; | 7 | import·type·{HasOptionalKeys,·OptionalKeysOf}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{ReadonlyKeysOf}·from·'./readonly-keys-of.d.ts'; | 1 | import·type·{ReadonlyKeysOf}·from·'./readonly-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·readonly·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·readonly·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·readonly·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasReadonlyKeys,·ReadonlyKeysOf}·from·'type-fest'; | 7 | import·type·{HasReadonlyKeys,·ReadonlyKeysOf}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{RequiredKeysOf}·from·'./required-keys-of.d.ts'; | 1 | import·type·{RequiredKeysOf}·from·'./required-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·required·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·required·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·required·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasRequiredKeys}·from·'type-fest'; | 7 | import·type·{HasRequiredKeys}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{WritableKeysOf}·from·'./writable-keys-of.d.ts'; | 1 | import·type·{WritableKeysOf}·from·'./writable-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·writable·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·writable·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·writable·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasWritableKeys,·WritableKeysOf}·from·'type-fest'; | 7 | import·type·{HasWritableKeys,·WritableKeysOf}·from·'type-fest'; |
| Offset 1, 14 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{IntRange}·from·'./int-range.d.ts'; | 1 | import·type·{IntRange}·from·'./int-range.d.ts'; |
| 2 | import·type·{Sum}·from·'./sum.d.ts'; | 2 | import·type·{Sum}·from·'./sum.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Generate·a·union·of·numbers·between·a·specified·start·and·end·(both·inclusive),·with·an·optional·step. | ||
| 4 | Generate·a·union·of·numbers. | ||
| 5 | The·numbers·are·created·from·the·given·`Start`·(inclusive)·parameter·to·the·given·`End`·(inclusive)·parameter. | ||
| 6 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntClosedRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8·|·10`. | 5 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntClosedRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8·|·10`. |
| 7 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`999`. | 6 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`999`. |
| 8 | Use-cases: | 7 | Use-cases: |
| 9 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: | 8 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: |
| Offset 1, 14 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 2 | import·type·{Subtract}·from·'./subtract.d.ts'; | 2 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Generate·a·union·of·numbers·between·a·specified·start·(inclusive)·and·end·(exclusive),·with·an·optional·step. | ||
| 4 | Generate·a·union·of·numbers. | ||
| 5 | The·numbers·are·created·from·the·given·`Start`·(inclusive)·parameter·to·the·given·`End`·(exclusive)·parameter. | ||
| 6 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8`. | 5 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8`. |
| 7 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`1000`. | 6 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`1000`. |
| 8 | Use-cases: | 7 | Use-cases: |
| 9 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: | 8 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: |
| Offset 52, 17 lines modified | Offset 50, 17 lines modified | ||
| 52 | » End·extends·number, | 50 | » End·extends·number, |
| 53 | » Step·extends·number, | 51 | » Step·extends·number, |
| 54 | » //·The·gap·between·each·number,·gap·=·step·-·1 | 52 | » //·The·gap·between·each·number,·gap·=·step·-·1 |
| 55 | » Gap·extends·number·=·Subtract<Step,·1>, | 53 | » Gap·extends·number·=·Subtract<Step,·1>, |
| 56 | » //·The·final·`List`·is·`[...StartLengthTuple,·...[number,·...GapLengthTuple],·...[number,·...GapLengthTuple],·...·...]`,·so·can·initialize·the·`List`·with·`[...StartLengthTuple]` | 54 | » //·The·final·`List`·is·`[...StartLengthTuple,·...[number,·...GapLengthTuple],·...[number,·...GapLengthTuple],·...·...]`,·so·can·initialize·the·`List`·with·`[...StartLengthTuple]` |
| 57 | » List·extends·unknown[]·=·TupleOf<Start,·never>, | 55 | » List·extends·unknown[]·=·TupleOf<Start,·never>, |
| 58 | » EndLengthTuple·extends·unknown[]·=·TupleOf<End>, | 56 | » EndLengthTuple·extends·unknown[]·=·TupleOf<End>, |
| 59 | >·=·Gap·extends·0 | 57 | >·=·Gap·extends·0 |
| 60 | » //·Handle·the·case·that·without·`Step` | 58 | » //·Handle·the·case·that·without·`Step` |
| 61 | » List['length']·extends·End·//·The·result·of·"List[length]·===·End" | 59 | » ?·List['length']·extends·End·//·The·result·of·"List[length]·===·End" |
| 62 | » » ?·Exclude<List[number],·never>·//·All·unused·elements·are·`never`,·so·exclude·them | 60 | » » ?·Exclude<List[number],·never>·//·All·unused·elements·are·`never`,·so·exclude·them |
| 63 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length']·]> | 61 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length']·]> |
| 64 | » //·Handle·the·case·that·with·`Step` | 62 | » //·Handle·the·case·that·with·`Step` |
| 65 | » :·List·extends·[...(infer·U),·...EndLengthTuple]·//·The·result·of·"List[length]·>=·End",·because·the·`...TupleOf<Gap,·never>`·maybe·make·`List`·too·long. | 63 | » :·List·extends·[...(infer·U),·...EndLengthTuple]·//·The·result·of·"List[length]·>=·End",·because·the·`...TupleOf<Gap,·never>`·maybe·make·`List`·too·long. |
| 66 | » » ?·Exclude<List[number],·never> | 64 | » » ?·Exclude<List[number],·never> |
| 67 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length'],·...TupleOf<Gap,·never>]>; | 65 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length'],·...TupleOf<Gap,·never>]>; |
| Offset 25, 16 lines modified | Offset 25, 16 lines modified | ||
| 25 | type·A·=·[string,·number,·boolean,·...string[]]; | 25 | type·A·=·[string,·number,·boolean,·...string[]]; |
| 26 | type·B·=·StaticPartOfArray<A>; | 26 | type·B·=·StaticPartOfArray<A>; |
| 27 | //=>·[string,·number,·boolean] | 27 | //=>·[string,·number,·boolean] |
| 28 | ``` | 28 | ``` |
| 29 | */ | 29 | */ |
| 30 | export·type·StaticPartOfArray<T·extends·UnknownArray,·Result·extends·UnknownArray·=·[]>·= | 30 | export·type·StaticPartOfArray<T·extends·UnknownArray,·Result·extends·UnknownArray·=·[]>·= |
| 31 | » T·extends·unknown | 31 | » T·extends·unknown |
| 32 | » » ?·number·extends·T['length'] | 32 | » » ?·number·extends·T['length'] |
| 33 | » » » T·extends·readonly·[infer·U,·...infer·V] | 33 | » » » ?·T·extends·readonly·[infer·U,·...infer·V] |
| 34 | » » » » ?·StaticPartOfArray<V,·[...Result,·U]> | 34 | » » » » ?·StaticPartOfArray<V,·[...Result,·U]> |
| 35 | » » » » :·Result | 35 | » » » » :·Result |
| 36 | » » » :·T | 36 | » » » :·T |
| 37 | » » :·never;·//·Should·never·happen | 37 | » » :·never;·//·Should·never·happen |
| 38 | /** | 38 | /** |
| 39 | Returns·the·variable,·non-fixed-length·portion·of·the·given·array,·excluding·static-length·parts. | 39 | Returns·the·variable,·non-fixed-length·portion·of·the·given·array,·excluding·static-length·parts. |
| Offset 65, 19 lines modified | Offset 65, 19 lines modified | ||
| 65 | //=>·readonly·string[] | 65 | //=>·readonly·string[] |
| 66 | type·NormalResult·=·SetArrayAccess<ReadonlyStringArray,·false>; | 66 | type·NormalResult·=·SetArrayAccess<ReadonlyStringArray,·false>; |
| 67 | //=>·string[] | 67 | //=>·string[] |
| 68 | ``` | 68 | ``` |
| 69 | */ | 69 | */ |
| 70 | export·type·SetArrayAccess<T·extends·UnknownArray,·IsReadonly·extends·boolean>·= | 70 | export·type·SetArrayAccess<T·extends·UnknownArray,·IsReadonly·extends·boolean>·= |
| 71 | T·extends·readonly·[...infer·U] | 71 | » T·extends·readonly·[...infer·U] |
| 72 | » IsReadonly·extends·true | 72 | » » ?·IsReadonly·extends·true |
| 73 | » » ?·readonly·[...U] | 73 | » » » ?·readonly·[...U] |
| 74 | » » :·[...U] | 74 | » » » :·[...U] |
| 75 | » :·T; | 75 | » » :·T; |
| 76 | /** | 76 | /** |
| 77 | Returns·whether·the·given·array·`T`·is·readonly. | 77 | Returns·whether·the·given·array·`T`·is·readonly. |
| 78 | */ | 78 | */ |
| 79 | export·type·IsArrayReadonly<T·extends·UnknownArray>·=·If<IsNever<T>,·false,·T·extends·unknown[]·?·false·:·true>; | 79 | export·type·IsArrayReadonly<T·extends·UnknownArray>·=·If<IsNever<T>,·false,·T·extends·unknown[]·?·false·:·true>; |
| 80 | /** | 80 | /** |
| Offset 83, 18 lines modified | Offset 83, 18 lines modified | ||
| 83 | type·Key4·=·ExactKey<Object,·1>; | 83 | type·Key4·=·ExactKey<Object,·1>; |
| 84 | //=>·'1' | 84 | //=>·'1' |
| 85 | ``` | 85 | ``` |
| 86 | @category·Object | 86 | @category·Object |
| 87 | */ | 87 | */ |
| 88 | export·type·ExactKey<T·extends·object,·Key·extends·PropertyKey>·= | 88 | export·type·ExactKey<T·extends·object,·Key·extends·PropertyKey>·= |
| 89 | Key·extends·keyof·T | 89 | » Key·extends·keyof·T |
| 90 | » ?·Key | 90 | » » ?·Key |
| 91 | » :·ToString<Key>·extends·keyof·T | 91 | » » :·ToString<Key>·extends·keyof·T |
| 92 | » » ?·ToString<Key> | 92 | » » » ?·ToString<Key> |
| 93 | » » :·Key·extends·`${infer·NumberKey·extends·number}` | 93 | » » » :·Key·extends·`${infer·NumberKey·extends·number}` |
| 94 | » » » ?·NumberKey·extends·keyof·T | 94 | » » » » ?·NumberKey·extends·keyof·T |
| 95 | » » » » ?·NumberKey | 95 | » » » » » ?·NumberKey |
| 96 | » » » » :·never | 96 | » » » » » :·never |
| 97 | » » » :·never; | 97 | » » » » :·never; |
| 98 | export·{}; | 98 | export·{}; |
| Offset 1, 31 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{IsNever}·from·'../is-never.d.ts'; | 1 | import·type·{IsNever}·from·'../is-never.d.ts'; |
| 2 | import·type·{Finite,·NegativeInfinity,·PositiveInfinity}·from·'../numeric.d.ts'; | 2 | import·type·{Finite,·NegativeInfinity,·PositiveInfinity}·from·'../numeric.d.ts'; |
| 3 | import·type·{UnknownArray}·from·'../unknown-array.d.ts'; | 3 | import·type·{UnknownArray}·from·'../unknown-array.d.ts'; |
| 4 | import·type·{StringToNumber}·from·'./string.d.ts'; | ||
| 5 | import·type·{IfNotAnyOrNever,·IsAnyOrNever}·from·'./type.d.ts'; | 4 | import·type·{IfNotAnyOrNever,·IsAnyOrNever}·from·'./type.d.ts'; |
| 6 | /** | 5 | /** |
| 7 | Returns·the·absolute·value·of·a·given·value. | ||
| 8 | @example | ||
| 9 | ``` | ||
| 10 | type·A·=·NumberAbsolute<-1>; | ||
| 11 | //=>·1 | ||
| 12 | type·B·=·NumberAbsolute<1>; | ||
| 13 | //=>·1 | ||
| 14 | type·C·=·NumberAbsolute<NegativeInfinity>; | ||
| 15 | //=>·PositiveInfinity | ||
| 16 | ``` | ||
| 17 | */ | ||
| 18 | export·type·NumberAbsolute<N·extends·number>·=·`${N}`·extends·`-${infer·StringPositiveN}`·?·StringToNumber<StringPositiveN>·:·N; | ||
| 19 | /** | ||
| 20 | Check·whether·the·given·type·is·a·number·or·a·number·string. | 6 | Check·whether·the·given·type·is·a·number·or·a·number·string. |
| 21 | Supports·floating-point·as·a·string. | 7 | Supports·floating-point·as·a·string. |
| 22 | @example | 8 | @example |
| 23 | ``` | 9 | ``` |
| 24 | type·A·=·IsNumberLike<'1'>; | 10 | type·A·=·IsNumberLike<'1'>; |
| Offset 138, 14 lines modified | Offset 120, 22 lines modified | ||
| 138 | type·D·=·ReverseSign<PositiveInfinity>; | 120 | type·D·=·ReverseSign<PositiveInfinity>; |
| 139 | //=>·NegativeInfinity | 121 | //=>·NegativeInfinity |
| 140 | ``` | 122 | ``` |
| 141 | */ | 123 | */ |
| 142 | export·type·ReverseSign<N·extends·number>·= | 124 | export·type·ReverseSign<N·extends·number>·= |
| 143 | » //·Handle·edge·cases | 125 | » //·Handle·edge·cases |
| 144 | » N·extends·0 | 126 | » N·extends·0 |
| 127 | » » ?·0 | ||
| 128 | » » :·N·extends·PositiveInfinity | ||
| 129 | » » » ?·NegativeInfinity | ||
| 130 | » » » :·N·extends·NegativeInfinity | ||
| 131 | » » » » ?·PositiveInfinity | ||
| 145 | » //·Handle·negative·numbers | 132 | » » » » //·Handle·negative·numbers |
| 146 | » `${N}`·extends·`-${infer·P·extends·number}` | 133 | » » » » :·`${N}`·extends·`-${infer·P·extends·number}` |
| 134 | » » » » » ?·P | ||
| 147 | » » //·Handle·positive·numbers | 135 | » » » » » //·Handle·positive·numbers |
| 148 | » » :·`-${N}`·extends·`${infer·R·extends·number}` | 136 | » » » » » :·`-${N}`·extends·`${infer·R·extends·number}` |
| 137 | » » » » » » ?·R | ||
| 138 | » » » » » » :·never; | ||
| 149 | export·{}; | 139 | export·{}; |
| Offset 42, 16 lines modified | Offset 42, 16 lines modified | ||
| 42 | //=>·5 | 42 | //=>·5 |
| 43 | type·B·=·TupleMax<[1,·2,·5,·3,·99,·-1]>; | 43 | type·B·=·TupleMax<[1,·2,·5,·3,·99,·-1]>; |
| 44 | //=>·99 | 44 | //=>·99 |
| 45 | ``` | 45 | ``` |
| 46 | */ | 46 | */ |
| 47 | export·type·TupleMax<A·extends·number[],·Result·extends·number·=·NegativeInfinity>·=·number·extends·A[number] | 47 | export·type·TupleMax<A·extends·number[],·Result·extends·number·=·NegativeInfinity>·=·number·extends·A[number] |
| 48 | » ?·never | 48 | » ?·never |
| 49 | » A·extends·[infer·F·extends·number,·...infer·R·extends·number[]] | 49 | » :·A·extends·[infer·F·extends·number,·...infer·R·extends·number[]] |
| 50 | » » ?·GreaterThan<F,·Result>·extends·true | 50 | » » ?·GreaterThan<F,·Result>·extends·true |
| 51 | » » » ?·TupleMax<R,·F> | 51 | » » » ?·TupleMax<R,·F> |
| 52 | » » » :·TupleMax<R,·Result> | 52 | » » » :·TupleMax<R,·Result> |
| 53 | » » :·Result; | 53 | » » :·Result; |
| 54 | /** | 54 | /** |
| 55 | Returns·the·minimum·value·from·a·tuple·of·integers. | 55 | Returns·the·minimum·value·from·a·tuple·of·integers. |
| Offset 43, 18 lines modified | Offset 43, 18 lines modified | ||
| 43 | //=>·false | 43 | //=>·false |
| 44 | ``` | 44 | ``` |
| 45 | @category·Type·Guard | 45 | @category·Type·Guard |
| 46 | @category·Numeric | 46 | @category·Numeric |
| 47 | */ | 47 | */ |
| 48 | export·type·IsInteger<T>·= | 48 | export·type·IsInteger<T>·= |
| 49 | T·extends·bigint | 49 | » T·extends·bigint |
| 50 | » ?·true | 50 | » » ?·true |
| 51 | » :·T·extends·number | 51 | » » :·T·extends·number |
| 52 | » » ?·number·extends·T | 52 | » » » ?·number·extends·T |
| 53 | » » » ?·false | ||
| 54 | » » » :·T·extends·PositiveInfinity·|·NegativeInfinity | ||
| 55 | » » » » ?·false | 53 | » » » » ?·false |
| 54 | » » » » :·T·extends·PositiveInfinity·|·NegativeInfinity | ||
| 55 | » » » » » ?·false | ||
| 56 | » » » » :·Not<IsFloat<T>> | 56 | » » » » » :·Not<IsFloat<T>> |
| 57 | » » :·false; | 57 | » » » :·false; |
| 58 | export·{}; | 58 | export·{}; |
| Offset 117, 19 lines modified | Offset 117, 19 lines modified | ||
| 117 | export·type·IsStringLiteral<S>·=·IfNotAnyOrNever<S, | 117 | export·type·IsStringLiteral<S>·=·IfNotAnyOrNever<S, |
| 118 | » _IsStringLiteral<CollapseLiterals<S·extends·TagContainer<any>·?·UnwrapTagged<S>·:·S>>, | 118 | » _IsStringLiteral<CollapseLiterals<S·extends·TagContainer<any>·?·UnwrapTagged<S>·:·S>>, |
| 119 | » false,·false>; | 119 | » false,·false>; |
| 120 | export·type·_IsStringLiteral<S>·= | 120 | export·type·_IsStringLiteral<S>·= |
| 121 | //·If·`T`·is·an·infinite·string·type·(e.g.,·`on${string}`),·`Record<T,·never>`·produces·an·index·signature, | 121 | //·If·`T`·is·an·infinite·string·type·(e.g.,·`on${string}`),·`Record<T,·never>`·produces·an·index·signature, |
| 122 | //·and·since·`{}`·extends·index·signatures,·the·result·becomes·`false`. | 122 | //·and·since·`{}`·extends·index·signatures,·the·result·becomes·`false`. |
| 123 | S·extends·string | 123 | » S·extends·string |
| 124 | » ?·{}·extends·Record<S,·never> | 124 | » » ?·{}·extends·Record<S,·never> |
| 125 | » » ?·false | 125 | » » » ?·false |
| 126 | » » :·true | 126 | » » » :·true |
| 127 | » :·false; | 127 | » » :·false; |
| 128 | /** | 128 | /** |
| 129 | Returns·a·boolean·for·whether·the·given·type·is·a·`number`·or·`bigint`·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). | 129 | Returns·a·boolean·for·whether·the·given·type·is·a·`number`·or·`bigint`·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). |
| 130 | Useful·for: | 130 | Useful·for: |
| 131 | » -·providing·strongly-typed·functions·when·given·literal·arguments | 131 | » -·providing·strongly-typed·functions·when·given·literal·arguments |
| 132 | » -·type·utilities,·such·as·when·constructing·parsers·and·ASTs | 132 | » -·type·utilities,·such·as·when·constructing·parsers·and·ASTs |
| Offset 17, 24 lines modified | Offset 17, 24 lines modified | ||
| 17 | */ | 17 | */ |
| 18 | export·type·IsUnion<T>·=·InternalIsUnion<T>; | 18 | export·type·IsUnion<T>·=·InternalIsUnion<T>; |
| 19 | /** | 19 | /** |
| 20 | The·actual·implementation·of·`IsUnion`. | 20 | The·actual·implementation·of·`IsUnion`. |
| 21 | */ | 21 | */ |
| 22 | type·InternalIsUnion<T,·U·=·T>·= | 22 | type·InternalIsUnion<T,·U·=·T>·= |
| 23 | ( | 23 | » ( |
| 24 | » IsNever<T>·extends·true | 24 | » » IsNever<T>·extends·true |
| 25 | » » ?·false | 25 | » » » ?·false |
| 26 | » » :·T·extends·any | 26 | » » » :·T·extends·any |
| 27 | » » » ?·IsEqual<U,·T>·extends·true | 27 | » » » » ?·IsEqual<U,·T>·extends·true |
| 28 | » » » » ?·false | 28 | » » » » » ?·false |
| 29 | » » » » :·true | 29 | » » » » » :·true |
| 30 | » » » :·never | 30 | » » » » :·never |
| 31 | )·extends·infer·Result | 31 | » )·extends·infer·Result |
| 32 | » //·In·some·cases·`Result`·will·return·`false·|·true`·which·is·`boolean`, | 32 | » //·In·some·cases·`Result`·will·return·`false·|·true`·which·is·`boolean`, |
| 33 | » //·that·means·`T`·has·at·least·two·types·and·it's·a·union·type, | 33 | » //·that·means·`T`·has·at·least·two·types·and·it's·a·union·type, |
| 34 | » //·so·we·will·return·`true`·instead·of·`boolean`. | 34 | » //·so·we·will·return·`true`·instead·of·`boolean`. |
| 35 | » ?·boolean·extends·Result·?·true | 35 | » » ?·boolean·extends·Result·?·true |
| 36 | » » :·Result | 36 | » » » :·Result |
| 37 | » :·never;·//·Should·never·happen | 37 | » » :·never;·//·Should·never·happen |
| 38 | export·{}; | 38 | export·{}; |
| Offset 53, 14 lines modified | Offset 53, 14 lines modified | ||
| 53 | type·Fruit·=·IterableElement<typeof·fruits>; | 53 | type·Fruit·=·IterableElement<typeof·fruits>; |
| 54 | //=>·'🍎'·|·'🍌'·|·'🍉' | 54 | //=>·'🍎'·|·'🍌'·|·'🍉' |
| 55 | ``` | 55 | ``` |
| 56 | @category·Iterable | 56 | @category·Iterable |
| 57 | */ | 57 | */ |
| 58 | export·type·IterableElement<TargetIterable>·= | 58 | export·type·IterableElement<TargetIterable>·= |
| 59 | » TargetIterable·extends·Iterable<infer·ElementType> | 59 | » TargetIterable·extends·Iterable<infer·ElementType> |
| 60 | » » ElementType | 60 | » » ?·ElementType |
| 61 | » » TargetIterable·extends·AsyncIterable<infer·ElementType> | 61 | » » :·TargetIterable·extends·AsyncIterable<infer·ElementType> |
| 62 | » » » ElementType | 62 | » » » ?·ElementType |
| 63 | » » » never; | 63 | » » » :·never; |
| 64 | export·{}; | 64 | export·{}; |
| Offset 94, 21 lines modified | Offset 94, 21 lines modified | ||
| 94 | */ | 94 | */ |
| 95 | export·type·Jsonify<T>·=·IsAny<T>·extends·true | 95 | export·type·Jsonify<T>·=·IsAny<T>·extends·true |
| 96 | » ?·any | 96 | » ?·any |
| 97 | » :·T·extends·PositiveInfinity·|·NegativeInfinity | 97 | » :·T·extends·PositiveInfinity·|·NegativeInfinity |
| 98 | » » ?·null | 98 | » » ?·null |
| 99 | » » :·T·extends·JsonPrimitive | 99 | » » :·T·extends·JsonPrimitive |
| 100 | » » » ?·T | 100 | » » » ?·T |
| 101 | » » » | 101 | » » » //·Any·object·with·toJSON·is·special·case |
| 102 | » » » T·extends·{toJSON():·infer·J} | 102 | » » » :·T·extends·{toJSON():·infer·J} |
| 103 | » » » » ?·(()·=>·J)·extends·()·=>·JsonValue·//·Is·J·assignable·to·JsonValue? | 103 | » » » » ?·(()·=>·J)·extends·()·=>·JsonValue·//·Is·J·assignable·to·JsonValue? |
| 104 | » » » » » ?·J·//·Then·T·is·Jsonable·and·its·Jsonable·value·is·J | 104 | » » » » » ?·J·//·Then·T·is·Jsonable·and·its·Jsonable·value·is·J |
| 105 | » » » » » :·Jsonify<J>·//·Maybe·if·we·look·a·level·deeper·we'll·find·a·JsonValue | 105 | » » » » » :·Jsonify<J>·//·Maybe·if·we·look·a·level·deeper·we'll·find·a·JsonValue |
| 106 | » » » » | 106 | » » » » //·Instanced·primitives·are·objects |
| 107 | » » » » T·extends·Number | 107 | » » » » :·T·extends·Number |
| 108 | » » » » » ?·number | 108 | » » » » » ?·number |
| 109 | » » » » » :·T·extends·String | 109 | » » » » » :·T·extends·String |
| 110 | » » » » » » ?·string | 110 | » » » » » » ?·string |
| 111 | » » » » » » :·T·extends·Boolean | 111 | » » » » » » :·T·extends·Boolean |
| 112 | » » » » » » » ?·boolean | 112 | » » » » » » » ?·boolean |
| 113 | » » » » » » » :·T·extends·Map<any,·any>·|·Set<any> | 113 | » » » » » » » :·T·extends·Map<any,·any>·|·Set<any> |
| 114 | » » » » » » » » ?·EmptyObject | 114 | » » » » » » » » ?·EmptyObject |
| Offset 11, 14 lines modified | Offset 11, 15 lines modified | ||
| 11 | ``` | 11 | ``` |
| 12 | import·type·{KebabCase}·from·'type-fest'; | 12 | import·type·{KebabCase}·from·'type-fest'; |
| 13 | //·Simple | 13 | //·Simple |
| 14 | const·someVariable:·KebabCase<'fooBar'>·=·'foo-bar'; | 14 | const·someVariable:·KebabCase<'fooBar'>·=·'foo-bar'; |
| 15 | const·someVariableNoSplitOnNumbers:·KebabCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'p2p-network'; | 15 | const·someVariableNoSplitOnNumbers:·KebabCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'p2p-network'; |
| 16 | const·someVariableWithPunctuation:·KebabCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'div-card-after'; | ||
| 16 | //·Advanced | 17 | //·Advanced |
| 17 | type·KebabCasedProperties<T>·=·{ | 18 | type·KebabCasedProperties<T>·=·{ |
| 18 | » [K·in·keyof·T·as·KebabCase<K>]:·T[K] | 19 | » [K·in·keyof·T·as·KebabCase<K>]:·T[K] |
| 19 | }; | 20 | }; |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » 'line-2':·[ | 47 | » » 'line-2':·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » 'line-3':·'string', | 49 | » » » » 'line-3':·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·KebabCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user-info':·{ | ||
| 56 | » » 'user-id':·1, | ||
| 57 | » » 'user-name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·KebabCasedPropertiesDeep< | 65 | export·type·KebabCasedPropertiesDeep< |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; | 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; |
| 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·kebab·ca | 6 | Convert·top-level·object·properties·to·kebab·case. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·KebabCase} | 8 | @see·{@link·KebabCase} |
| 9 | @see·{@link·KebabCasedPropertiesDeep} | 9 | @see·{@link·KebabCasedPropertiesDeep} |
| 10 | @example | 10 | @example |
| Offset 24, 14 lines modified | Offset 24, 18 lines modified | ||
| 24 | » 'user-id':·1, | 24 | » 'user-id':·1, |
| 25 | » 'user-name':·'Tom', | 25 | » 'user-name':·'Tom', |
| 26 | }; | 26 | }; |
| 27 | const·splitOnNumbers:·KebabCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ | 27 | const·splitOnNumbers:·KebabCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ |
| 28 | » 'line-1':·'string', | 28 | » 'line-1':·'string', |
| 29 | }; | 29 | }; |
| 30 | const·splitOnPunctuation:·KebabCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 31 | » 'foo-bar':·'string', | ||
| 32 | }; | ||
| 30 | ``` | 33 | ``` |
| 31 | @category·Change·case | 34 | @category·Change·case |
| 32 | @category·Template·literal | 35 | @category·Template·literal |
| 33 | @category·Object | 36 | @category·Object |
| 34 | */ | 37 | */ |
| 35 | export·type·KebabCasedProperties< | 38 | export·type·KebabCasedProperties< |
| Offset 34, 11 lines modified | Offset 34, 11 lines modified | ||
| 34 | type·AllKeys·=·KeysOfUnion<Union>; | 34 | type·AllKeys·=·KeysOfUnion<Union>; |
| 35 | //=>·'common'·|·'a'·|·'b'·|·'c' | 35 | //=>·'common'·|·'a'·|·'b'·|·'c' |
| 36 | ``` | 36 | ``` |
| 37 | @category·Object | 37 | @category·Object |
| 38 | */ | 38 | */ |
| 39 | export·type·KeysOfUnion<ObjectType>·= | 39 | export·type·KeysOfUnion<ObjectType>·= |
| 40 | 40 | » //·Hack·to·fix·https://github.com/sindresorhus/type-fest/issues/1008 | |
| 41 | 41 | » keyof·UnionToIntersection<ObjectType·extends·unknown·?·Record<keyof·ObjectType,·never>·:·never>; | |
| 42 | export·{}; | 42 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{GreaterThan}·from·'./greater-than.d.ts'; | 1 | import·type·{GreaterThan}·from·'./greater-than.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·a·given·number·is·less·than·or·equal·to·another·number. | |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{LessThanOrEqual}·from·'type-fest'; | 6 | import·type·{LessThanOrEqual}·from·'type-fest'; |
| 7 | type·A·=·LessThanOrEqual<1,·-5>; | 7 | type·A·=·LessThanOrEqual<1,·-5>; |
| 8 | //=>·false | 8 | //=>·false |
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the· | 2 | Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the·[primitive·type](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)·it·belongs·to,·or·`never`·if·it's·not·a·primitive. |
| 3 | Use-case:·Working·with·generic·types·that·may·be·literal·types. | 3 | Use-case:·Working·with·generic·types·that·may·be·literal·types. |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{LiteralToPrimitive}·from·'type-fest'; | 6 | import·type·{LiteralToPrimitive}·from·'type-fest'; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Primitive}·from·'./primitive.d.ts'; | 1 | import·type·{Primitive}·from·'./primitive.d.ts'; |
| 2 | export·type·_LiteralStringUnion<T>·=·LiteralUnion<T,·string>; | 2 | export·type·_LiteralStringUnion<T>·=·LiteralUnion<T,·string>; |
| 3 | /** | 3 | /** |
| 4 | 4 | Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. | |
| 5 | Currently,·when·a·union·type·of·a·primitive·type·is·combined·with·literal·types,·TypeScript·loses·all·information·about·the·combined·literals.·Thus,·when·such·type·is·used·in·an·IDE·with·autocompletion,·no·suggestions·are·made·for·the·declared·literals. | 5 | Currently,·when·a·union·type·of·a·primitive·type·is·combined·with·literal·types,·TypeScript·loses·all·information·about·the·combined·literals.·Thus,·when·such·type·is·used·in·an·IDE·with·autocompletion,·no·suggestions·are·made·for·the·declared·literals. |
| 6 | This·type·is·a·workaround·for·[Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).·It·will·be·removed·as·soon·as·it's·not·needed·anymore. | 6 | This·type·is·a·workaround·for·[Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).·It·will·be·removed·as·soon·as·it's·not·needed·anymore. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| Offset 34, 12 lines modified | Offset 34, 12 lines modified | ||
| 34 | exclusiveOptions·=·{exclusive1:·true,·exclusive2:·'hi'}; | 34 | exclusiveOptions·=·{exclusive1:·true,·exclusive2:·'hi'}; |
| 35 | //·Error | 35 | //·Error |
| 36 | ``` | 36 | ``` |
| 37 | @category·Object | 37 | @category·Object |
| 38 | */ | 38 | */ |
| 39 | export·type·MergeExclusive<FirstType,·SecondType>·= | 39 | export·type·MergeExclusive<FirstType,·SecondType>·= |
| 40 | » (FirstType·|·SecondType)·extends·object | 40 | » (FirstType·|·SecondType)·extends·object |
| 41 | » » (Without<FirstType,·SecondType>·&·SecondType)·|·(Without<SecondType,·FirstType>·&·FirstType) | 41 | » » ?·(Without<FirstType,·SecondType>·&·SecondType)·|·(Without<SecondType,·FirstType>·&·FirstType) |
| 42 | » » FirstType·|·SecondType; | 42 | » » :·FirstType·|·SecondType; |
| 43 | export·{}; | 43 | export·{}; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{Subtract}·from·'./subtract.d.ts'; | 1 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | type·Recursive<T>·=·Array<Recursive<T>>; | 3 | type·Recursive<T>·=·Array<Recursive<T>>; |
| 4 | /** | 4 | /** |
| 5 | Create | 5 | Create·a·type·that·represents·a·multidimensional·array·of·the·given·type·and·dimension. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Return·a·n-dimensional·array·from·functions. | 7 | -·Return·a·n-dimensional·array·from·functions. |
| 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. | 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. |
| 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. | 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. |
| 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. | 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{Subtract}·from·'./subtract.d.ts'; | 1 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | type·Recursive<T>·=·ReadonlyArray<Recursive<T>>; | 3 | type·Recursive<T>·=·ReadonlyArray<Recursive<T>>; |
| 4 | /** | 4 | /** |
| 5 | Create | 5 | Create·a·type·that·represents·a·multidimensional·readonly·array·of·the·given·type·and·dimension. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Return·a·n-dimensional·array·from·functions. | 7 | -·Return·a·n-dimensional·array·from·functions. |
| 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. | 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. |
| 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. | 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. |
| 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. | 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. |
| Offset 117, 17 lines modified | Offset 117, 17 lines modified | ||
| 117 | ``` | 117 | ``` |
| 118 | @see·{@link·Integer} | 118 | @see·{@link·Integer} |
| 119 | @category·Numeric | 119 | @category·Numeric |
| 120 | */ | 120 | */ |
| 121 | export·type·Float<T>·= | 121 | export·type·Float<T>·= |
| 122 | T·extends·unknown·//·To·distributive·type | 122 | » T·extends·unknown·//·To·distributive·type |
| 123 | » ?·IsFloat<T>·extends·true·?·T·:·never | 123 | » » ?·IsFloat<T>·extends·true·?·T·:·never |
| 124 | » :·never;·//·Never·happens | 124 | » » :·never;·//·Never·happens |
| 125 | /** | 125 | /** |
| 126 | A·negative·(`-∞·<·x·<·0`)·`number`·that·is·not·an·integer. | 126 | A·negative·(`-∞·<·x·<·0`)·`number`·that·is·not·an·integer. |
| 127 | Equivalent·to·`Negative<Float<T>>`. | 127 | Equivalent·to·`Negative<Float<T>>`. |
| 128 | Use-case:·Validating·and·documenting·parameters. | 128 | Use-case:·Validating·and·documenting·parameters. |
| Offset 13, 15 lines modified | Offset 13, 15 lines modified | ||
| 13 | It·supports·recursing·into·arrays. | 13 | It·supports·recursing·into·arrays. |
| 14 | It·supports·removing·specific·items·from·an·array,·replacing·each·removed·item·with·unknown·at·the·specified·index. | 14 | It·supports·removing·specific·items·from·an·array,·replacing·each·removed·item·with·unknown·at·the·specified·index. |
| 15 | Use-case:·Remove·unneeded·parts·of·complex·objects. | 15 | Use-case:·Remove·unneeded·parts·of·complex·objects. |
| 16 | Use·[`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)·if·you·only·need·one·level·deep. | 16 | Use·[`Omit<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)·if·you·only·need·one·level·deep. |
| 17 | @example | 17 | @example |
| 18 | ``` | 18 | ``` |
| 19 | import·type·{OmitDeep}·from·'type-fest'; | 19 | import·type·{OmitDeep}·from·'type-fest'; |
| 20 | type·Info·=·{ | 20 | type·Info·=·{ |
| 21 | » userInfo:·{ | 21 | » userInfo:·{ |
| Offset 89, 42 lines modified | Offset 89, 42 lines modified | ||
| 89 | » » ?·OmitDeepHelper<OmitDeepWithOnePath<T,·Path·&·(string·|·number)>,·RestPaths> | 89 | » » ?·OmitDeepHelper<OmitDeepWithOnePath<T,·Path·&·(string·|·number)>,·RestPaths> |
| 90 | » » :·T; | 90 | » » :·T; |
| 91 | /** | 91 | /** |
| 92 | Omit·one·path·from·the·given·object/array. | 92 | Omit·one·path·from·the·given·object/array. |
| 93 | */ | 93 | */ |
| 94 | type·OmitDeepWithOnePath<T,·Path·extends·string·|·number>·= | 94 | type·OmitDeepWithOnePath<T,·Path·extends·string·|·number>·= |
| 95 | T·extends·NonRecursiveType | 95 | » T·extends·NonRecursiveType |
| 96 | » ?·T | 96 | » » ?·T |
| 97 | » :·T·extends·UnknownArray·?·SetArrayAccess<OmitDeepArrayWithOnePath<T,·Path>,·IsArrayReadonly<T>> | 97 | » » :·T·extends·UnknownArray·?·SetArrayAccess<OmitDeepArrayWithOnePath<T,·Path>,·IsArrayReadonly<T>> |
| 98 | » » :·T·extends·object·?·OmitDeepObjectWithOnePath<T,·Path> | 98 | » » » :·T·extends·object·?·OmitDeepObjectWithOnePath<T,·Path> |
| 99 | » » » :·T; | 99 | » » » » :·T; |
| 100 | /** | 100 | /** |
| 101 | Omit·one·path·from·the·given·object. | 101 | Omit·one·path·from·the·given·object. |
| 102 | */ | 102 | */ |
| 103 | type·OmitDeepObjectWithOnePath<ObjectT·extends·object,·P·extends·string·|·number>·= | 103 | type·OmitDeepObjectWithOnePath<ObjectT·extends·object,·P·extends·string·|·number>·= |
| 104 | P·extends·`${infer·RecordKeyInPath}.${infer·SubPath}` | 104 | » P·extends·`${infer·RecordKeyInPath}.${infer·SubPath}` |
| 105 | » ?·{ | 105 | » » ?·{ |
| 106 | » » [Key·in·keyof·ObjectT]: | 106 | » » » [Key·in·keyof·ObjectT]: |
| 107 | » » IsEqual<RecordKeyInPath,·ToString<Key>>·extends·true | 107 | » » » IsEqual<RecordKeyInPath,·ToString<Key>>·extends·true |
| 108 | » » » ?·ExactKey<ObjectT,·Key>·extends·infer·RealKey | 108 | » » » » ?·ExactKey<ObjectT,·Key>·extends·infer·RealKey |
| 109 | » » » » ?·RealKey·extends·keyof·ObjectT | 109 | » » » » » ?·RealKey·extends·keyof·ObjectT |
| 110 | » » » » » ?·OmitDeepWithOnePath<ObjectT[RealKey],·SubPath> | 110 | » » » » » » ?·OmitDeepWithOnePath<ObjectT[RealKey],·SubPath> |
| 111 | » » » » » » :·ObjectT[Key] | ||
| 111 | » » » » » :·ObjectT[Key] | 112 | » » » » » :·ObjectT[Key] |
| 112 | » » » » :·ObjectT[Key] | 113 | » » » » :·ObjectT[Key] |
| 113 | » » » :·ObjectT[Key] | ||
| 114 | » } | 114 | » » } |
| 115 | » :·ExactKey<ObjectT,·P>·extends·infer·Key | 115 | » » :·ExactKey<ObjectT,·P>·extends·infer·Key |
| 116 | » » ?·IsNever<Key>·extends·true | 116 | » » » ?·IsNever<Key>·extends·true |
| 117 | » » » ?·ObjectT | 117 | » » » » ?·ObjectT |
| 118 | » » » :·Key·extends·PropertyKey | 118 | » » » » :·Key·extends·PropertyKey |
| 119 | » » » » ?·Omit<ObjectT,·Key> | 119 | » » » » » ?·Omit<ObjectT,·Key> |
| 120 | » » » » :·ObjectT | 120 | » » » » » :·ObjectT |
| 121 | » » :·ObjectT; | 121 | » » » :·ObjectT; |
| 122 | /** | 122 | /** |
| 123 | Omit·one·path·from·from·the·given·array. | 123 | Omit·one·path·from·from·the·given·array. |
| 124 | It·replaces·the·item·to·`unknown`·at·the·given·index. | 124 | It·replaces·the·item·to·`unknown`·at·the·given·index. |
| 125 | @example | 125 | @example |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{OrAll}·from·'./or-all.d.ts'; | 1 | import·type·{OrAll}·from·'./or-all.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | Returns·a·boolean·for·whether·either·of·two·given·types·is·true. | 3 | Returns·a·boolean·for·whether·either·of·two·given·types·is·`true`. |
| 4 | Use-case:·Constructing·complex·conditional·types·where·at·least·one·condition·must·be·satisfied. | 4 | Use-case:·Constructing·complex·conditional·types·where·at·least·one·condition·must·be·satisfied. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{Or}·from·'type-fest'; | 7 | import·type·{Or}·from·'type-fest'; |
| Offset 695, 16 lines modified | Offset 695, 16 lines modified | ||
| 695 | /** | 695 | /** |
| 696 | Type·for·[npm's·`package.json`·file](https://docs.npmjs.com/creating-a-package-json-file).·Also·includes·types·for·fields·used·by·other·popular·projects,·like·TypeScript·and·Yarn. | 696 | Type·for·[npm's·`package.json`·file](https://docs.npmjs.com/creating-a-package-json-file).·Also·includes·types·for·fields·used·by·other·popular·projects,·like·TypeScript·and·Yarn. |
| 697 | @category·File | 697 | @category·File |
| 698 | */ | 698 | */ |
| 699 | export·type·PackageJson·= | 699 | export·type·PackageJson·= |
| 700 | » JsonObject | 700 | » JsonObject |
| 701 | » PackageJson.NodeJsStandard | 701 | » &·PackageJson.NodeJsStandard |
| 702 | » PackageJson.PackageJsonStandard | 702 | » &·PackageJson.PackageJsonStandard |
| 703 | » PackageJson.NonStandardEntryPoints | 703 | » &·PackageJson.NonStandardEntryPoints |
| 704 | » PackageJson.TypeScriptConfiguration | 704 | » &·PackageJson.TypeScriptConfiguration |
| 705 | » PackageJson.YarnConfiguration | 705 | » &·PackageJson.YarnConfiguration |
| 706 | » PackageJson.JSPMConfiguration; | 706 | » &·PackageJson.JSPMConfiguration; |
| 707 | export·{}; | 707 | export·{}; |
| Offset 40, 20 lines modified | Offset 40, 22 lines modified | ||
| 40 | type·DefaultPartialDeepOptions·=·{ | 40 | type·DefaultPartialDeepOptions·=·{ |
| 41 | » recurseIntoArrays:·false; | 41 | » recurseIntoArrays:·false; |
| 42 | » allowUndefinedInNonTupleArrays:·false; | 42 | » allowUndefinedInNonTupleArrays:·false; |
| 43 | }; | 43 | }; |
| 44 | /** | 44 | /** |
| 45 | Create·a· | 45 | Create·a·deeply·optional·version·of·another·type. |
| 46 | Use-cases: | 46 | Use-cases: |
| 47 | -·Merging·a·default·settings/config·object·with·another·object,·the·second·object·would·be·a·deep·partial·of·the·default·object. | 47 | -·Merging·a·default·settings/config·object·with·another·object,·the·second·object·would·be·a·deep·partial·of·the·default·object. |
| 48 | -·Mocking·and·testing·complex·entities,·where·populating·an·entire·object·with·its·keys·would·be·redundant·in·terms·of·the·mock·or·test. | 48 | -·Mocking·and·testing·complex·entities,·where·populating·an·entire·object·with·its·keys·would·be·redundant·in·terms·of·the·mock·or·test. |
| 49 | Use·[`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)·if·you·only·need·one·level·deep. | ||
| 49 | @example | 50 | @example |
| 50 | ``` | 51 | ``` |
| 51 | import·type·{PartialDeep}·from·'type-fest'; | 52 | import·type·{PartialDeep}·from·'type-fest'; |
| 52 | let·settings·=·{ | 53 | let·settings·=·{ |
| 53 | » textEditor:·{ | 54 | » textEditor:·{ |
| 54 | » » fontSize:·14, | 55 | » » fontSize:·14, |
| Offset 8, 14 lines modified | Offset 8, 15 lines modified | ||
| 8 | ``` | 8 | ``` |
| 9 | import·type·{PascalCase}·from·'type-fest'; | 9 | import·type·{PascalCase}·from·'type-fest'; |
| 10 | //·Simple | 10 | //·Simple |
| 11 | const·someVariable:·PascalCase<'foo-bar'>·=·'FooBar'; | 11 | const·someVariable:·PascalCase<'foo-bar'>·=·'FooBar'; |
| 12 | const·preserveConsecutiveUppercase:·PascalCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'FooBARBaz'; | 12 | const·preserveConsecutiveUppercase:·PascalCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'FooBARBaz'; |
| 13 | const·splitOnPunctuation:·PascalCase<'foo-bar>>baz',·{splitOnPunctuation:·true}>·=·'FooBarBaz'; | ||
| 13 | //·Advanced | 14 | //·Advanced |
| 14 | type·PascalCasedProperties<T>·=·{ | 15 | type·PascalCasedProperties<T>·=·{ |
| 15 | » [K·in·keyof·T·as·PascalCase<K>]:·T[K] | 16 | » [K·in·keyof·T·as·PascalCase<K>]:·T[K] |
| 16 | }; | 17 | }; |
| Offset 44, 14 lines modified | Offset 44, 21 lines modified | ||
| 44 | const·preserveConsecutiveUppercase:·PascalCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ | 44 | const·preserveConsecutiveUppercase:·PascalCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 45 | » FooBAR:·{ | 45 | » FooBAR:·{ |
| 46 | » » FooBARBiz:·[{ | 46 | » » FooBARBiz:·[{ |
| 47 | » » » FooBARBaz:·'string', | 47 | » » » FooBARBaz:·'string', |
| 48 | » » }], | 48 | » » }], |
| 49 | » }, | 49 | » }, |
| 50 | }; | 50 | }; |
| 51 | const·splitOnPunctuation:·PascalCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 52 | » UserInfo:·{ | ||
| 53 | » » UserId:·1, | ||
| 54 | » » UserName:·'Tom', | ||
| 55 | » }, | ||
| 56 | }; | ||
| 51 | ``` | 57 | ``` |
| 52 | @category·Change·case | 58 | @category·Change·case |
| 53 | @category·Template·literal | 59 | @category·Template·literal |
| 54 | @category·Object | 60 | @category·Object |
| 55 | */ | 61 | */ |
| 56 | export·type·PascalCasedPropertiesDeep<Value,·Options·extends·CamelCaseOptions·=·{}>·= | 62 | export·type·PascalCasedPropertiesDeep<Value,·Options·extends·CamelCaseOptions·=·{}>·= |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; | 1 | import·type·{CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | import·type·{PascalCase}·from·'./pascal-case.d.ts'; | 3 | import·type·{PascalCase}·from·'./pascal-case.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Convert·object·properties·to·pascal·ca | 5 | Convert·top-level·object·properties·to·pascal·case. |
| 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 7 | @see·{@link·PascalCase} | 7 | @see·{@link·PascalCase} |
| 8 | @see·{@link·PascalCasedPropertiesDeep} | 8 | @see·{@link·PascalCasedPropertiesDeep} |
| 9 | @example | 9 | @example |
| Offset 23, 14 lines modified | Offset 23, 18 lines modified | ||
| 23 | » UserId:·1, | 23 | » UserId:·1, |
| 24 | » UserName:·'Tom', | 24 | » UserName:·'Tom', |
| 25 | }; | 25 | }; |
| 26 | const·preserveConsecutiveUppercase:·PascalCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ | 26 | const·preserveConsecutiveUppercase:·PascalCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 27 | » FooBAR:·'string', | 27 | » FooBAR:·'string', |
| 28 | }; | 28 | }; |
| 29 | const·splitOnPunctuation:·PascalCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 30 | » FooBar:·'string', | ||
| 31 | }; | ||
| 29 | ``` | 32 | ``` |
| 30 | @category·Change·case | 33 | @category·Change·case |
| 31 | @category·Template·literal | 34 | @category·Template·literal |
| 32 | @category·Object | 35 | @category·Object |
| 33 | */ | 36 | */ |
| 34 | export·type·PascalCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function | 37 | export·type·PascalCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function |
| Offset 10, 14 lines modified | Offset 10, 16 lines modified | ||
| 10 | /** | 10 | /** |
| 11 | Pick·properties·from·a·deeply-nested·object. | 11 | Pick·properties·from·a·deeply-nested·object. |
| 12 | It·supports·recursing·into·arrays. | 12 | It·supports·recursing·into·arrays. |
| 13 | Use-case:·Distill·complex·objects·down·to·the·components·you·need·to·target. | 13 | Use-case:·Distill·complex·objects·down·to·the·components·you·need·to·target. |
| 14 | Use·[`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)·if·you·only·need·one·level·deep. | ||
| 14 | @example | 15 | @example |
| 15 | ``` | 16 | ``` |
| 16 | import·type·{PickDeep,·PartialDeep}·from·'type-fest'; | 17 | import·type·{PickDeep,·PartialDeep}·from·'type-fest'; |
| 17 | type·Configuration·=·{ | 18 | type·Configuration·=·{ |
| 18 | » userConfig:·{ | 19 | » userConfig:·{ |
| 19 | » » name:·string; | 20 | » » name:·string; |
| Offset 1, 16 lines modified | Offset 1, 18 lines modified | ||
| 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; | 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | C | 3 | Create·a·deeply·immutable·version·of·another·type. |
| 4 | This·is·useful·when·a·deeply·nested·structure·needs·to·be·exposed·as·completely·immutable,·for·example,·an·imported·JSON·module·or·when·receiving·an·API·response·that·is·passed·around. | 4 | This·is·useful·when·a·deeply·nested·structure·needs·to·be·exposed·as·completely·immutable,·for·example,·an·imported·JSON·module·or·when·receiving·an·API·response·that·is·passed·around. |
| 5 | Please·upvote·[this·issue](https://github.com/microsoft/TypeScript/issues/13923)·if·you·want·to·have·this·type·as·a·built-in·in·TypeScript. | 5 | Please·upvote·[this·issue](https://github.com/microsoft/TypeScript/issues/13923)·if·you·want·to·have·this·type·as·a·built-in·in·TypeScript. |
| 6 | Use·[`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype)·if·you·only·need·one·level·deep. | ||
| 6 | @example | 7 | @example |
| 7 | ``` | 8 | ``` |
| 8 | import·type·{ReadonlyDeep}·from·'type-fest'; | 9 | import·type·{ReadonlyDeep}·from·'type-fest'; |
| 9 | declare·const·foo:·{ | 10 | declare·const·foo:·{ |
| 10 | » a:·string; | 11 | » a:·string; |
| 11 | » b:·{c:·number}; | 12 | » b:·{c:·number}; |
| Offset 79, 16 lines modified | Offset 81, 16 lines modified | ||
| 79 | » » » » :·HasMultipleCallSignatures<T>·extends·true | 81 | » » » » :·HasMultipleCallSignatures<T>·extends·true |
| 80 | » » » » » ?·T | 82 | » » » » » ?·T |
| 81 | » » » » » :·((...arguments_:·Parameters<T>)·=>·ReturnType<T>)·&·_ReadonlyObjectDeep<T> | 83 | » » » » » :·((...arguments_:·Parameters<T>)·=>·ReturnType<T>)·&·_ReadonlyObjectDeep<T> |
| 82 | » » » :·T·extends·Readonly<ReadonlyMap<infer·KeyType,·infer·ValueType>> | 84 | » » » :·T·extends·Readonly<ReadonlyMap<infer·KeyType,·infer·ValueType>> |
| 83 | » » » » ?·ReadonlyMapDeep<KeyType,·ValueType> | 85 | » » » » ?·ReadonlyMapDeep<KeyType,·ValueType> |
| 84 | » » » » :·T·extends·Readonly<ReadonlySet<infer·ItemType>> | 86 | » » » » :·T·extends·Readonly<ReadonlySet<infer·ItemType>> |
| 85 | » » » » » ?·ReadonlySetDeep<ItemType> | 87 | » » » » » ?·ReadonlySetDeep<ItemType> |
| 86 | » » » » » | 88 | » » » » » //·Identify·tuples·to·avoid·converting·them·to·arrays·inadvertently;·special·case·`readonly·[...never[]]`,·as·it·emerges·undesirably·from·recursive·invocations·of·ReadonlyDeep·below. |
| 87 | » » » » » T·extends·readonly·[]·|·readonly·[...never[]] | 89 | » » » » » :·T·extends·readonly·[]·|·readonly·[...never[]] |
| 88 | » » » » » » ?·readonly·[] | 90 | » » » » » » ?·readonly·[] |
| 89 | » » » » » » :·T·extends·readonly·[infer·U,·...infer·V] | 91 | » » » » » » :·T·extends·readonly·[infer·U,·...infer·V] |
| 90 | » » » » » » » ?·readonly·[ReadonlyDeep<U>,·...ReadonlyDeep<V>] | 92 | » » » » » » » ?·readonly·[ReadonlyDeep<U>,·...ReadonlyDeep<V>] |
| 91 | » » » » » » » :·T·extends·readonly·[...infer·U,·infer·V] | 93 | » » » » » » » :·T·extends·readonly·[...infer·U,·infer·V] |
| 92 | » » » » » » » » ?·readonly·[...ReadonlyDeep<U>,·ReadonlyDeep<V>] | 94 | » » » » » » » » ?·readonly·[...ReadonlyDeep<U>,·ReadonlyDeep<V>] |
| 93 | » » » » » » » » :·T·extends·ReadonlyArray<infer·ItemType> | 95 | » » » » » » » » :·T·extends·ReadonlyArray<infer·ItemType> |
| 94 | » » » » » » » » » ?·ReadonlyArray<ReadonlyDeep<ItemType>> | 96 | » » » » » » » » » ?·ReadonlyArray<ReadonlyDeep<ItemType>> |
| Offset 106, 27 lines modified | Offset 106, 27 lines modified | ||
| 106 | @see·{@link·RemovePrefixOptions} | 106 | @see·{@link·RemovePrefixOptions} |
| 107 | @category·String | 107 | @category·String |
| 108 | @category·Template·literal | 108 | @category·Template·literal |
| 109 | */ | 109 | */ |
| 110 | export·type·RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·RemovePrefixOptions·=·{}>·= | 110 | export·type·RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·RemovePrefixOptions·=·{}>·= |
| 111 | IfNotAnyOrNever< | ||
| 112 | » S, | ||
| 113 | » IfNotAnyOrNever< | 111 | » IfNotAnyOrNever< |
| 112 | » » S, | ||
| 113 | » » IfNotAnyOrNever< | ||
| 114 | » » Prefix, | 114 | » » » Prefix, |
| 115 | » » _RemovePrefix<S,·Prefix,·ApplyDefaultOptions<RemovePrefixOptions,·DefaultRemovePrefixOptions,·Options>>, | 115 | » » » _RemovePrefix<S,·Prefix,·ApplyDefaultOptions<RemovePrefixOptions,·DefaultRemovePrefixOptions,·Options>>, |
| 116 | » » string, | 116 | » » » string, |
| 117 | » » S | 117 | » » » S |
| 118 | » > | 118 | » » > |
| 119 | >; | 119 | » >; |
| 120 | type·_RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·Required<RemovePrefixOptions>>·= | 120 | type·_RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·Required<RemovePrefixOptions>>·= |
| 121 | Prefix·extends·string·//·For·distributing·`Prefix` | 121 | » Prefix·extends·string·//·For·distributing·`Prefix` |
| 122 | » ?·S·extends·`${Prefix}${infer·Rest}` | 122 | » » ?·S·extends·`${Prefix}${infer·Rest}` |
| 123 | » » ?·Or<IsStringLiteral<Prefix>,·Not<Options['strict']>>·extends·true | 123 | » » » ?·Or<IsStringLiteral<Prefix>,·Not<Options['strict']>>·extends·true |
| 124 | » » » ?·Rest | 124 | » » » » ?·Rest |
| 125 | » » » :·string·//·Fallback·to·`string`·when·`Prefix`·is·non-literal·and·`strict`·is·disabled | 125 | » » » » :·string·//·Fallback·to·`string`·when·`Prefix`·is·non-literal·and·`strict`·is·disabled |
| 126 | » » :·S·//·Return·back·`S`·when·`Prefix`·is·not·present·at·the·start·of·`S` | 126 | » » » :·S·//·Return·back·`S`·when·`Prefix`·is·not·present·at·the·start·of·`S` |
| 127 | » :·never; | 127 | » » :·never; |
| 128 | export·{}; | 128 | export·{}; |
| Offset 23, 25 lines modified | Offset 23, 25 lines modified | ||
| 23 | declare·function·replace< | 23 | declare·function·replace< |
| 24 | » Input·extends·string, | 24 | » Input·extends·string, |
| 25 | » Search·extends·string, | 25 | » Search·extends·string, |
| 26 | » Replacement·extends·string, | 26 | » Replacement·extends·string, |
| 27 | >( | 27 | >( |
| 28 | » input:·Input, | 28 | » input:·Input, |
| 29 | » search:·Search, | 29 | » search:·Search, |
| 30 | » replacement:·Replacement | 30 | » replacement:·Replacement, |
| 31 | ):·Replace<Input,·Search,·Replacement>; | 31 | ):·Replace<Input,·Search,·Replacement>; |
| 32 | declare·function·replaceAll< | 32 | declare·function·replaceAll< |
| 33 | » Input·extends·string, | 33 | » Input·extends·string, |
| 34 | » Search·extends·string, | 34 | » Search·extends·string, |
| 35 | » Replacement·extends·string, | 35 | » Replacement·extends·string, |
| 36 | >( | 36 | >( |
| 37 | » input:·Input, | 37 | » input:·Input, |
| 38 | » search:·Search, | 38 | » search:·Search, |
| 39 | » replacement:·Replacement | 39 | » replacement:·Replacement, |
| 40 | ):·Replace<Input,·Search,·Replacement,·{all:·true}>; | 40 | ):·Replace<Input,·Search,·Replacement,·{all:·true}>; |
| 41 | //·The·return·type·is·the·exact·string·literal,·not·just·`string`. | 41 | //·The·return·type·is·the·exact·string·literal,·not·just·`string`. |
| 42 | replace('hello·?',·'?',·'🦄'); | 42 | replace('hello·?',·'?',·'🦄'); |
| 43 | //=>·'hello·🦄' | 43 | //=>·'hello·🦄' |
| Offset 5, 15 lines modified | Offset 5, 15 lines modified | ||
| 5 | /** | 5 | /** |
| 6 | Requires·all·of·the·keys·in·the·given·object. | 6 | Requires·all·of·the·keys·in·the·given·object. |
| 7 | */ | 7 | */ |
| 8 | type·RequireAll<ObjectType,·KeysType·extends·keyof·ObjectType>·=·Required<Pick<ObjectType,·KeysType>>; | 8 | type·RequireAll<ObjectType,·KeysType·extends·keyof·ObjectType>·=·Required<Pick<ObjectType,·KeysType>>; |
| 9 | /** | 9 | /** |
| 10 | Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys | 10 | Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 11 | Use-cases: | 11 | Use-cases: |
| 12 | -·Creating·interfaces·for·components·with·mutually-inclusive·keys. | 12 | -·Creating·interfaces·for·components·with·mutually-inclusive·keys. |
| 13 | The·caveat·with·`RequireAllOrNone`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireAllOrNone`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. | 13 | The·caveat·with·`RequireAllOrNone`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireAllOrNone`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. |
| 14 | @example | 14 | @example |
| Offset 1, 15 lines modified | Offset 1, 15 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{If}·from·'./if.d.ts'; | 2 | import·type·{If}·from·'./if.d.ts'; |
| 3 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; | 3 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; |
| 4 | import·type·{IsAny}·from·'./is-any.d.ts'; | 4 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 5 | import·type·{IsNever}·from·'./is-never.d.ts'; | 5 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | Create·a·type·that·requires·at·least·one·of·the·given·keys | 7 | Create·a·type·that·requires·at·least·one·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 8 | @example | 8 | @example |
| 9 | ``` | 9 | ``` |
| 10 | import·type·{RequireAtLeastOne}·from·'type-fest'; | 10 | import·type·{RequireAtLeastOne}·from·'type-fest'; |
| 11 | type·Responder·=·{ | 11 | type·Responder·=·{ |
| 12 | » text?:·()·=>·string; | 12 | » text?:·()·=>·string; |
| Offset 36, 15 lines modified | Offset 36, 13 lines modified | ||
| 36 | » » >>; | 36 | » » >>; |
| 37 | type·_RequireAtLeastOne< | 37 | type·_RequireAtLeastOne< |
| 38 | » ObjectType, | 38 | » ObjectType, |
| 39 | » KeysType·extends·keyof·ObjectType, | 39 | » KeysType·extends·keyof·ObjectType, |
| 40 | >·=·{ | 40 | >·=·{ |
| 41 | » //·For·each·`Key`·in·`KeysType`·make·a·mapped·type: | 41 | » //·For·each·`Key`·in·`KeysType`·make·a·mapped·type: |
| 42 | » [Key·in·KeysType]-?:·Required<Pick<ObjectType,·Key>>· | 42 | » [Key·in·KeysType]-?:·Required<Pick<ObjectType,·Key>>·//·1.·Make·`Key`'s·type·required |
| 43 | » » &·Partial<Pick<ObjectType,·Exclude<KeysType,·Key>>>;·//·2.·Make·all·other·keys·in·`KeysType`·optional | ||
| 43 | » //·2.·Make·all·other·keys·in·`KeysType`·optional | ||
| 44 | » » Partial<Pick<ObjectType,·Exclude<KeysType,·Key>>>; | ||
| 45 | }[KeysType] | 44 | }[KeysType] |
| 45 | &·Except<ObjectType,·KeysType>;·//·3.·Add·the·remaining·keys·not·in·`KeysType` | ||
| 46 | //·3.·Add·the·remaining·keys·not·in·`KeysType` | ||
| 47 | Except<ObjectType,·KeysType>; | ||
| 48 | export·{}; | 46 | export·{}; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{If}·from·'./if.d.ts'; | 1 | import·type·{If}·from·'./if.d.ts'; |
| 2 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; | 2 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; |
| 3 | import·type·{IsAny}·from·'./is-any.d.ts'; | 3 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 4 | import·type·{IsNever}·from·'./is-never.d.ts'; | 4 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more | 6 | Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more,·while·keeping·the·remaining·keys·as·is. |
| 7 | Use-cases: | 7 | Use-cases: |
| 8 | -·Creating·interfaces·for·components·that·only·need·one·of·the·keys·to·display·properly. | 8 | -·Creating·interfaces·for·components·that·only·need·one·of·the·keys·to·display·properly. |
| 9 | -·Declaring·generic·keys·in·a·single·place·for·a·single·use-case·that·gets·narrowed·down·via·`RequireExactlyOne`. | 9 | -·Declaring·generic·keys·in·a·single·place·for·a·single·use-case·that·gets·narrowed·down·via·`RequireExactlyOne`. |
| 10 | The·caveat·with·`RequireExactlyOne`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireExactlyOne`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. | 10 | The·caveat·with·`RequireExactlyOne`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireExactlyOne`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. |
| Offset 37, 12 lines modified | Offset 37, 12 lines modified | ||
| 37 | » » If<IsNever<KeysType>, | 37 | » » If<IsNever<KeysType>, |
| 38 | » » » never, | 38 | » » » never, |
| 39 | » » » _RequireExactlyOne<ObjectType,·If<IsAny<KeysType>,·keyof·ObjectType,·KeysType>> | 39 | » » » _RequireExactlyOne<ObjectType,·If<IsAny<KeysType>,·keyof·ObjectType,·KeysType>> |
| 40 | » » >>; | 40 | » » >>; |
| 41 | type·_RequireExactlyOne<ObjectType,·KeysType·extends·keyof·ObjectType>·= | 41 | type·_RequireExactlyOne<ObjectType,·KeysType·extends·keyof·ObjectType>·= |
| 42 | » {[Key·in·KeysType]:·( | 42 | » {[Key·in·KeysType]:·( |
| 43 | » » Required<Pick<ObjectType,·Key>> | 43 | » » Required<Pick<ObjectType,·Key>> |
| 44 | » » Partial<Record<Exclude<KeysType,·Key>,·never>> | 44 | » » &·Partial<Record<Exclude<KeysType,·Key>,·never>> |
| 45 | » )}[KeysType]·&·Omit<ObjectType,·KeysType>; | 45 | » )}[KeysType]·&·Omit<ObjectType,·KeysType>; |
| 46 | export·{}; | 46 | export·{}; |
| Offset 1, 15 lines modified | Offset 1, 15 lines modified | ||
| 1 | import·type·{RequireExactlyOne}·from·'./require-exactly-one.d.ts'; | 1 | import·type·{RequireExactlyOne}·from·'./require-exactly-one.d.ts'; |
| 2 | import·type·{IfNotAnyOrNever,·RequireNone}·from·'./internal/index.d.ts'; | 2 | import·type·{IfNotAnyOrNever,·RequireNone}·from·'./internal/index.d.ts'; |
| 3 | import·type·{If}·from·'./if.d.ts'; | 3 | import·type·{If}·from·'./if.d.ts'; |
| 4 | import·type·{IsAny}·from·'./is-any.d.ts'; | 4 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 5 | import·type·{IsNever}·from·'./is-never.d.ts'; | 5 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | Create·a·type·that·requires·exactly·one·of·the·given·keys· | 7 | Create·a·type·that·requires·exactly·one·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 8 | @example | 8 | @example |
| 9 | ``` | 9 | ``` |
| 10 | import·type·{RequireOneOrNone}·from·'type-fest'; | 10 | import·type·{RequireOneOrNone}·from·'type-fest'; |
| 11 | type·Responder·=·RequireOneOrNone<{ | 11 | type·Responder·=·RequireOneOrNone<{ |
| 12 | » text:·()·=>·string; | 12 | » text:·()·=>·string; |
| Offset 1, 18 lines modified | Offset 1, 20 lines modified | ||
| 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; | 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsNever}·from·'./is-never.d.ts'; | 2 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a· | 5 | Create·a·deeply·required·version·of·another·type. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Creating·optional·configuration·interfaces·where·the·underlying·implementation·still·requires·all·options·to·be·fully·specified. | 7 | -·Creating·optional·configuration·interfaces·where·the·underlying·implementation·still·requires·all·options·to·be·fully·specified. |
| 8 | -·Modeling·the·resulting·type·after·a·deep·merge·with·a·set·of·defaults. | 8 | -·Modeling·the·resulting·type·after·a·deep·merge·with·a·set·of·defaults. |
| 9 | Use·[`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype)·if·you·only·need·one·level·deep. | ||
| 9 | @example | 10 | @example |
| 10 | ``` | 11 | ``` |
| 11 | import·type·{RequiredDeep}·from·'type-fest'; | 12 | import·type·{RequiredDeep}·from·'type-fest'; |
| 12 | type·Settings·=·{ | 13 | type·Settings·=·{ |
| 13 | » textEditor?:·{ | 14 | » textEditor?:·{ |
| 14 | » » fontSize?:·number; | 15 | » » fontSize?:·number; |
| Offset 10, 14 lines modified | Offset 10, 15 lines modified | ||
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| 12 | import·type·{ScreamingSnakeCase}·from·'type-fest'; | 12 | import·type·{ScreamingSnakeCase}·from·'type-fest'; |
| 13 | const·someVariable:·ScreamingSnakeCase<'fooBar'>·=·'FOO_BAR'; | 13 | const·someVariable:·ScreamingSnakeCase<'fooBar'>·=·'FOO_BAR'; |
| 14 | const·someVariableNoSplitOnNumbers:·ScreamingSnakeCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'P2P_NETWORK'; | 14 | const·someVariableNoSplitOnNumbers:·ScreamingSnakeCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'P2P_NETWORK'; |
| 15 | const·someVariableWithPunctuation:·ScreamingSnakeCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'DIV_CARD_AFTER'; | ||
| 15 | ``` | 16 | ``` |
| 16 | @category·Change·case | 17 | @category·Change·case |
| 17 | @category·Template·literal | 18 | @category·Template·literal |
| 18 | ·*/ | 19 | ·*/ |
| 19 | export·type·ScreamingSnakeCase< | 20 | export·type·ScreamingSnakeCase< |
| Offset 1, 18 lines modified | Offset 1, 20 lines modified | ||
| 1 | import·type·{NonRecursiveType,·StringToNumber}·from·'./internal/index.d.ts'; | 1 | import·type·{NonRecursiveType,·StringToNumber}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsAny}·from·'./is-any.d.ts'; | ||
| 3 | import·type·{NonNullableDeep}·from·'./non-nullable-deep.d.ts'; | ||
| 2 | import·type·{Paths}·from·'./paths.d.ts'; | 4 | import·type·{Paths}·from·'./paths.d.ts'; |
| 3 | import·type·{SetNonNullable}·from·'./set-non-nullable.d.ts'; | 5 | import·type·{SetNonNullable}·from·'./set-non-nullable.d.ts'; |
| 4 | import·type·{Simplify}·from·'./simplify.d.ts'; | 6 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 5 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; | 7 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; |
| 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 7 | /** | 9 | /** |
| 8 | Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. | 10 | Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. |
| 9 | NOTE:·Optional·modifiers·(`?`)·are·not·removed·from·properties.·For·example,·`SetNonNullableDeep<{foo?:·string·|·null·|·undefined},·'foo'>`·will·result·in·`{foo?:·string}`. | 11 | NOTE:·Optional·modifiers·(`?`)·are·not·removed·from·properties.·For·example,·`SetNonNullableDeep<{foo?:·string·|·null·|·undefined},·'foo'>`·will·result·in·`{foo?:·string}`.·To·remove·both·optional·modifiers·and·nullables,·use·{@link·SetRequiredDeep}·in·conjunction·with·this·type. |
| 10 | @example | 12 | @example |
| 11 | ``` | 13 | ``` |
| 12 | import·type·{SetNonNullableDeep}·from·'type-fest'; | 14 | import·type·{SetNonNullableDeep}·from·'type-fest'; |
| 13 | type·User·=·{ | 15 | type·User·=·{ |
| 14 | » name:·string; | 16 | » name:·string; |
| Offset 51, 16 lines modified | Offset 53, 17 lines modified | ||
| 51 | //·Optional·modifier·(`?`)·is·not·removed. | 53 | //·Optional·modifier·(`?`)·is·not·removed. |
| 52 | type·ArrayExample2·=·SetNonNullableDeep<{a:·[(number·|·null)?,·(number·|·null)?]},·'a.1'>; | 54 | type·ArrayExample2·=·SetNonNullableDeep<{a:·[(number·|·null)?,·(number·|·null)?]},·'a.1'>; |
| 53 | //=>·{a:·[(number·|·null)?,·number?]} | 55 | //=>·{a:·[(number·|·null)?,·number?]} |
| 54 | ``` | 56 | ``` |
| 55 | @category·Object | 57 | @category·Object |
| 56 | */ | 58 | */ |
| 57 | export·type·SetNonNullableDeep<BaseType,·KeyPaths·extends·Paths<BaseType>>·= | 59 | export·type·SetNonNullableDeep<BaseType,·KeyPaths·extends·Paths<BaseType>>·=·IsAny<KeyPaths>·extends·true |
| 60 | » ?·NonNullableDeep<BaseType> | ||
| 58 | » SetNonNullableDeepHelper<BaseType,·UnionToTuple<KeyPaths>>; | 61 | » :·SetNonNullableDeepHelper<BaseType,·UnionToTuple<KeyPaths>>; |
| 59 | /** | 62 | /** |
| 60 | Internal·helper·for·{@link·SetNonNullableDeep}. | 63 | Internal·helper·for·{@link·SetNonNullableDeep}. |
| 61 | Recursively·transforms·the·`BaseType`·by·applying·{@link·SetNonNullableDeepSinglePath}·for·each·path·in·`KeyPathsTuple`. | 64 | Recursively·transforms·the·`BaseType`·by·applying·{@link·SetNonNullableDeepSinglePath}·for·each·path·in·`KeyPathsTuple`. |
| 62 | */ | 65 | */ |
| 63 | type·SetNonNullableDeepHelper<BaseType,·KeyPathsTuple·extends·UnknownArray>·= | 66 | type·SetNonNullableDeepHelper<BaseType,·KeyPathsTuple·extends·UnknownArray>·= |
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Create·a·type·that·makes·the·given·keys·non-nullable,·whe | 2 | Create·a·type·that·makes·the·given·keys·non-nullable,·while·keeping·the·remaining·keys·as·is. |
| 3 | If·no·keys·are·given,·all·keys·will·be·made·non-nullable. | 3 | If·no·keys·are·given,·all·keys·will·be·made·non-nullable. |
| 4 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·or·all·of·the·keys·are·non-nullable. | 4 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·or·all·of·the·keys·are·non-nullable. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; | 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a·type·that·makes·the·given·keys·optional | 5 | Create·a·type·that·makes·the·given·keys·optional,·while·keeping·the·remaining·keys·as·is. |
| 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·optional. | 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·optional. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{SetOptional}·from·'type-fest'; | 9 | import·type·{SetOptional}·from·'type-fest'; |
| Offset 28, 15 lines modified | Offset 28, 15 lines modified | ||
| 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> | 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> |
| 29 | » » :·unknown) | 29 | » » :·unknown) |
| 30 | » &·_SetOptional<BaseType,·Keys>; | 30 | » &·_SetOptional<BaseType,·Keys>; |
| 31 | type·_SetOptional<BaseType,·Keys·extends·keyof·BaseType>·= | 31 | type·_SetOptional<BaseType,·Keys·extends·keyof·BaseType>·= |
| 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. | 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. |
| 33 | » » ?·Simplify< | 33 | » » ?·Simplify< |
| 34 | » » //·Pick·just·the·keys·that·are·readonly·from·the·base·type. | 34 | » » » //·Pick·just·the·keys·that·are·readonly·from·the·base·type. |
| 35 | » » » Except<BaseType,·Keys> | 35 | » » » Except<BaseType,·Keys> |
| 36 | » » //·Pick·the·keys·that·should·be·mutable·from·the·base·type·and·make·them·mutable. | 36 | » » » //·Pick·the·keys·that·should·be·mutable·from·the·base·type·and·make·them·mutable. |
| 37 | » » » Partial<HomomorphicPick<BaseType,·Keys>> | 37 | » » » &·Partial<HomomorphicPick<BaseType,·Keys>> |
| 38 | » » > | 38 | » » > |
| 39 | » » :·never; | 39 | » » :·never; |
| 40 | export·{}; | 40 | export·{}; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; | 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a·type·that·makes·the·given·keys·readonly | 5 | Create·a·type·that·makes·the·given·keys·readonly,·while·keeping·the·remaining·keys·as·is. |
| 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·readonly. | 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·readonly. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{SetReadonly}·from·'type-fest'; | 9 | import·type·{SetReadonly}·from·'type-fest'; |
| Offset 28, 13 lines modified | Offset 28, 13 lines modified | ||
| 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> | 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> |
| 29 | » » :·unknown) | 29 | » » :·unknown) |
| 30 | » &·_SetReadonly<BaseType,·Keys>; | 30 | » &·_SetReadonly<BaseType,·Keys>; |
| 31 | export·type·_SetReadonly<BaseType,·Keys·extends·keyof·BaseType>·= | 31 | export·type·_SetReadonly<BaseType,·Keys·extends·keyof·BaseType>·= |
| 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. | 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. |
| 33 | » » ?·Simplify< | 33 | » » ?·Simplify< |
| 34 | » » » Except<BaseType,·Keys> | 34 | » » » Except<BaseType,·Keys> |
| 35 | » » » Readonly<HomomorphicPick<BaseType,·Keys>> | 35 | » » » &·Readonly<HomomorphicPick<BaseType,·Keys>> |
| 36 | » » > | 36 | » » > |
| 37 | » » :·never; | 37 | » » :·never; |
| 38 | export·{}; | 38 | export·{}; |
| Offset 4, 15 lines modified | Offset 4, 15 lines modified | ||
| 4 | import·type·{SetRequired}·from·'./set-required.d.ts'; | 4 | import·type·{SetRequired}·from·'./set-required.d.ts'; |
| 5 | import·type·{SimplifyDeep}·from·'./simplify-deep.d.ts'; | 5 | import·type·{SimplifyDeep}·from·'./simplify-deep.d.ts'; |
| 6 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; | 6 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; |
| 7 | import·type·{RequiredDeep}·from·'./required-deep.d.ts'; | 7 | import·type·{RequiredDeep}·from·'./required-deep.d.ts'; |
| 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 9 | /** | 9 | /** |
| 10 | Create·a·type·that·makes·the·given·keys·required | 10 | Create·a·type·that·makes·the·given·keys·required,·with·support·for·deeply·nested·key·paths,·while·keeping·the·remaining·keys·as·is. |
| 11 | Use-case:·Selectively·make·nested·properties·required·in·complex·types·like·models. | 11 | Use-case:·Selectively·make·nested·properties·required·in·complex·types·like·models. |
| 12 | @example | 12 | @example |
| 13 | ``` | 13 | ``` |
| 14 | import·type·{SetRequiredDeep}·from·'type-fest'; | 14 | import·type·{SetRequiredDeep}·from·'type-fest'; |
| Offset 2, 15 lines modified | Offset 2, 15 lines modified | ||
| 2 | import·type·{If}·from·'./if.d.ts'; | 2 | import·type·{If}·from·'./if.d.ts'; |
| 3 | import·type·{HomomorphicPick,·IsArrayReadonly}·from·'./internal/index.d.ts'; | 3 | import·type·{HomomorphicPick,·IsArrayReadonly}·from·'./internal/index.d.ts'; |
| 4 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; | 4 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; |
| 5 | import·type·{Simplify}·from·'./simplify.d.ts'; | 5 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 7 | /** | 7 | /** |
| 8 | Create·a·type·that·makes·the·given·keys·required | 8 | Create·a·type·that·makes·the·given·keys·required,·while·keeping·the·remaining·keys·as·is. |
| 9 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·required. | 9 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·required. |
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| 12 | import·type·{SetRequired}·from·'type-fest'; | 12 | import·type·{SetRequired}·from·'type-fest'; |
| Offset 39, 17 lines modified | Offset 39, 17 lines modified | ||
| 39 | type·_SetRequired<BaseType,·Keys·extends·keyof·BaseType>·= | 39 | type·_SetRequired<BaseType,·Keys·extends·keyof·BaseType>·= |
| 40 | » BaseType·extends·UnknownArray | 40 | » BaseType·extends·UnknownArray |
| 41 | » » ?·SetArrayRequired<BaseType,·Keys>·extends·infer·ResultantArray | 41 | » » ?·SetArrayRequired<BaseType,·Keys>·extends·infer·ResultantArray |
| 42 | » » » ?·If<IsArrayReadonly<BaseType>,·Readonly<ResultantArray>,·ResultantArray> | 42 | » » » ?·If<IsArrayReadonly<BaseType>,·Readonly<ResultantArray>,·ResultantArray> |
| 43 | » » » :·never | 43 | » » » :·never |
| 44 | » » :·Simplify< | 44 | » » :·Simplify< |
| 45 | » » //·Pick·just·the·keys·that·are·optional·from·the·base·type. | 45 | » » //·Pick·just·the·keys·that·are·optional·from·the·base·type. |
| 46 | » » » Except<BaseType,·Keys> | 46 | » » » Except<BaseType,·Keys> |
| 47 | » » //·Pick·the·keys·that·should·be·required·from·the·base·type·and·make·them·required. | 47 | » » //·Pick·the·keys·that·should·be·required·from·the·base·type·and·make·them·required. |
| 48 | » » » Required<HomomorphicPick<BaseType,·Keys>> | 48 | » » » &·Required<HomomorphicPick<BaseType,·Keys>> |
| 49 | » » >; | 49 | » » >; |
| 50 | /** | 50 | /** |
| 51 | Remove·the·optional·modifier·from·the·specified·keys·in·an·array. | 51 | Remove·the·optional·modifier·from·the·specified·keys·in·an·array. |
| 52 | */ | 52 | */ |
| 53 | type·SetArrayRequired< | 53 | type·SetArrayRequired< |
| 54 | » TArray·extends·UnknownArray, | 54 | » TArray·extends·UnknownArray, |
| Offset 62, 18 lines modified | Offset 62, 18 lines modified | ||
| 62 | @see·{@link·SharedUnionFieldsDeep} | 62 | @see·{@link·SharedUnionFieldsDeep} |
| 63 | @see·{@link·AllUnionFields} | 63 | @see·{@link·AllUnionFields} |
| 64 | @category·Object | 64 | @category·Object |
| 65 | @category·Union | 65 | @category·Union |
| 66 | */ | 66 | */ |
| 67 | export·type·SharedUnionFields<Union>·= | 67 | export·type·SharedUnionFields<Union>·= |
| 68 | Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers | 68 | » Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers |
| 69 | » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers | 69 | » » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers |
| 70 | » » ? | 70 | » » » ?·//·eslint-disable-line·@stylistic/operator-linebreak |
| 71 | » » |·SkippedMembers | 71 | » » » |·SkippedMembers |
| 72 | » » |·(IsNever<RelevantMembers>·extends·true | 72 | » » » |·(IsNever<RelevantMembers>·extends·true |
| 73 | » » » ?·never | 73 | » » » » ?·never |
| 74 | » » » :·Simplify<Pick<RelevantMembers,·keyof·RelevantMembers>>) | 74 | » » » » :·Simplify<Pick<RelevantMembers,·keyof·RelevantMembers>>) |
| 75 | » » :·never | 75 | » » » :·never |
| 76 | » :·never; | 76 | » » :·never; |
| 77 | export·{}; | 77 | export·{}; |
| Offset 12, 14 lines modified | Offset 12, 15 lines modified | ||
| 12 | import·type·{SnakeCase}·from·'type-fest'; | 12 | import·type·{SnakeCase}·from·'type-fest'; |
| 13 | //·Simple | 13 | //·Simple |
| 14 | const·someVariable:·SnakeCase<'fooBar'>·=·'foo_bar'; | 14 | const·someVariable:·SnakeCase<'fooBar'>·=·'foo_bar'; |
| 15 | const·noSplitOnNumbers:·SnakeCase<'p2pNetwork'>·=·'p2p_network'; | 15 | const·noSplitOnNumbers:·SnakeCase<'p2pNetwork'>·=·'p2p_network'; |
| 16 | const·splitOnNumbers:·SnakeCase<'p2pNetwork',·{splitOnNumbers:·true}>·=·'p_2_p_network'; | 16 | const·splitOnNumbers:·SnakeCase<'p2pNetwork',·{splitOnNumbers:·true}>·=·'p_2_p_network'; |
| 17 | const·splitOnPunctuation:·SnakeCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'div_card_after'; | ||
| 17 | //·Advanced | 18 | //·Advanced |
| 18 | type·SnakeCasedProperties<T>·=·{ | 19 | type·SnakeCasedProperties<T>·=·{ |
| 19 | » [K·in·keyof·T·as·SnakeCase<K>]:·T[K] | 20 | » [K·in·keyof·T·as·SnakeCase<K>]:·T[K] |
| 20 | }; | 21 | }; |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » line_2:·[ | 47 | » » line_2:·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » line_3:·'string', | 49 | » » » » line_3:·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·SnakeCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user_info':·{ | ||
| 56 | » » 'user_id':·1, | ||
| 57 | » » 'user_name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·SnakeCasedPropertiesDeep< | 65 | export·type·SnakeCasedPropertiesDeep< |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; | 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; |
| 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·snake·ca | 6 | Convert·top-level·object·properties·to·snake·case. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·SnakeCase} | 8 | @see·{@link·SnakeCase} |
| 9 | @see·{@link·SnakeCasedPropertiesDeep} | 9 | @see·{@link·SnakeCasedPropertiesDeep} |
| 10 | @example | 10 | @example |
| Offset 24, 14 lines modified | Offset 24, 18 lines modified | ||
| 24 | » user_id:·1, | 24 | » user_id:·1, |
| 25 | » user_name:·'Tom', | 25 | » user_name:·'Tom', |
| 26 | }; | 26 | }; |
| 27 | const·splitOnNumbers:·SnakeCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ | 27 | const·splitOnNumbers:·SnakeCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ |
| 28 | » 'line_1':·'string', | 28 | » 'line_1':·'string', |
| 29 | }; | 29 | }; |
| 30 | const·splitOnPunctuation:·SnakeCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 31 | » 'foo_bar':·'string', | ||
| 32 | }; | ||
| 30 | ``` | 33 | ``` |
| 31 | @category·Change·case | 34 | @category·Change·case |
| 32 | @category·Template·literal | 35 | @category·Template·literal |
| 33 | @category·Object | 36 | @category·Object |
| 34 | */ | 37 | */ |
| 35 | export·type·SnakeCasedProperties< | 38 | export·type·SnakeCasedProperties< |
| Offset 1, 11 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{ReverseSign}·from·'./internal/index.d.ts'; |
| 2 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 2 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 3 | import·type·{LessThan}·from·'./less-than.d.ts'; | 3 | import·type·{LessThan}·from·'./less-than.d.ts'; |
| 4 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 4 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 5 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 5 | /** | 6 | /** |
| 6 | Returns·the·difference·between·two·numbers. | 7 | Returns·the·difference·between·two·numbers. |
| 7 | Note: | 8 | Note: |
| 8 | -·A·or·B·can·only·support·`-999`·~·`999`. | 9 | -·A·or·B·can·only·support·`-999`·~·`999`. |
| Offset 55, 17 lines modified | Offset 56, 17 lines modified | ||
| 55 | Subtracts·two·numbers·A·and·B,·such·that·they·are·not·equal·and·neither·of·them·are·0,·+/-·infinity·or·the·`number`·type | 56 | Subtracts·two·numbers·A·and·B,·such·that·they·are·not·equal·and·neither·of·them·are·0,·+/-·infinity·or·the·`number`·type |
| 56 | */ | 57 | */ |
| 57 | type·SubtractPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= | 58 | type·SubtractPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= |
| 58 | » AreNegative·extends·[false,·false] | 59 | » AreNegative·extends·[false,·false] |
| 59 | » » ?·SubtractPositives<A,·B> | 60 | » » ?·SubtractPositives<A,·B> |
| 60 | » » :·AreNegative·extends·[true,·true] | 61 | » » :·AreNegative·extends·[true,·true] |
| 61 | » » » //·When·both·numbers·are·negative·we·subtract·the·absolute·values·and·then·reverse·the·sign | 62 | » » » //·When·both·numbers·are·negative·we·subtract·the·absolute·values·and·then·reverse·the·sign |
| 62 | » » » ?·ReverseSign<SubtractPositives< | 63 | » » » ?·ReverseSign<SubtractPositives<Absolute<A>,·Absolute<B>>> |
| 63 | » » » //·When·the·signs·are·different·we·can·add·the·absolute·values·and·then·reverse·the·sign·if·A·<·B | 64 | » » » //·When·the·signs·are·different·we·can·add·the·absolute·values·and·then·reverse·the·sign·if·A·<·B |
| 64 | » » » :·[...TupleOf< | 65 | » » » :·[...TupleOf<Absolute<A>>,·...TupleOf<Absolute<B>>]·extends·infer·R·extends·unknown[] |
| 65 | » » » » ?·LessThan<A,·B>·extends·true·?·ReverseSign<R['length']>·:·R['length'] | 66 | » » » » ?·LessThan<A,·B>·extends·true·?·ReverseSign<R['length']>·:·R['length'] |
| 66 | » » » » :·never; | 67 | » » » » :·never; |
| 67 | /** | 68 | /** |
| 68 | Subtracts·two·positive·numbers. | 69 | Subtracts·two·positive·numbers. |
| 69 | */ | 70 | */ |
| 70 | type·SubtractPositives<A·extends·number,·B·extends·number>·= | 71 | type·SubtractPositives<A·extends·number,·B·extends·number>·= |
| Offset 1, 11 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 2 | import·type·{ | 2 | import·type·{TupleMax,·ReverseSign}·from·'./internal/index.d.ts'; |
| 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 4 | import·type·{Subtract}·from·'./subtract.d.ts'; | 4 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 5 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 5 | /** | 6 | /** |
| 6 | Returns·the·sum·of·two·numbers. | 7 | Returns·the·sum·of·two·numbers. |
| 7 | Note: | 8 | Note: |
| 8 | -·A·or·B·can·only·support·`-999`·~·`999`. | 9 | -·A·or·B·can·only·support·`-999`·~·`999`. |
| Offset 53, 19 lines modified | Offset 54, 19 lines modified | ||
| 53 | */ | 54 | */ |
| 54 | type·SumPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= | 55 | type·SumPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= |
| 55 | » AreNegative·extends·[false,·false] | 56 | » AreNegative·extends·[false,·false] |
| 56 | » » //·When·both·numbers·are·positive·we·can·add·them·together | 57 | » » //·When·both·numbers·are·positive·we·can·add·them·together |
| 57 | » » ?·SumPositives<A,·B> | 58 | » » ?·SumPositives<A,·B> |
| 58 | » » :·AreNegative·extends·[true,·true] | 59 | » » :·AreNegative·extends·[true,·true] |
| 59 | » » » //·When·both·numbers·are·negative·we·add·the·absolute·values·and·then·reverse·the·sign | 60 | » » » //·When·both·numbers·are·negative·we·add·the·absolute·values·and·then·reverse·the·sign |
| 60 | » » » ?·ReverseSign<SumPositives< | 61 | » » » ?·ReverseSign<SumPositives<Absolute<A>,·Absolute<B>>> |
| 61 | » » » //·When·the·signs·are·different·we·can·subtract·the·absolute·values,·remove·the·sign | 62 | » » » //·When·the·signs·are·different·we·can·subtract·the·absolute·values,·remove·the·sign |
| 62 | » » » //·and·then·reverse·the·sign·if·the·larger·absolute·value·is·negative | 63 | » » » //·and·then·reverse·the·sign·if·the·larger·absolute·value·is·negative |
| 63 | » » » :· | 64 | » » » :·Absolute<Subtract<Absolute<A>,·Absolute<B>>>·extends·infer·Result·extends·number |
| 64 | » » » » ?·TupleMax<[ | 65 | » » » » ?·TupleMax<[Absolute<A>,·Absolute<B>]>·extends·infer·Max_·extends·number |
| 65 | » » » » » ?·Max_·extends·A·|·B | 66 | » » » » » ?·Max_·extends·A·|·B |
| 66 | » » » » » » //·The·larger·absolute·value·is·positive,·so·the·result·is·positive | 67 | » » » » » » //·The·larger·absolute·value·is·positive,·so·the·result·is·positive |
| 67 | » » » » » » ?·Result | 68 | » » » » » » ?·Result |
| 68 | » » » » » » //·The·larger·absolute·value·is·negative,·so·the·result·is·negative | 69 | » » » » » » //·The·larger·absolute·value·is·negative,·so·the·result·is·negative |
| 69 | » » » » » » :·ReverseSign<Result> | 70 | » » » » » » :·ReverseSign<Result> |
| 70 | » » » » » :·never | 71 | » » » » » :·never |
| 71 | » » » » :·never; | 72 | » » » » :·never; |
| Offset 4, 20 lines modified | Offset 4, 18 lines modified | ||
| 4 | export·type·TagContainer<Token>·=·{ | 4 | export·type·TagContainer<Token>·=·{ |
| 5 | » readonly·[tag]:·Token; | 5 | » readonly·[tag]:·Token; |
| 6 | }; | 6 | }; |
| 7 | type·Tag<Token·extends·PropertyKey,·TagMetadata>·=·TagContainer<{[K·in·Token]:·TagMetadata}>; | 7 | type·Tag<Token·extends·PropertyKey,·TagMetadata>·=·TagContainer<{[K·in·Token]:·TagMetadata}>; |
| 8 | /** | 8 | /** |
| 9 | 9 | Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.[·...·truncated·by·diffoscope;·len:·99,·SHA:·3fd8c7a5ebcae5c18ca9e42cbf2316354997c57f4e24714709786008b221556b·...·] | |
| 10 | A·type·returned·by·`Tagged`·can·be·passed·to·`Tagged`·again,·to·create·a·type·with·multiple·tags. | 10 | A·type·returned·by·`Tagged`·can·be·passed·to·`Tagged`·again,·to·create·a·type·with·multiple·tags. |
| 11 | [Read·more·about·tagged·types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) | ||
| 12 | A·tag's·name·is·usually·a·string·(and·must·be·a·string,·number,·or·symbol),·but·each·application·of·a·tag·can·also·contain·an·arbitrary·type·as·its·"metadata".·See·{@link·GetTagMetadata}·for·examples·and·explanation. | 11 | A·tag's·name·is·usually·a·string·(and·must·be·a·string,·number,·or·symbol),·but·each·application·of·a·tag·can·also·contain·an·arbitrary·type·as·its·"metadata".·See·{@link·GetTagMetadata}·for·examples·and·explanation. |
| 13 | A·type·`A`·returned·by·`Tagged`·is·assignable·to·another·type·`B`·returned·by·`Tagged`·if·and·only·if: | 12 | A·type·`A`·returned·by·`Tagged`·is·assignable·to·another·type·`B`·returned·by·`Tagged`·if·and·only·if: |
| 14 | ··-·the·underlying·(untagged)·type·of·`A`·is·assignable·to·the·underlying·type·of·`B`; | 13 | ··-·the·underlying·(untagged)·type·of·`A`·is·assignable·to·the·underlying·type·of·`B`; |
| 15 | » -·`A`·contains·at·least·all·the·tags·`B`·has; | 14 | » -·`A`·contains·at·least·all·the·tags·`B`·has; |
| 16 | » -·and·the·metadata·type·for·each·of·`A`'s·tags·is·assignable·to·the·metadata·type·of·`B`'s·corresponding·tag. | 15 | » -·and·the·metadata·type·for·each·of·`A`'s·tags·is·assignable·to·the·metadata·type·of·`B`'s·corresponding·tag. |
| Offset 96, 15 lines modified | Offset 94, 15 lines modified | ||
| 96 | ``` | 94 | ``` |
| 97 | @category·Type | 95 | @category·Type |
| 98 | */ | 96 | */ |
| 99 | export·type·GetTagMetadata<Type·extends·Tag<TagName,·unknown>,·TagName·extends·PropertyKey>·=·Type[typeof·tag][TagName]; | 97 | export·type·GetTagMetadata<Type·extends·Tag<TagName,·unknown>,·TagName·extends·PropertyKey>·=·Type[typeof·tag][TagName]; |
| 100 | /** | 98 | /** |
| 101 | 99 | Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. | |
| 102 | Why·is·this·necessary? | 100 | Why·is·this·necessary? |
| 103 | 1.·Use·a·`Tagged`·type·as·object·keys | 101 | 1.·Use·a·`Tagged`·type·as·object·keys |
| 104 | 2.·Prevent·TS4058·error:·"Return·type·of·exported·function·has·or·is·using·name·X·from·external·module·Y·but·cannot·be·named" | 102 | 2.·Prevent·TS4058·error:·"Return·type·of·exported·function·has·or·is·using·name·X·from·external·module·Y·but·cannot·be·named" |
| 105 | @example | 103 | @example |
| Offset 125, 15 lines modified | Offset 123, 15 lines modified | ||
| 125 | //·@ts-expect-error | 123 | //·@ts-expect-error |
| 126 | type·WontWork·=·UnwrapTagged<string>; | 124 | type·WontWork·=·UnwrapTagged<string>; |
| 127 | ``` | 125 | ``` |
| 128 | @category·Type | 126 | @category·Type |
| 129 | */ | 127 | */ |
| 130 | export·type·UnwrapTagged<TaggedType·extends·Tag<PropertyKey,·any>>·= | 128 | export·type·UnwrapTagged<TaggedType·extends·Tag<PropertyKey,·any>>·= |
| 131 | RemoveAllTags<TaggedType>; | 129 | » RemoveAllTags<TaggedType>; |
| 132 | type·RemoveAllTags<T>·=·T·extends·Tag<PropertyKey,·any> | 130 | type·RemoveAllTags<T>·=·T·extends·Tag<PropertyKey,·any> |
| 133 | » ?·{ | 131 | » ?·{ |
| 134 | » » [ThisTag·in·keyof·T[typeof·tag]]:·T·extends·Tagged<infer·Type,·ThisTag,·T[typeof·tag][ThisTag]> | 132 | » » [ThisTag·in·keyof·T[typeof·tag]]:·T·extends·Tagged<infer·Type,·ThisTag,·T[typeof·tag][ThisTag]> |
| 135 | » » » ?·RemoveAllTags<Type> | 133 | » » » ?·RemoveAllTags<Type> |
| 136 | » » » :·never | 134 | » » » :·never |
| 137 | » }[keyof·T[typeof·tag]] | 135 | » }[keyof·T[typeof·tag]] |
| Offset 57, 14 lines modified | Offset 57, 15 lines modified | ||
| 57 | » » » |·'ES2018' | 57 | » » » |·'ES2018' |
| 58 | » » » |·'ES2019' | 58 | » » » |·'ES2019' |
| 59 | » » » |·'ES2020' | 59 | » » » |·'ES2020' |
| 60 | » » » |·'ES2021' | 60 | » » » |·'ES2021' |
| 61 | » » » |·'ES2022' | 61 | » » » |·'ES2022' |
| 62 | » » » |·'ES2023' | 62 | » » » |·'ES2023' |
| 63 | » » » |·'ES2024' | 63 | » » » |·'ES2024' |
| 64 | » » » |·'ES2025' | ||
| 64 | » » » |·'ESNext' | 65 | » » » |·'ESNext' |
| 65 | » » » //·Lowercase·alternatives | 66 | » » » //·Lowercase·alternatives |
| 66 | » » » |·'es3' | 67 | » » » |·'es3' |
| 67 | » » » |·'es5' | 68 | » » » |·'es5' |
| 68 | » » » |·'es6' | 69 | » » » |·'es6' |
| 69 | » » » |·'es2015' | 70 | » » » |·'es2015' |
| 70 | » » » |·'es2016' | 71 | » » » |·'es2016' |
| Offset 72, 14 lines modified | Offset 73, 15 lines modified | ||
| 72 | » » » |·'es2018' | 73 | » » » |·'es2018' |
| 73 | » » » |·'es2019' | 74 | » » » |·'es2019' |
| 74 | » » » |·'es2020' | 75 | » » » |·'es2020' |
| 75 | » » » |·'es2021' | 76 | » » » |·'es2021' |
| 76 | » » » |·'es2022' | 77 | » » » |·'es2022' |
| 77 | » » » |·'es2023' | 78 | » » » |·'es2023' |
| 78 | » » » |·'es2024' | 79 | » » » |·'es2024' |
| 80 | » » » |·'es2025' | ||
| 79 | » » » |·'esnext'; | 81 | » » » |·'esnext'; |
| 80 | » » type·Lib·= | 82 | » » type·Lib·= |
| 81 | » » » |·'ES5' | 83 | » » » |·'ES5' |
| 82 | » » » |·'ES6' | 84 | » » » |·'ES6' |
| 83 | » » » |·'ES7' | 85 | » » » |·'ES7' |
| 84 | » » » |·'ES2015' | 86 | » » » |·'ES2015' |
| Offset 144, 29 lines modified | Offset 146, 38 lines modified | ||
| 144 | » » » |·'ES2024.ArrayBuffer' | 146 | » » » |·'ES2024.ArrayBuffer' |
| 145 | » » » |·'ES2024.Collection' | 147 | » » » |·'ES2024.Collection' |
| 146 | » » » |·'ES2024.Object' | 148 | » » » |·'ES2024.Object' |
| 147 | » » » |·'ES2024.Promise' | 149 | » » » |·'ES2024.Promise' |
| 148 | » » » |·'ES2024.Regexp' | 150 | » » » |·'ES2024.Regexp' |
| 149 | » » » |·'ES2024.SharedMemory' | 151 | » » » |·'ES2024.SharedMemory' |
| 150 | » » » |·'ES2024.String' | 152 | » » » |·'ES2024.String' |
| 153 | » » » |·'ES2025' | ||
| 154 | » » » |·'ES2025.Collection' | ||
| 155 | » » » |·'ES2025.Float16' | ||
| 156 | » » » |·'ES2025.Intl' | ||
| 157 | » » » |·'ES2025.Iterator' | ||
| 158 | » » » |·'ES2025.Promise' | ||
| 159 | » » » |·'ES2025.RegExp' | ||
| 151 | » » » |·'ESNext' | 160 | » » » |·'ESNext' |
| 152 | » » » |·'ESNext.Array' | 161 | » » » |·'ESNext.Array' |
| 153 | » » » |·'ESNext.AsyncIterable' | 162 | » » » |·'ESNext.AsyncIterable' |
| 154 | » » » |·'ESNext.BigInt' | 163 | » » » |·'ESNext.BigInt' |
| 155 | » » » |·'ESNext.Collection' | 164 | » » » |·'ESNext.Collection' |
| 156 | » » » |·'ESNext.Decorators' | 165 | » » » |·'ESNext.Decorators' |
| 157 | » » » |·'ESNext.Disposable' | 166 | » » » |·'ESNext.Disposable' |
| 158 | » » » |·'ESNext.Error' | 167 | » » » |·'ESNext.Error' |
| 168 | » » » |·'ESNext.Float16' | ||
| 159 | » » » |·'ESNext.Intl' | 169 | » » » |·'ESNext.Intl' |
| 160 | » » » |·'ESNext.Iterator' | 170 | » » » |·'ESNext.Iterator' |
| 161 | » » » |·'ESNext.Object' | 171 | » » » |·'ESNext.Object' |
| 162 | » » » |·'ESNext.Promise' | 172 | » » » |·'ESNext.Promise' |
| 163 | » » » |·'ESNext.Regexp' | 173 | » » » |·'ESNext.Regexp' |
| 164 | » » » |·'ESNext.String' | 174 | » » » |·'ESNext.String' |
| 165 | » » » |·'ESNext.Symbol' | 175 | » » » |·'ESNext.Symbol' |
| 176 | » » » |·'ESNext.Temporal' | ||
| 166 | » » » |·'ESNext.WeakRef' | 177 | » » » |·'ESNext.WeakRef' |
| 167 | » » » |·'DOM' | 178 | » » » |·'DOM' |
| 168 | » » » |·'DOM.AsyncIterable' | 179 | » » » |·'DOM.AsyncIterable' |
| 169 | » » » |·'DOM.Iterable' | 180 | » » » |·'DOM.Iterable' |
| 170 | » » » |·'Decorators' | 181 | » » » |·'Decorators' |
| 171 | » » » |·'Decorators.Legacy' | 182 | » » » |·'Decorators.Legacy' |
| 172 | » » » |·'ScriptHost' | 183 | » » » |·'ScriptHost' |
| Offset 240, 29 lines modified | Offset 251, 38 lines modified | ||
| 240 | » » » |·'es2024.arraybuffer' | 251 | » » » |·'es2024.arraybuffer' |
| 241 | » » » |·'es2024.collection' | 252 | » » » |·'es2024.collection' |
| 242 | » » » |·'es2024.object' | 253 | » » » |·'es2024.object' |
| 243 | » » » |·'es2024.promise' | 254 | » » » |·'es2024.promise' |
| 244 | » » » |·'es2024.regexp' | 255 | » » » |·'es2024.regexp' |
| 245 | » » » |·'es2024.sharedmemory' | 256 | » » » |·'es2024.sharedmemory' |
| 246 | » » » |·'es2024.string' | 257 | » » » |·'es2024.string' |
| 258 | » » » |·'es2025' | ||
| 259 | » » » |·'es2025.collection' | ||
| 260 | » » » |·'es2025.float16' | ||
| 261 | » » » |·'es2025.intl' | ||
| 262 | » » » |·'es2025.iterator' | ||
| 263 | » » » |·'es2025.promise' | ||
| 264 | » » » |·'es2025.regexp' | ||
| 247 | » » » |·'esnext' | 265 | » » » |·'esnext' |
| 248 | » » » |·'esnext.array' | 266 | » » » |·'esnext.array' |
| 249 | » » » |·'esnext.asynciterable' | 267 | » » » |·'esnext.asynciterable' |
| 250 | » » » |·'esnext.bigint' | 268 | » » » |·'esnext.bigint' |
| 251 | » » » |·'esnext.collection' | 269 | » » » |·'esnext.collection' |
| 252 | » » » |·'esnext.decorators' | 270 | » » » |·'esnext.decorators' |
| 253 | » » » |·'esnext.disposable' | 271 | » » » |·'esnext.disposable' |
| 254 | » » » |·'esnext.error' | 272 | » » » |·'esnext.error' |
| 273 | » » » |·'esnext.float16' | ||
| 255 | » » » |·'esnext.intl' | 274 | » » » |·'esnext.intl' |
| 256 | » » » |·'esnext.iterator' | 275 | » » » |·'esnext.iterator' |
| 257 | » » » |·'esnext.object' | 276 | » » » |·'esnext.object' |
| 258 | » » » |·'esnext.promise' | 277 | » » » |·'esnext.promise' |
| 259 | » » » |·'esnext.regexp' | 278 | » » » |·'esnext.regexp' |
| Max diff block lines reached; 4334/6374 bytes (67.99%) of diff not shown. | |||
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Convert·a·union·type·to·an·intersection·type | 2 | Convert·a·union·type·to·an·intersection·type. |
| 3 | Inspired·by·[this·Stack·Overflow·answer](https://stackoverflow.com/a/50375286/2172153). | 3 | Inspired·by·[this·Stack·Overflow·answer](https://stackoverflow.com/a/50375286/2172153). |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{UnionToIntersection}·from·'type-fest'; | 6 | import·type·{UnionToIntersection}·from·'type-fest'; |
| Offset 1, 10 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{ExcludeExactly}·from·'./exclude-exactly.d.ts'; | 1 | import·type·{ExcludeExactly}·from·'./exclude-exactly.d.ts'; |
| 2 | import·type·{IsNever}·from·'./is-never.d.ts'; | 2 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 3 | import·type·{UnionMember}·from·'./union-member.d.ts'; | 3 | import·type·{UnionMember}·from·'./union-member.d.ts'; |
| 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | ||
| 4 | /** | 5 | /** |
| 5 | Convert·a·union·type·into·an·unordered·tuple·type·of·its·elements. | 6 | Convert·a·union·type·into·an·unordered·tuple·type·of·its·elements. |
| 6 | "Unordered"·means·the·elements·of·the·tuple·are·not·guaranteed·to·be·in·the·same·order·as·in·the·union·type.·The·arrangement·can·appear·random·and·may·change·at·any·time. | 7 | "Unordered"·means·the·elements·of·the·tuple·are·not·guaranteed·to·be·in·the·same·order·as·in·the·union·type.·The·arrangement·can·appear·random·and·may·change·at·any·time. |
| 7 | This·can·be·useful·when·you·have·objects·with·a·finite·set·of·keys·and·want·a·type·defining·only·the·allowed·keys,·but·do·not·want·to·repeat·yourself. | 8 | This·can·be·useful·when·you·have·objects·with·a·finite·set·of·keys·and·want·a·type·defining·only·the·allowed·keys,·but·do·not·want·to·repeat·yourself. |
| Offset 33, 13 lines modified | Offset 34, 16 lines modified | ||
| 33 | const·petList·=·Object.keys(pets)·as·UnionToTuple<Pet>; | 34 | const·petList·=·Object.keys(pets)·as·UnionToTuple<Pet>; |
| 34 | //=>·['dog',·'cat',·'snake'] | 35 | //=>·['dog',·'cat',·'snake'] |
| 35 | ``` | 36 | ``` |
| 36 | @category·Array | 37 | @category·Array |
| 37 | */ | 38 | */ |
| 38 | export·type·UnionToTuple< | 39 | export·type·UnionToTuple<Union>·= |
| 39 | IsNever<T>·extends·false | ||
| 40 | » ?·[...UnionToTuple<ExcludeExactly<T,·L>>,·L] | ||
| 41 | » :· | 40 | » _UnionToTuple<Union>·extends·infer·Result·extends·UnknownArray·?·Result·:·never;·//·Nudges·the·compiler·that·`UnionToTuple`·always·yields·an·array. |
| 41 | type·_UnionToTuple<Union,·Accumulator·extends·UnknownArray·=·[],·Member·=·UnionMember<Union>>·= | ||
| 42 | » IsNever<Union>·extends·true | ||
| 43 | » » ?·Accumulator | ||
| 44 | » » :·_UnionToTuple<ExcludeExactly<Union,·Member>,·[Member,·...Accumulator]>; | ||
| 42 | export·{}; | 45 | export·{}; |
| Offset 1, 9 lines modified | Offset 1, 10 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{ |
| 2 | » ApplyDefaultOptions, | 2 | » ApplyDefaultOptions, |
| 3 | » AsciiPunctuation, | ||
| 3 | » IsNumeric, | 4 | » IsNumeric, |
| 4 | » WordSeparators, | 5 | » WordSeparators, |
| 5 | }·from·'./internal/index.d.ts'; | 6 | }·from·'./internal/index.d.ts'; |
| 6 | import·type·{IsLowercase}·from·'./is-lowercase.d.ts'; | 7 | import·type·{IsLowercase}·from·'./is-lowercase.d.ts'; |
| 7 | import·type·{IsUppercase}·from·'./is-uppercase.d.ts'; | 8 | import·type·{IsUppercase}·from·'./is-uppercase.d.ts'; |
| 8 | type·SkipEmptyWord<Word·extends·string>·=·Word·extends·''·?·[]·:·[Word]; | 9 | type·SkipEmptyWord<Word·extends·string>·=·Word·extends·''·?·[]·:·[Word]; |
| Offset 34, 25 lines modified | Offset 35, 42 lines modified | ||
| 34 | » //=>·['p',·'2',·'p',·'Network'] | 35 | » //=>·['p',·'2',·'p',·'Network'] |
| 35 | » type·Example2·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; | 36 | » type·Example2·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; |
| 36 | » //=>·['p2p',·'Network'] | 37 | » //=>·['p2p',·'Network'] |
| 37 | » ``` | 38 | » ``` |
| 38 | » */ | 39 | » */ |
| 39 | » splitOnNumbers?:·boolean; | 40 | » splitOnNumbers?:·boolean; |
| 41 | » /** | ||
| 42 | » Split·on·{@link·AsciiPunctuation·|·punctuation·characters}·(e.g.,·`#`,·`&`,·`*`,·`:`,·`?`,·`@`,·`~`). | ||
| 43 | » @example | ||
| 44 | » ``` | ||
| 45 | » import·type·{Words}·from·'type-fest'; | ||
| 46 | » type·Example1·=·Words<'hello:world',·{splitOnPunctuation:·true}>; | ||
| 47 | » //=>·['hello',·'world'] | ||
| 48 | » type·Example2·=·Words<'hello:world',·{splitOnPunctuation:·false}>; | ||
| 49 | » //=>·['hello',·':world'] | ||
| 50 | » ``` | ||
| 51 | » */ | ||
| 52 | » splitOnPunctuation?:·boolean; | ||
| 40 | }; | 53 | }; |
| 41 | export·type·_DefaultWordsOptions·=·{ | 54 | export·type·_DefaultWordsOptions·=·{ |
| 42 | » splitOnNumbers:·true; | 55 | » splitOnNumbers:·true; |
| 56 | » splitOnPunctuation:·false; | ||
| 43 | }; | 57 | }; |
| 44 | /** | 58 | /** |
| 45 | Split·a·string· | 59 | Split·a·string·similar·to·Lodash's·`_.words()`·function. |
| 46 | -·Split·on·each·word·that·begins·with·a·capital·letter. | 60 | -·Split·on·each·word·that·begins·with·a·capital·letter. |
| 47 | -·Split·on·each·{@link·WordSeparators}. | 61 | -·Split·on·each·{@link·WordSeparators}. |
| 62 | -·Split·on·each·{@link·AsciiPunctuation}·(if·{@link·WordsOptions.splitOnPunctuation}·is·enabled). | ||
| 48 | -·Split·on·numeric·sequence. | 63 | -·Split·on·numeric·sequence. |
| 49 | @example | 64 | @example |
| 50 | ``` | 65 | ``` |
| 51 | import·type·{Words}·from·'type-fest'; | 66 | import·type·{Words}·from·'type-fest'; |
| 52 | type·Words0·=·Words<'helloWorld'>; | 67 | type·Words0·=·Words<'helloWorld'>; |
| Offset 68, 29 lines modified | Offset 86, 37 lines modified | ||
| 68 | //=>·['hello',·'the',·'world'] | 86 | //=>·['hello',·'the',·'world'] |
| 69 | type·Words4·=·Words<'lifeIs42'>; | 87 | type·Words4·=·Words<'lifeIs42'>; |
| 70 | //=>·['life',·'Is',·'42'] | 88 | //=>·['life',·'Is',·'42'] |
| 71 | type·Words5·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; | 89 | type·Words5·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; |
| 72 | //=>·['p2p',·'Network'] | 90 | //=>·['p2p',·'Network'] |
| 91 | type·Words6·=·Words<'hello:world',·{splitOnPunctuation:·true}>; | ||
| 92 | //=>·['hello',·'world'] | ||
| 93 | type·Words7·=·Words<'hello:world',·{splitOnPunctuation:·false}>; | ||
| 94 | //=>·['hello',·':world'] | ||
| 95 | type·Words8·=·Words<'hello::world',·{splitOnPunctuation:·true}>; | ||
| 96 | //=>·['hello',·'world'] | ||
| 73 | ``` | 97 | ``` |
| 74 | @category·Change·case | 98 | @category·Change·case |
| 75 | @category·Template·literal | 99 | @category·Template·literal |
| 76 | */ | 100 | */ |
| 101 | export·type·Words<Sentence·extends·string,·Options·extends·WordsOptions·=·{}>·=·WordsImplementation<Sentence,·ApplyDefaultOptions<WordsOptions,·_DefaultWordsOptions,·Options>>; | ||
| 77 | export·type·Words<Sentence·extends·string,·Options·extends·WordsOptions·=·{}>·= | ||
| 78 | » WordsImplementation<Sentence,·ApplyDefaultOptions<WordsOptions,·_DefaultWordsOptions,·Options>>; | ||
| 79 | type·WordsImplementation< | 102 | type·WordsImplementation< |
| 80 | » Sentence·extends·string, | 103 | » Sentence·extends·string, |
| 81 | » Options·extends·Required<WordsOptions>, | 104 | » Options·extends·Required<WordsOptions>, |
| 82 | » LastCharacter·extends·string·=·'', | 105 | » LastCharacter·extends·string·=·'', |
| 83 | » CurrentWord·extends·string·=·'', | 106 | » CurrentWord·extends·string·=·'', |
| 84 | >·=·Sentence·extends·`${infer·FirstCharacter}${infer·RemainingCharacters}` | 107 | >·=·Sentence·extends·`${infer·FirstCharacter}${infer·RemainingCharacters}` |
| 85 | » ?·FirstCharacter·extends·WordSeparators | 108 | » ?·FirstCharacter·extends·WordSeparators·|·(Options['splitOnPunctuation']·extends·true·?·AsciiPunctuation·:·never) |
| 86 | » » //·Skip·word·separator | 109 | » » //·Skip·word·separator |
| 87 | » » ?·[...SkipEmptyWord<CurrentWord>,·...WordsImplementation<RemainingCharacters,·Options>] | 110 | » » ?·[...SkipEmptyWord<CurrentWord>,·...WordsImplementation<RemainingCharacters,·Options>] |
| 88 | » » :·LastCharacter·extends·'' | 111 | » » :·LastCharacter·extends·'' |
| 89 | » » » //·Fist·char·of·word | 112 | » » » //·Fist·char·of·word |
| 90 | » » » ?·WordsImplementation<RemainingCharacters,·Options,·FirstCharacter,·FirstCharacter> | 113 | » » » ?·WordsImplementation<RemainingCharacters,·Options,·FirstCharacter,·FirstCharacter> |
| 91 | » » » //·Case·change:·non-numeric·to·numeric | 114 | » » » //·Case·change:·non-numeric·to·numeric |
| 92 | » » » :·[false,·true]·extends·[IsNumeric<LastCharacter>,·IsNumeric<FirstCharacter>] | 115 | » » » :·[false,·true]·extends·[IsNumeric<LastCharacter>,·IsNumeric<FirstCharacter>] |
| Offset 46, 23 lines modified | Offset 46, 23 lines modified | ||
| 46 | const·writableArray:·Writable<typeof·readonlyArray>·=·readonlyArray·as·Writable<typeof·readonlyArray>; | 46 | const·writableArray:·Writable<typeof·readonlyArray>·=·readonlyArray·as·Writable<typeof·readonlyArray>; |
| 47 | writableArray.push(4);·//·Will·work·as·the·array·itself·is·now·writable. | 47 | writableArray.push(4);·//·Will·work·as·the·array·itself·is·now·writable. |
| 48 | ``` | 48 | ``` |
| 49 | @category·Object | 49 | @category·Object |
| 50 | */ | 50 | */ |
| 51 | export·type·Writable<BaseType,·Keys·extends·keyof·BaseType·=·keyof·BaseType>·= | 51 | export·type·Writable<BaseType,·Keys·extends·keyof·BaseType·=·keyof·BaseType>·= |
| 52 | BaseType·extends·ReadonlyMap<infer·KeyType,·infer·ValueType> | 52 | » BaseType·extends·ReadonlyMap<infer·KeyType,·infer·ValueType> |
| 53 | » ?·Map<KeyType,·ValueType> | 53 | » » ?·Map<KeyType,·ValueType> |
| 54 | » :·BaseType·extends·ReadonlySet<infer·ItemType> | 54 | » » :·BaseType·extends·ReadonlySet<infer·ItemType> |
| 55 | » » ?·Set<ItemType> | 55 | » » » ?·Set<ItemType> |
| 56 | » » :·BaseType·extends·readonly·unknown[] | 56 | » » » :·BaseType·extends·readonly·unknown[] |
| 57 | » » » //·Handle·array | 57 | » » » » //·Handle·array |
| 58 | » » » ?·WritableArray<BaseType> | 58 | » » » » ?·WritableArray<BaseType> |
| 59 | » » » //·Handle·object | 59 | » » » » //·Handle·object |
| 60 | » » » :·Simplify< | 60 | » » » » :·Simplify< |
| 61 | » » » //·Pick·just·the·keys·that·are·not·writable·from·the·base·type. | 61 | » » » » » //·Pick·just·the·keys·that·are·not·writable·from·the·base·type. |
| 62 | » » » » Except<BaseType,·Keys> | 62 | » » » » » Except<BaseType,·Keys> |
| 63 | » » » //·Pick·the·keys·that·should·be·writable·from·the·base·type·and·make·them·writable·by·removing·the·`readonly`·modifier·from·the·key. | 63 | » » » » » //·Pick·the·keys·that·should·be·writable·from·the·base·type·and·make·them·writable·by·removing·the·`readonly`·modifier·from·the·key. |
| 64 | » » » » {-readonly·[KeyType·in·keyof·Pick<BaseType,·Keys>]:·Pick<BaseType,·Keys>[KeyType]} | 64 | » » » » » &·{-readonly·[KeyType·in·keyof·Pick<BaseType,·Keys>]:·Pick<BaseType,·Keys>[KeyType]} |
| 65 | » » » >; | 65 | » » » » >; |
| 66 | export·{}; | 66 | export·{}; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Not}·from·'./internal/type.d.ts'; | 1 | import·type·{Not}·from·'./internal/type.d.ts'; |
| 2 | import·type·{And}·from·'./and.d.ts'; | 2 | import·type·{And}·from·'./and.d.ts'; |
| 3 | import·type·{Or}·from·'./or.d.ts'; | 3 | import·type·{Or}·from·'./or.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Returns·a·boolean·for·whether·only·one·of·two·given·types·is·true. | 5 | Returns·a·boolean·for·whether·only·one·of·two·given·types·is·`true`. |
| 6 | Use-case:·Constructing·complex·conditional·types·where·one·single·condition·must·be·satisfied. | 6 | Use-case:·Constructing·complex·conditional·types·where·one·single·condition·must·be·satisfied. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{Xor}·from·'type-fest'; | 9 | import·type·{Xor}·from·'type-fest'; |
| Offset 48, 14 lines modified | Offset 48, 15 lines modified | ||
| 48 | export·type·{InvariantOf}·from·'./source/invariant-of.d.ts'; | 48 | export·type·{InvariantOf}·from·'./source/invariant-of.d.ts'; |
| 49 | export·type·{SetOptional}·from·'./source/set-optional.d.ts'; | 49 | export·type·{SetOptional}·from·'./source/set-optional.d.ts'; |
| 50 | export·type·{SetReadonly}·from·'./source/set-readonly.d.ts'; | 50 | export·type·{SetReadonly}·from·'./source/set-readonly.d.ts'; |
| 51 | export·type·{SetRequired}·from·'./source/set-required.d.ts'; | 51 | export·type·{SetRequired}·from·'./source/set-required.d.ts'; |
| 52 | export·type·{SetRequiredDeep}·from·'./source/set-required-deep.d.ts'; | 52 | export·type·{SetRequiredDeep}·from·'./source/set-required-deep.d.ts'; |
| 53 | export·type·{SetNonNullable}·from·'./source/set-non-nullable.d.ts'; | 53 | export·type·{SetNonNullable}·from·'./source/set-non-nullable.d.ts'; |
| 54 | export·type·{SetNonNullableDeep}·from·'./source/set-non-nullable-deep.d.ts'; | 54 | export·type·{SetNonNullableDeep}·from·'./source/set-non-nullable-deep.d.ts'; |
| 55 | export·type·{NonNullableDeep}·from·'./source/non-nullable-deep.d.ts'; | ||
| 55 | export·type·{ValueOf}·from·'./source/value-of.d.ts'; | 56 | export·type·{ValueOf}·from·'./source/value-of.d.ts'; |
| 56 | export·type·{AsyncReturnType}·from·'./source/async-return-type.d.ts'; | 57 | export·type·{AsyncReturnType}·from·'./source/async-return-type.d.ts'; |
| 57 | export·type·{ConditionalExcept}·from·'./source/conditional-except.d.ts'; | 58 | export·type·{ConditionalExcept}·from·'./source/conditional-except.d.ts'; |
| 58 | export·type·{ConditionalKeys}·from·'./source/conditional-keys.d.ts'; | 59 | export·type·{ConditionalKeys}·from·'./source/conditional-keys.d.ts'; |
| 59 | export·type·{ConditionalPick}·from·'./source/conditional-pick.d.ts'; | 60 | export·type·{ConditionalPick}·from·'./source/conditional-pick.d.ts'; |
| 60 | export·type·{ConditionalPickDeep,·ConditionalPickDeepOptions}·from·'./source/conditional-pick-deep.d.ts'; | 61 | export·type·{ConditionalPickDeep,·ConditionalPickDeepOptions}·from·'./source/conditional-pick-deep.d.ts'; |
| 61 | export·type·{UnionToIntersection}·from·'./source/union-to-intersection.d.ts'; | 62 | export·type·{UnionToIntersection}·from·'./source/union-to-intersection.d.ts'; |
| Offset 169, 14 lines modified | Offset 170, 16 lines modified | ||
| 169 | export·type·{IsUppercase}·from·'./source/is-uppercase.d.ts'; | 170 | export·type·{IsUppercase}·from·'./source/is-uppercase.d.ts'; |
| 170 | export·type·{IsOptional}·from·'./source/is-optional.d.ts'; | 171 | export·type·{IsOptional}·from·'./source/is-optional.d.ts'; |
| 171 | export·type·{IsNullable}·from·'./source/is-nullable.d.ts'; | 172 | export·type·{IsNullable}·from·'./source/is-nullable.d.ts'; |
| 172 | export·type·{TupleOf}·from·'./source/tuple-of.d.ts'; | 173 | export·type·{TupleOf}·from·'./source/tuple-of.d.ts'; |
| 173 | export·type·{ExclusifyUnion}·from·'./source/exclusify-union.d.ts'; | 174 | export·type·{ExclusifyUnion}·from·'./source/exclusify-union.d.ts'; |
| 174 | export·type·{ArrayReverse}·from·'./source/array-reverse.d.ts'; | 175 | export·type·{ArrayReverse}·from·'./source/array-reverse.d.ts'; |
| 175 | export·type·{UnionMember}·from·'./source/union-member.d.ts'; | 176 | export·type·{UnionMember}·from·'./source/union-member.d.ts'; |
| 177 | export·type·{Absolute}·from·'./source/absolute.d.ts'; | ||
| 178 | export·type·{UnionLength}·from·'./source/union-length.d.ts'; | ||
| 176 | //·Template·literal·types | 179 | //·Template·literal·types |
| 177 | export·type·{CamelCase,·CamelCaseOptions}·from·'./source/camel-case.d.ts'; | 180 | export·type·{CamelCase,·CamelCaseOptions}·from·'./source/camel-case.d.ts'; |
| 178 | export·type·{CamelCasedProperties}·from·'./source/camel-cased-properties.d.ts'; | 181 | export·type·{CamelCasedProperties}·from·'./source/camel-cased-properties.d.ts'; |
| 179 | export·type·{CamelCasedPropertiesDeep}·from·'./source/camel-cased-properties-deep.d.ts'; | 182 | export·type·{CamelCasedPropertiesDeep}·from·'./source/camel-cased-properties-deep.d.ts'; |
| 180 | export·type·{KebabCase}·from·'./source/kebab-case.d.ts'; | 183 | export·type·{KebabCase}·from·'./source/kebab-case.d.ts'; |
| 181 | export·type·{KebabCasedProperties}·from·'./source/kebab-cased-properties.d.ts'; | 184 | export·type·{KebabCasedProperties}·from·'./source/kebab-cased-properties.d.ts'; |
| Offset 5, 25 lines modified | Offset 5, 27 lines modified | ||
| 5 | ········"url":·"https://sindresorhus.com" | 5 | ········"url":·"https://sindresorhus.com" |
| 6 | ····}, | 6 | ····}, |
| 7 | ····"dependencies":·{ | 7 | ····"dependencies":·{ |
| 8 | ········"tagged-tag":·"^1.0.0" | 8 | ········"tagged-tag":·"^1.0.0" |
| 9 | ····}, | 9 | ····}, |
| 10 | ····"description":·"A·collection·of·essential·TypeScript·types", | 10 | ····"description":·"A·collection·of·essential·TypeScript·types", |
| 11 | ····"devDependencies":·{ | 11 | ····"devDependencies":·{ |
| 12 | ········"@eslint/markdown":·"^8.0.1", | ||
| 12 | ········"@sindresorhus/tsconfig":·"^8.0.1", | 13 | ········"@sindresorhus/tsconfig":·"^8.0.1", |
| 14 | ········"@types/node":·"^25.5.0", | ||
| 13 | ········"@typescript-eslint/parser":·"^8.44.0", | 15 | ········"@typescript-eslint/parser":·"^8.44.0", |
| 14 | ········"@typescript/vfs":·"^1.6.1", | 16 | ········"@typescript/vfs":·"^1.6.1", |
| 15 | ········"dedent":·"^1.7.0", | 17 | ········"dedent":·"^1.7.0", |
| 16 | ········"eslint":·"^ | 18 | ········"eslint":·"^10.1.0", |
| 17 | ········"expect-type":·"^1.2.2", | 19 | ········"expect-type":·"^1.2.2", |
| 18 | ········"npm-run-all2":·"^8.0.4", | 20 | ········"npm-run-all2":·"^8.0.4", |
| 19 | ········"tsd":·"^0.33.0", | 21 | ········"tsd":·"^0.33.0", |
| 20 | ········"typescript":·"^5.9.2", | 22 | ········"typescript":·"^5.9.2", |
| 21 | ········"typescript-eslint":·"^8.47.0", | 23 | ········"typescript-eslint":·"^8.47.0", |
| 22 | ········"xo":·"^ | 24 | ········"xo":·"^2.0.2" |
| 23 | ····}, | 25 | ····}, |
| 24 | ····"engines":·{ | 26 | ····"engines":·{ |
| 25 | ········"node":·">=20" | 27 | ········"node":·">=20" |
| 26 | ····}, | 28 | ····}, |
| 27 | ····"exports":·{ | 29 | ····"exports":·{ |
| 28 | ········".":·{ | 30 | ········".":·{ |
| 29 | ············"types":·"./index.d.ts" | 31 | ············"types":·"./index.d.ts" |
| Offset 55, 19 lines modified | Offset 57, 19 lines modified | ||
| 55 | ····"name":·"type-fest", | 57 | ····"name":·"type-fest", |
| 56 | ····"repository":·"sindresorhus/type-fest", | 58 | ····"repository":·"sindresorhus/type-fest", |
| 57 | ····"scripts":·{ | 59 | ····"scripts":·{ |
| 58 | ········"test":·"run-p·test:*", | 60 | ········"test":·"run-p·test:*", |
| 59 | ········"test:linter":·"node·--test", | 61 | ········"test:linter":·"node·--test", |
| 60 | ········"test:tsc":·"node·--max-old-space-size=6144·./node_modules/.bin/tsc", | 62 | ········"test:tsc":·"node·--max-old-space-size=6144·./node_modules/.bin/tsc", |
| 61 | ········"test:tsd":·"node·--max-old-space-size=6144·./node_modules/.bin/tsd", | 63 | ········"test:tsd":·"node·--max-old-space-size=6144·./node_modules/.bin/tsd", |
| 62 | ········"test:xo":·"node·--max-old-space-size=6144·./node_modules/.bin/xo·--ignores=lint-processors/fixtures/**/*.d.ts" | 64 | ········"test:xo":·"node·--max-old-space-size=6144·./node_modules/.bin/xo·--ignores=lint-processors/fixtures/**/*.d.ts·'**/*.{js,ts,md}'" |
| 63 | ····}, | 65 | ····}, |
| 64 | ····"sideEffects":·false, | 66 | ····"sideEffects":·false, |
| 65 | ····"tsd":·{ | 67 | ····"tsd":·{ |
| 66 | ········"compilerOptions":·{ | 68 | ········"compilerOptions":·{ |
| 67 | ············"noUnusedLocals":·false | 69 | ············"noUnusedLocals":·false |
| 68 | ········} | 70 | ········} |
| 69 | ····}, | 71 | ····}, |
| 70 | ····"type":·"module", | 72 | ····"type":·"module", |
| 71 | ····"types":·"./index.d.ts", | 73 | ····"types":·"./index.d.ts", |
| 72 | ····"version":·"5. | 74 | ····"version":·"5.6.0" |
| 73 | } | 75 | } |
| Offset 25, 14 lines modified | Offset 25, 25 lines modified | ||
| 25 | » » » » » <img·width="230"·src="https://sindresorhus.com/assets/thanks/nitric-logo.svg"·alt="nitric·logo"> | 25 | » » » » » <img·width="230"·src="https://sindresorhus.com/assets/thanks/nitric-logo.svg"·alt="nitric·logo"> |
| 26 | » » » » </div> | 26 | » » » » </div> |
| 27 | » » » » <b>Effortless·backends·with·infrastructure·from·code</b> | 27 | » » » » <b>Effortless·backends·with·infrastructure·from·code</b> |
| 28 | » » » » <div> | 28 | » » » » <div> |
| 29 | » » » » » <sup>An·open-source·framework·that·supports·any·programming·language,·cloud·provider,·or·deployment·automation·tool.</sup> | 29 | » » » » » <sup>An·open-source·framework·that·supports·any·programming·language,·cloud·provider,·or·deployment·automation·tool.</sup> |
| 30 | » » » » </div> | 30 | » » » » </div> |
| 31 | » » » </a> | 31 | » » » </a> |
| 32 | » » » <br> | ||
| 33 | » » » <br> | ||
| 34 | » » » <a·href="https://circleback.ai?utm_source=sindresorhus&utm_medium=sponsorship&utm_campaign=awesome-list&utm_id=type-fest"> | ||
| 35 | » » » » <div> | ||
| 36 | » » » » » <img·width="300"·src="https://sindresorhus.com/assets/thanks/circleback-logo.png?x"·alt="Circleback·logo"> | ||
| 37 | » » » » </div> | ||
| 38 | » » » » <b>Get·the·most·out·of·every·conversation.</b> | ||
| 39 | » » » » <div> | ||
| 40 | » » » » » <sup>AI-powered·meeting·notes,·automations,·and·search.·Give·AI·agents·the·context·they·need·to·get·things·done.</sup> | ||
| 41 | » » » » </div> | ||
| 42 | » » » </a> | ||
| 32 | » » </p> | 43 | » » </p> |
| 33 | » </div> | 44 | » </div> |
| 34 | » <br> | 45 | » <br> |
| 35 | » <hr> | 46 | » <hr> |
| 36 | </div> | 47 | </div> |
| 37 | <br> | 48 | <br> |
| 38 | <br> | 49 | <br> |
| Offset 98, 92 lines modified | Offset 109, 93 lines modified | ||
| 98 | -·[`EmptyObject`](source/empty-object.d.ts)·-·Represents·a·strictly·empty·plain·object,·the·`{}`·value. | 109 | -·[`EmptyObject`](source/empty-object.d.ts)·-·Represents·a·strictly·empty·plain·object,·the·`{}`·value. |
| 99 | -·[`NonEmptyObject`](source/non-empty-object.d.ts)·-·Represents·an·object·with·at·least·1·non-optional·key. | 110 | -·[`NonEmptyObject`](source/non-empty-object.d.ts)·-·Represents·an·object·with·at·least·1·non-optional·key. |
| 100 | -·[`UnknownRecord`](source/unknown-record.d.ts)·-·Represents·an·object·with·`unknown`·value.·You·probably·want·this·instead·of·`{}`. | 111 | -·[`UnknownRecord`](source/unknown-record.d.ts)·-·Represents·an·object·with·`unknown`·value.·You·probably·want·this·instead·of·`{}`. |
| 101 | -·[`UnknownArray`](source/unknown-array.d.ts)·-·Represents·an·array·with·`unknown`·value. | 112 | -·[`UnknownArray`](source/unknown-array.d.ts)·-·Represents·an·array·with·`unknown`·value. |
| 102 | -·[`UnknownMap`](source/unknown-map.d.ts)·-·Represents·a·map·with·`unknown`·key·and·value. | 113 | -·[`UnknownMap`](source/unknown-map.d.ts)·-·Represents·a·map·with·`unknown`·key·and·value. |
| 103 | -·[`UnknownSet`](source/unknown-set.d.ts)·-·Represents·a·set·with·`unknown`·value. | 114 | -·[`UnknownSet`](source/unknown-set.d.ts)·-·Represents·a·set·with·`unknown`·value. |
| 104 | -·[`Except`](source/except.d.ts)·-·Create·a·type·from·an·object·type·without·certain·keys. | 115 | -·[`Except`](source/except.d.ts)·-·Create·a·type·from·an·object·type·without·certain·keys. |
| 105 | -·[`Writable`](source/writable.d.ts)·-·Create·a·type·that·strips·`readonly`·from·the·given·type.·Inverse·of·`Readonly<T>`. | 116 | -·[`Writable`](source/writable.d.ts)·-·Create·a·type·that·strips·`readonly`·from·the·given·type.·Inverse·of·`Readonly<T>`. |
| 106 | -·[`WritableDeep`](source/writable-deep.d.ts)·-·Create·a·deeply·mutable·version·of·an·`object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray`·type.·The·inverse·of·`ReadonlyDeep<T>`.·Use·`Writable<T>`·if·you·only·need·one·level·deep. | 117 | -·[`WritableDeep`](source/writable-deep.d.ts)·-·Create·a·deeply·mutable·version·of·an·`object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray`·type.·The·inverse·of·`ReadonlyDeep<T>`.·Use·`Writable<T>`·if·you·only·need·one·level·deep. |
| 107 | -·[`Merge`](source/merge.d.ts)·-·Merge·two·types·into·a·new·type.·Keys·of·the·second·type·overrides·keys·of·the·first·type. | 118 | -·[`Merge`](source/merge.d.ts)·-·Merge·two·types·into·a·new·type.·Keys·of·the·second·type·overrides·keys·of·the·first·type. |
| 108 | -·[`ObjectMerge`](source/object-merge.d.ts)·-·Merge·two·object·types·into·a·new·object·type,·where·keys·from·the·second·override·keys·from·the·first. | 119 | -·[`ObjectMerge`](source/object-merge.d.ts)·-·Merge·two·object·types·into·a·new·object·type,·where·keys·from·the·second·override·keys·from·the·first. |
| 109 | -·[`MergeDeep`](source/merge-deep.d.ts)·-·Merge·two·objects·or·two·arrays/tuples·recursively·into·a·new·type. | 120 | -·[`MergeDeep`](source/merge-deep.d.ts)·-·Merge·two·objects·or·two·arrays/tuples·recursively·into·a·new·type. |
| 110 | -·[`MergeExclusive`](source/merge-exclusive.d.ts)·-·Create·a·type·that·has·mutually·exclusive·keys. | 121 | -·[`MergeExclusive`](source/merge-exclusive.d.ts)·-·Create·a·type·that·has·mutually·exclusive·keys. |
| 111 | -·[`OverrideProperties`](source/override-properties.d.ts)·-·Override· | 122 | -·[`OverrideProperties`](source/override-properties.d.ts)·-·Override·existing·properties·of·the·given·type.·Similar·to·`Merge`,·but·enforces·that·the·original·type·has·the·properties·you·want·to·override. |
| 112 | -·[`RequireAtLeastOne`](source/require-at-least-one.d.ts)·-·Create·a·type·that·requires·at·least·one·of·the·given·keys. | 123 | -·[`RequireAtLeastOne`](source/require-at-least-one.d.ts)·-·Create·a·type·that·requires·at·least·one·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 113 | -·[`RequireExactlyOne`](source/require-exactly-one.d.ts)·-·Create·a·type·that·requires·exactly· | 124 | -·[`RequireExactlyOne`](source/require-exactly-one.d.ts)·-·Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more,·while·keeping·the·remaining·keys·as·is. |
| 114 | -·[`RequireAllOrNone`](source/require-all-or-none.d.ts)·-·Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys. | 125 | -·[`RequireAllOrNone`](source/require-all-or-none.d.ts)·-·Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 115 | -·[`RequireOneOrNone`](source/require-one-or-none.d.ts)·-·Create·a·type·that·requires·exactly· | 126 | -·[`RequireOneOrNone`](source/require-one-or-none.d.ts)·-·Create·a·type·that·requires·exactly·one·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 116 | -·[`SingleKeyObject`](source/single-key-object.d.ts)·-·Create·a·type·that·only·accepts·an·object·with·a·single·key. | 127 | -·[`SingleKeyObject`](source/single-key-object.d.ts)·-·Create·a·type·that·only·accepts·an·object·with·a·single·key. |
| 117 | -·[`RequiredDeep`](source/required-deep.d.ts)·-·Create·a·deeply·required·version·of·another·type.·Use·[`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype)·if·you·only·need·one·level·deep. | ||
| 118 | -·[`PickDeep`](source/pick-deep.d.ts)·-·Pick·properties·from·a·deeply-nested·object.·Use·[`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)·if·you·only·need·one·level·deep. | ||
| 119 | -·[` | 128 | -·[`RequiredDeep`](source/required-deep.d.ts)·-·Create·a·deeply·required·version·of·another·type. |
| 129 | -·[`PickDeep`](source/pick-deep.d.ts)·-·Pick·properties·from·a·deeply-nested·object. | ||
| 130 | -·[`OmitDeep`](source/omit-deep.d.ts)·-·Omit·properties·from·a·deeply-nested·object. | ||
| 120 | -·[`OmitIndexSignature`](source/omit-index-signature.d.ts)·-·Omit·any·index·signatures·from·the·given·object·type,·leaving·only·explicitly·defined·properties. | 131 | -·[`OmitIndexSignature`](source/omit-index-signature.d.ts)·-·Omit·any·index·signatures·from·the·given·object·type,·leaving·only·explicitly·defined·properties. |
| 121 | -·[`PickIndexSignature`](source/pick-index-signature.d.ts)·-·Pick·only·index·signatures·from·the·given·object·type,·leaving·out·all·explicitly·defined·properties. | 132 | -·[`PickIndexSignature`](source/pick-index-signature.d.ts)·-·Pick·only·index·signatures·from·the·given·object·type,·leaving·out·all·explicitly·defined·properties. |
| 122 | -·[`PartialDeep`](source/partial-deep.d.ts)·-·Create·a·deeply·optional·version·of·another·type. | 133 | -·[`PartialDeep`](source/partial-deep.d.ts)·-·Create·a·deeply·optional·version·of·another·type. |
| 123 | -·[`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·keys·accepting·`undefined`·type·are·set·to·optional. | 134 | -·[`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·keys·accepting·`undefined`·type·are·set·to·optional. |
| 124 | -·[`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·optional·keys·are·set·to·also·accept·`undefined`. | 135 | -·[`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·optional·keys·are·set·to·also·accept·`undefined`. |
| 125 | -·[`UnwrapPartial`](source/unwrap-partial.d.ts)·-·Revert·the·`Partial`·modifier·on·an·object·type. | 136 | -·[`UnwrapPartial`](source/unwrap-partial.d.ts)·-·Revert·the·`Partial`·modifier·on·an·object·type. |
| 126 | -·[`ReadonlyDeep`](source/readonly-deep.d.ts)·-·Create·a·deeply·immutable·version·of·an | 137 | -·[`ReadonlyDeep`](source/readonly-deep.d.ts)·-·Create·a·deeply·immutable·version·of·another·type. |
| 127 | -·[`LiteralUnion`](source/literal-union.d.ts)·-·Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. | 138 | -·[`LiteralUnion`](source/literal-union.d.ts)·-·Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. |
| 128 | -·[`Tagged`](source/tagged.d.ts)·-·Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). | 139 | -·[`Tagged`](source/tagged.d.ts)·-·Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). |
| 129 | -·[`UnwrapTagged`](source/tagged.d.ts)·-·Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. | 140 | -·[`UnwrapTagged`](source/tagged.d.ts)·-·Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. |
| 130 | -·[`InvariantOf`](source/invariant-of.d.ts)·-·Create·an·[invariant·type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance),·which·is·a·type·that·does·not·accept·supertypes·and·subtypes. | 141 | -·[`InvariantOf`](source/invariant-of.d.ts)·-·Create·an·[invariant·type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance),·which·is·a·type·that·does·not·accept·supertypes·and·subtypes. |
| 131 | -·[`SetOptional`](source/set-optional.d.ts)·-·Create·a·type·that·makes·the·given·keys·optional. | 142 | -·[`SetOptional`](source/set-optional.d.ts)·-·Create·a·type·that·makes·the·given·keys·optional,·while·keeping·the·remaining·keys·as·is. |
| 132 | -·[`SetReadonly`](source/set-readonly.d.ts)·-·Create·a·type·that·makes·the·given·keys·readonly. | 143 | -·[`SetReadonly`](source/set-readonly.d.ts)·-·Create·a·type·that·makes·the·given·keys·readonly,·while·keeping·the·remaining·keys·as·is. |
| 133 | -·[`SetRequired`](source/set-required.d.ts)·-·Create·a·type·that·makes·the·given·keys·required. | 144 | -·[`SetRequired`](source/set-required.d.ts)·-·Create·a·type·that·makes·the·given·keys·required,·while·keeping·the·remaining·keys·as·is. |
| 134 | -·[`SetRequiredDeep`](source/set-required-deep.d.ts)·-· | 145 | -·[`SetRequiredDeep`](source/set-required-deep.d.ts)·-·Create·a·type·that·makes·the·given·keys·required,·with·support·for·deeply·nested·key·paths,·while·keeping·the·remaining·keys·as·is. |
| 135 | -·[`SetNonNullable`](source/set-non-nullable.d.ts)·-·Create·a·type·that·makes·the·given·keys·non-nullable. | 146 | -·[`SetNonNullable`](source/set-non-nullable.d.ts)·-·Create·a·type·that·makes·the·given·keys·non-nullable,·while·keeping·the·remaining·keys·as·is. |
| 136 | -·[`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts)·-·Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. | 147 | -·[`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts)·-·Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. |
| 148 | -·[`NonNullableDeep`](source/non-nullable-deep.d.ts)·-·Recursively·removes·`null`·and·`undefined`·from·the·specified·type. | ||
| 137 | -·[`ValueOf`](source/value-of.d.ts)·-·Create·a·union·of·the·given·object's·values,·and·optionally·specify·which·keys·to·get·the·values·from. | 149 | -·[`ValueOf`](source/value-of.d.ts)·-·Create·a·union·of·the·given·object's·values,·and·optionally·specify·which·keys·to·get·the·values·from. |
| 138 | -·[`ConditionalKeys`](source/conditional-keys.d.ts)·-·Extract·keys·from·a· | 150 | -·[`ConditionalKeys`](source/conditional-keys.d.ts)·-·Extract·the·keys·from·a·type·where·the·value·type·of·the·key·extends·the·given·`Condition`. |
| 139 | -·[`ConditionalPick`](source/conditional-pick.d.ts)·-·Like·`Pick`·except·it·selects·properties·from·a·shape·where·the·values·extend·the·given·`Condition`·type. | ||
| 140 | -·[`ConditionalPickDeep`](source/conditional-pick-deep.d.ts)·-·Like·`ConditionalPick`·except·that·it·selects·the·properties·deeply. | ||
| 141 | -·[`Conditional | 151 | -·[`ConditionalPick`](source/conditional-pick.d.ts)·-·Pick·keys·from·the·shape·that·matches·the·given·`Condition`. |
| 152 | -·[`ConditionalPickDeep`](source/conditional-pick-deep.d.ts)·-·Pick·keys·recursively·from·the·shape·that·matches·the·given·condition. | ||
| 153 | -·[`ConditionalExcept`](source/conditional-except.d.ts)·-·Exclude·keys·from·a·shape·that·matches·the·given·`Condition`. | ||
| 142 | -·[`UnionToIntersection`](source/union-to-intersection.d.ts)·-·Convert·a·union·type·to·an·intersection·type. | 154 | -·[`UnionToIntersection`](source/union-to-intersection.d.ts)·-·Convert·a·union·type·to·an·intersection·type. |
| 143 | -·[`LiteralToPrimitive`](source/literal-to-primitive.d.ts)·-· | 155 | -·[`LiteralToPrimitive`](source/literal-to-primitive.d.ts)·-·Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the·[primitive·type](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)·it·belongs·to,·or·`never`·if·it's·not·a·primitive. |
| 144 | -·[`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts)·-·Like·`LiteralToPrimitive`·except·it·converts·literal·types·inside·an·object·or·array·deeply. | 156 | -·[`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts)·-·Like·`LiteralToPrimitive`·except·it·converts·literal·types·inside·an·object·or·array·deeply. |
| 145 | -·[`Stringified`](source/stringified.d.ts)·-·Create·a·type·with·the·keys·of·the·given·type·changed·to·`string`·type. | 157 | -·[`Stringified`](source/stringified.d.ts)·-·Create·a·type·with·the·keys·of·the·given·type·changed·to·`string`·type. |
| 146 | -·[`IterableElement`](source/iterable-element.d.ts)·-·Get·the·element·type·of·an·`Iterable`/`AsyncIterable`.·For·example,·`Array`,·`Set`,·`Map`,·generator,·stream,·etc. | 158 | -·[`IterableElement`](source/iterable-element.d.ts)·-·Get·the·element·type·of·an·`Iterable`/`AsyncIterable`.·For·example,·`Array`,·`Set`,·`Map`,·generator,·stream,·etc. |
| 147 | -·[`Entry`](source/entry.d.ts)·-·Create·a·type·that·represents·the·type·of·an·entry·of·a·collection. | ||
| 148 | -·[`Entr | 159 | -·[`Entry`](source/entry.d.ts)·-·Create·a·type·that·describes·a·single·key-value·pair·produced·when·calling·a·collection’s·`entries`·method. |
| 160 | -·[`Entries`](source/entries.d.ts)·-·Create·a·type·that·describes·the·key-value·pairs·produced·when·calling·a·collection’s·`entries`·method. | ||
| 149 | -·[`SetReturnType`](source/set-return-type.d.ts)·-·Create·a·function·type·with·a·return·type·of·your·choice·and·the·same·parameters·as·the·given·function·type. | 161 | -·[`SetReturnType`](source/set-return-type.d.ts)·-·Create·a·function·type·with·a·return·type·of·your·choice·and·the·same·parameters·as·the·given·function·type. |
| 150 | -·[`SetParameterType`](source/set-parameter-type.d.ts)·-·Create·a·function·that·replaces·some·parameters·with·the·given·parameters. | 162 | -·[`SetParameterType`](source/set-parameter-type.d.ts)·-·Create·a·function·that·replaces·some·parameters·with·the·given·parameters. |
| 151 | -·[`Simplify`](source/simplify.d.ts)·-·Useful·to·flatten·the·type·output·to·improve·type·hints·shown·in·editors.·And·also·to·transform·an·interface·into·a·type·to·aide·with·assignability. | 163 | -·[`Simplify`](source/simplify.d.ts)·-·Useful·to·flatten·the·type·output·to·improve·type·hints·shown·in·editors.·And·also·to·transform·an·interface·into·a·type·to·aide·with·assignability. |
| 152 | -·[`SimplifyDeep`](source/simplify-deep.d.ts)·-·Deeply·simplifies·an·object·type. | 164 | -·[`SimplifyDeep`](source/simplify-deep.d.ts)·-·Deeply·simplifies·an·object·type. |
| 153 | -·[`Get`](source/get.d.ts)·-·Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. | 165 | -·[`Get`](source/get.d.ts)·-·Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. |
| 154 | -·[`KeyAsString`](source/key-as-string.d.ts)·-·Get·keys·of·the·given·type·as·strings. | 166 | -·[`KeyAsString`](source/key-as-string.d.ts)·-·Get·keys·of·the·given·type·as·strings. |
| 155 | -·[`Schema`](source/schema.d.ts)·-·Create·a·deep·version·of·another·object·type·where·property·values·are·recursively·replaced·into·a·given·value·type. | 167 | -·[`Schema`](source/schema.d.ts)·-·Create·a·deep·version·of·another·object·type·where·property·values·are·recursively·replaced·into·a·given·value·type. |
| 156 | -·[`Exact`](source/exact.d.ts)·-·Create·a·type·that·does·not·allow·extra·properties. | 168 | -·[`Exact`](source/exact.d.ts)·-·Create·a·type·that·does·not·allow·extra·properties,·meaning·it·only·allows·properties·that·are·explicitly·declared. |
| 157 | -·[`KeysOfUnion`](source/keys-of-union.d.ts)·-·Create·a·union·of·all·keys·from·a·given·type,·even·those·exclusive·to·specific·union·members. | 169 | -·[`KeysOfUnion`](source/keys-of-union.d.ts)·-·Create·a·union·of·all·keys·from·a·given·type,·even·those·exclusive·to·specific·union·members. |
| 158 | -·[`OptionalKeysOf`](source/optional-keys-of.d.ts)·-·Extract·all·optional·keys·from·the·given·type. | 170 | -·[`OptionalKeysOf`](source/optional-keys-of.d.ts)·-·Extract·all·optional·keys·from·the·given·type. |
| 159 | -·[`HasOptionalKeys`](source/has-optional-keys.d.ts)·-· | 171 | -·[`HasOptionalKeys`](source/has-optional-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·optional·fields. |
| 160 | -·[`RequiredKeysOf`](source/required-keys-of.d.ts)·-·Extract·all·required·keys·from·the·given·type. | 172 | -·[`RequiredKeysOf`](source/required-keys-of.d.ts)·-·Extract·all·required·keys·from·the·given·type. |
| 161 | -·[`HasRequiredKeys`](source/has-required-keys.d.ts)·-· | 173 | -·[`HasRequiredKeys`](source/has-required-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·required·fields. |
| 162 | -·[`ReadonlyKeysOf`](source/readonly-keys-of.d.ts)·-·Extract·all·readonly·keys·from·the·given·type. | 174 | -·[`ReadonlyKeysOf`](source/readonly-keys-of.d.ts)·-·Extract·all·readonly·keys·from·the·given·type. |
| 163 | -·[`HasReadonlyKeys`](source/has-readonly-keys.d.ts)·-· | 175 | -·[`HasReadonlyKeys`](source/has-readonly-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·readonly·fields. |
| Max diff block lines reached; 17177/33503 bytes (51.27%) of diff not shown. | |||
| Offset 65, 27 lines modified | Offset 65, 27 lines modified | ||
| 65 | @see·{@link·SharedUnionFields} | 65 | @see·{@link·SharedUnionFields} |
| 66 | @category·Object | 66 | @category·Object |
| 67 | @category·Union | 67 | @category·Union |
| 68 | */ | 68 | */ |
| 69 | export·type·AllUnionFields<Union>·= | 69 | export·type·AllUnionFields<Union>·= |
| 70 | Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers | 70 | » Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers |
| 71 | » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers | 71 | » » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers |
| 72 | » » ? | 72 | » » » ?·//·eslint-disable-line·@stylistic/operator-linebreak |
| 73 | » » |·SkippedMembers | 73 | » » » |·SkippedMembers |
| 74 | » » |·Simplify< | 74 | » » » |·Simplify< |
| 75 | » » //·Include·fields·that·are·common·in·all·union·members | 75 | » » » » //·Include·fields·that·are·common·in·all·union·members |
| 76 | » » » SharedUnionFields<RelevantMembers> | 76 | » » » » SharedUnionFields<RelevantMembers> |
| 77 | » » //·Include·readonly·fields·present·in·any·union·member | 77 | » » » » //·Include·readonly·fields·present·in·any·union·member |
| 78 | » » » { | 78 | » » » » &·{ |
| 79 | » » » » readonly·[P·in·ReadonlyKeysOfUnion<RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P·&·KeysOfUnion<RelevantMembers>> | 79 | » » » » » readonly·[P·in·ReadonlyKeysOfUnion<RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P·&·KeysOfUnion<RelevantMembers>> |
| 80 | » » » | 80 | » » » » } |
| 81 | » » //·Include·remaining·fields·that·are·neither·common·nor·readonly | 81 | » » » » //·Include·remaining·fields·that·are·neither·common·nor·readonly |
| 82 | » » » { | 82 | » » » » &·{ |
| 83 | » » » » [P·in·Exclude<KeysOfUnion<RelevantMembers>,·ReadonlyKeysOfUnion<RelevantMembers>·|·keyof·RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P> | 83 | » » » » » [P·in·Exclude<KeysOfUnion<RelevantMembers>,·ReadonlyKeysOfUnion<RelevantMembers>·|·keyof·RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P> |
| 84 | » » » } | 84 | » » » » } |
| 85 | » » > | 85 | » » » > |
| 86 | » » :·never | 86 | » » » :·never |
| 87 | » :·never; | 87 | » » :·never; |
| 88 | export·{}; | 88 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{AndAll}·from·'./and-all.d.ts'; | 1 | import·type·{AndAll}·from·'./and-all.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | Returns·a·boolean·for·whether·two·given·types·are·both·true. | 3 | Returns·a·boolean·for·whether·two·given·types·are·both·`true`. |
| 4 | Use-case:·Constructing·complex·conditional·types·where·multiple·conditions·must·be·satisfied. | 4 | Use-case:·Constructing·complex·conditional·types·where·multiple·conditions·must·be·satisfied. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{And}·from·'type-fest'; | 7 | import·type·{And}·from·'type-fest'; |
| Offset 4, 49 lines modified | Offset 4, 49 lines modified | ||
| 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 5 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 5 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | The·implementation·of·`SplitArrayByIndex`·for·fixed·length·arrays. | 7 | The·implementation·of·`SplitArrayByIndex`·for·fixed·length·arrays. |
| 8 | */ | 8 | */ |
| 9 | type·SplitFixedArrayByIndex<T·extends·UnknownArray,·SplitIndex·extends·number>·= | 9 | type·SplitFixedArrayByIndex<T·extends·UnknownArray,·SplitIndex·extends·number>·= |
| 10 | SplitIndex·extends·0 | 10 | » SplitIndex·extends·0 |
| 11 | » ?·[[],·T] | 11 | » » ?·[[],·T] |
| 12 | » :·T·extends·readonly·[...TupleOf<SplitIndex>,·...infer·V] | 12 | » » :·T·extends·readonly·[...TupleOf<SplitIndex>,·...infer·V] |
| 13 | » » ?·T·extends·readonly·[...infer·U,·...V] | 13 | » » » ?·T·extends·readonly·[...infer·U,·...V] |
| 14 | » » » ?·[U,·V] | 14 | » » » » ?·[U,·V] |
| 15 | » » » :·[never,·never] | 15 | » » » » :·[never,·never] |
| 16 | » » :·[never,·never]; | 16 | » » » :·[never,·never]; |
| 17 | /** | 17 | /** |
| 18 | The·implementation·of·`SplitArrayByIndex`·for·variable·length·arrays. | 18 | The·implementation·of·`SplitArrayByIndex`·for·variable·length·arrays. |
| 19 | */ | 19 | */ |
| 20 | type·SplitVariableArrayByIndex<T·extends·UnknownArray, | 20 | type·SplitVariableArrayByIndex<T·extends·UnknownArray, |
| 21 | » SplitIndex·extends·number, | 21 | » SplitIndex·extends·number, |
| 22 | » T1·=·Subtract<SplitIndex,·StaticPartOfArray<T>['length']>, | 22 | » T1·=·Subtract<SplitIndex,·StaticPartOfArray<T>['length']>, |
| 23 | » T2·=·T1·extends·number | 23 | » T2·=·T1·extends·number |
| 24 | » » ?·TupleOf<GreaterThanOrEqual<T1,·0>·extends·true·?·T1·:·number,·VariablePartOfArray<T>[number]> | 24 | » » ?·TupleOf<GreaterThanOrEqual<T1,·0>·extends·true·?·T1·:·number,·VariablePartOfArray<T>[number]> |
| 25 | » » :·[], | 25 | » » :·[], |
| 26 | >·= | 26 | >·= |
| 27 | SplitIndex·extends·0 | 27 | » SplitIndex·extends·0 |
| 28 | » ?·[[],·T] | 28 | » » ?·[[],·T] |
| 29 | » :·GreaterThanOrEqual<StaticPartOfArray<T>['length'],·SplitIndex>·extends·true | 29 | » » :·GreaterThanOrEqual<StaticPartOfArray<T>['length'],·SplitIndex>·extends·true |
| 30 | » » ?·[ | 30 | » » » ?·[ |
| 31 | » » » SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[0], | 31 | » » » » SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[0], |
| 32 | » » » [ | 32 | » » » » [ |
| 33 | » » » » ...SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[1], | 33 | » » » » » ...SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[1], |
| 34 | » » » » ...VariablePartOfArray<T>, | 34 | » » » » » ...VariablePartOfArray<T>, |
| 35 | » » » ], | 35 | » » » » ], |
| 36 | » » ] | 36 | » » » ] |
| 37 | » » :·[ | 37 | » » » :·[ |
| 38 | » » » [ | 38 | » » » » [ |
| 39 | » » » » ...StaticPartOfArray<T>, | 39 | » » » » » ...StaticPartOfArray<T>, |
| 40 | » » » » ...(T2·extends·UnknownArray·?·T2·:·[]), | 40 | » » » » » ...(T2·extends·UnknownArray·?·T2·:·[]), |
| 41 | » » » ], | 41 | » » » » ], |
| 42 | » » » VariablePartOfArray<T>, | 42 | » » » » VariablePartOfArray<T>, |
| 43 | » » ]; | 43 | » » » ]; |
| 44 | /** | 44 | /** |
| 45 | Split·the·given·array·`T`·by·the·given·`SplitIndex`. | 45 | Split·the·given·array·`T`·by·the·given·`SplitIndex`. |
| 46 | @example | 46 | @example |
| 47 | ``` | 47 | ``` |
| 48 | type·A·=·SplitArrayByIndex<[1,·2,·3,·4],·2>; | 48 | type·A·=·SplitArrayByIndex<[1,·2,·3,·4],·2>; |
| Offset 1, 30 lines modified | Offset 1, 56 lines modified | ||
| 1 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 1 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 2 | import·type·{Words,·WordsOptions}·from·'./words.d.ts'; | 2 | import·type·{_DefaultWordsOptions,·Words,·WordsOptions}·from·'./words.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | CamelCase·options. | 4 | CamelCase·options. |
| 5 | @see·{@link·CamelCase} | 5 | @see·{@link·CamelCase} |
| 6 | */ | 6 | */ |
| 7 | export·type·CamelCaseOptions·=·WordsOptions·&·{ | 7 | export·type·CamelCaseOptions·=·WordsOptions·&·{ |
| 8 | » /** | 8 | » /** |
| 9 | » Whether·to·preserved·consecutive·uppercase·letter. | 9 | » Whether·to·preserved·consecutive·uppercase·letter. |
| 10 | » @default·false | 10 | » @default·false |
| 11 | » */ | 11 | » */ |
| 12 | » preserveConsecutiveUppercase?:·boolean; | 12 | » preserveConsecutiveUppercase?:·boolean; |
| 13 | » /** | ||
| 14 | » Whether·to·preserve·leading·underscores. | ||
| 15 | » This·matches·the·behavior·of·the·[`camelcase`](https://github.com/sindresorhus/camelcase)·package·v9+. | ||
| 16 | » @default·false | ||
| 17 | » */ | ||
| 18 | » preserveLeadingUnderscores?:·boolean; | ||
| 13 | }; | 19 | }; |
| 14 | export·type·_DefaultCamelCaseOptions·=·{ | 20 | export·type·_DefaultCamelCaseOptions·=·_DefaultWordsOptions·&·{ |
| 15 | » splitOnNumbers:·true; | ||
| 16 | » preserveConsecutiveUppercase:·false; | 21 | » preserveConsecutiveUppercase:·false; |
| 22 | » preserveLeadingUnderscores:·false; | ||
| 17 | }; | 23 | }; |
| 18 | /** | 24 | /** |
| 25 | Extract·leading·underscores·from·a·string. | ||
| 26 | @example | ||
| 27 | ``` | ||
| 28 | type·A·=·LeadingUnderscores<'__foo_bar'>; | ||
| 29 | //=>·'__' | ||
| 30 | type·B·=·LeadingUnderscores<'foo_bar'>; | ||
| 31 | //=>·'' | ||
| 32 | ``` | ||
| 33 | */ | ||
| 34 | type·LeadingUnderscores<Type·extends·string,·Underscores·extends·string·=·''>·= | ||
| 35 | » Type·extends·`_${infer·Rest}` | ||
| 36 | » » ?·LeadingUnderscores<Rest,·`_${Underscores}`> | ||
| 37 | » » :·Underscores; | ||
| 38 | /** | ||
| 19 | Convert·an·array·of·words·to·camel-case. | 39 | Convert·an·array·of·words·to·camel-case. |
| 20 | */ | 40 | */ |
| 21 | type·CamelCaseFromArray< | 41 | type·CamelCaseFromArray< |
| 22 | » Words·extends·string[], | 42 | » Words·extends·string[], |
| 23 | » Options·extends·Required<CamelCaseOptions>, | 43 | » Options·extends·Required<CamelCaseOptions>, |
| 24 | » OutputString·extends·string·=·'', | 44 | » OutputString·extends·string·=·'', |
| 25 | >·=·Words·extends·[ | 45 | >·=·Words·extends·[ |
| Offset 39, 22 lines modified | Offset 65, 26 lines modified | ||
| 39 | /** | 65 | /** |
| 40 | Convert·a·string·literal·to·camel-case. | 66 | Convert·a·string·literal·to·camel-case. |
| 41 | This·can·be·useful·when,·for·example,·converting·some·kebab-cased·command-line·flags·or·a·snake-cased·database·result. | 67 | This·can·be·useful·when,·for·example,·converting·some·kebab-cased·command-line·flags·or·a·snake-cased·database·result. |
| 42 | By·default,·consecutive·uppercase·letter·are·preserved.·See·{@link·CamelCaseOptions.preserveConsecutiveUppercase·preserveConsecutiveUppercase}·option·to·change·this·behaviour. | 68 | By·default,·consecutive·uppercase·letter·are·preserved.·See·{@link·CamelCaseOptions.preserveConsecutiveUppercase·preserveConsecutiveUppercase}·option·to·change·this·behaviour. |
| 69 | Use·the·`preserveLeadingUnderscores`·option·to·retain·leading·underscores,·matching·the·runtime·behavior·of·[`camelcase`](https://github.com/sindresorhus/camelcase)·v9+. | ||
| 43 | @example | 70 | @example |
| 44 | ``` | 71 | ``` |
| 45 | import·type·{CamelCase}·from·'type-fest'; | 72 | import·type·{CamelCase}·from·'type-fest'; |
| 46 | //·Simple | 73 | //·Simple |
| 47 | const·someVariable:·CamelCase<'foo-bar'>·=·'fooBar'; | 74 | const·someVariable:·CamelCase<'foo-bar'>·=·'fooBar'; |
| 48 | const·preserveConsecutiveUppercase:·CamelCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'fooBARBaz'; | 75 | const·preserveConsecutiveUppercase:·CamelCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'fooBARBaz'; |
| 76 | const·splitOnPunctuation:·CamelCase<'foo-bar:BAZ',·{splitOnPunctuation:·true}>·=·'fooBarBaz'; | ||
| 77 | const·preserveLeadingUnderscores:·CamelCase<'_foo_bar',·{preserveLeadingUnderscores:·true}>·=·'_fooBar'; | ||
| 49 | //·Advanced | 78 | //·Advanced |
| 50 | type·CamelCasedProperties<T>·=·{ | 79 | type·CamelCasedProperties<T>·=·{ |
| 51 | » [K·in·keyof·T·as·CamelCase<K>]:·T[K] | 80 | » [K·in·keyof·T·as·CamelCase<K>]:·T[K] |
| 52 | }; | 81 | }; |
| Offset 79, 14 lines modified | Offset 109, 17 lines modified | ||
| 79 | @category·Change·case | 109 | @category·Change·case |
| 80 | @category·Template·literal | 110 | @category·Template·literal |
| 81 | */ | 111 | */ |
| 82 | export·type·CamelCase<Type,·Options·extends·CamelCaseOptions·=·{}>·=·Type·extends·string | 112 | export·type·CamelCase<Type,·Options·extends·CamelCaseOptions·=·{}>·=·Type·extends·string |
| 83 | » ?·string·extends·Type | 113 | » ?·string·extends·Type |
| 84 | » » ?·Type | 114 | » » ?·Type |
| 115 | » » :·`${Options['preserveLeadingUnderscores']·extends·true | ||
| 116 | » » » ?·LeadingUnderscores<Type> | ||
| 117 | » » » :·'' | ||
| 85 | » » | 118 | » » }${Uncapitalize<CamelCaseFromArray< |
| 86 | » » » Words<Type·extends·Uppercase<Type>·?·Lowercase<Type>·:·Type,·Options>, | 119 | » » » Words<Type·extends·Uppercase<Type>·?·Lowercase<Type>·:·Type,·Options>, |
| 87 | » » » ApplyDefaultOptions<CamelCaseOptions,·_DefaultCamelCaseOptions,·Options> | 120 | » » » ApplyDefaultOptions<CamelCaseOptions,·_DefaultCamelCaseOptions,·Options> |
| 88 | » » >> | 121 | » » >>}` |
| Max diff block lines reached; 14/3107 bytes (0.45%) of diff not shown. | |||
| Offset 44, 14 lines modified | Offset 44, 21 lines modified | ||
| 44 | const·preserveConsecutiveUppercase:·CamelCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ | 44 | const·preserveConsecutiveUppercase:·CamelCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 45 | » fooBAR:·{ | 45 | » fooBAR:·{ |
| 46 | » » fooBARBiz:·[{ | 46 | » » fooBARBiz:·[{ |
| 47 | » » » fooBARBaz:·'string', | 47 | » » » fooBARBaz:·'string', |
| 48 | » » }], | 48 | » » }], |
| 49 | » }, | 49 | » }, |
| 50 | }; | 50 | }; |
| 51 | const·splitOnPunctuation:·CamelCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 52 | » userInfo:·{ | ||
| 53 | » » userId:·1, | ||
| 54 | » » userName:·'Tom', | ||
| 55 | » }, | ||
| 56 | }; | ||
| 51 | ``` | 57 | ``` |
| 52 | @category·Change·case | 58 | @category·Change·case |
| 53 | @category·Template·literal | 59 | @category·Template·literal |
| 54 | @category·Object | 60 | @category·Object |
| 55 | */ | 61 | */ |
| 56 | export·type·CamelCasedPropertiesDeep< | 62 | export·type·CamelCasedPropertiesDeep< |
| Offset 82, 18 lines modified | Offset 89, 18 lines modified | ||
| 82 | >·=·Value·extends·[] | 89 | >·=·Value·extends·[] |
| 83 | » ?·[] | 90 | » ?·[] |
| 84 | » //·Trailing·spread·array | 91 | » //·Trailing·spread·array |
| 85 | » :·Value·extends·[infer·U,·...infer·V] | 92 | » :·Value·extends·[infer·U,·...infer·V] |
| 86 | » » ?·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] | 93 | » » ?·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] |
| 87 | » » :·Value·extends·readonly·[infer·U,·...infer·V] | 94 | » » :·Value·extends·readonly·[infer·U,·...infer·V] |
| 88 | » » » ?·readonly·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] | 95 | » » » ?·readonly·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] |
| 89 | » » » | 96 | » » » //·Leading·spread·array |
| 90 | » » » Value·extends·readonly·[...infer·U,·infer·V] | 97 | » » » :·Value·extends·readonly·[...infer·U,·infer·V] |
| 91 | » » » » ?·[..._CamelCasedPropertiesDeep<U,·Options>,·_CamelCasedPropertiesDeep<V,·Options>] | 98 | » » » » ?·[..._CamelCasedPropertiesDeep<U,·Options>,·_CamelCasedPropertiesDeep<V,·Options>] |
| 92 | » » » » | 99 | » » » » //·Array |
| 93 | » » » » Value·extends·Array<infer·U> | 100 | » » » » :·Value·extends·Array<infer·U> |
| 94 | » » » » » ?·Array<_CamelCasedPropertiesDeep<U,·Options>> | 101 | » » » » » ?·Array<_CamelCasedPropertiesDeep<U,·Options>> |
| 95 | » » » » » :·Value·extends·ReadonlyArray<infer·U> | 102 | » » » » » :·Value·extends·ReadonlyArray<infer·U> |
| 96 | » » » » » » ?·ReadonlyArray<_CamelCasedPropertiesDeep<U,·Options>> | 103 | » » » » » » ?·ReadonlyArray<_CamelCasedPropertiesDeep<U,·Options>> |
| 97 | » » » » » » :·never; | 104 | » » » » » » :·never; |
| 98 | export·{}; | 105 | export·{}; |
| Offset 1, 12 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{CamelCase,·CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; | 1 | import·type·{CamelCase,·CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Convert·object·properties·to·camel·ca | 4 | Convert·top-level·object·properties·to·camel·case. |
| 5 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 5 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 6 | @see·{@link·CamelCasedPropertiesDeep} | 6 | @see·{@link·CamelCasedPropertiesDeep} |
| 7 | @see·{@link·CamelCase} | 7 | @see·{@link·CamelCase} |
| 8 | @example | 8 | @example |
| Offset 22, 14 lines modified | Offset 22, 18 lines modified | ||
| 22 | » userId:·1, | 22 | » userId:·1, |
| 23 | » userName:·'Tom', | 23 | » userName:·'Tom', |
| 24 | }; | 24 | }; |
| 25 | const·preserveConsecutiveUppercase:·CamelCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ | 25 | const·preserveConsecutiveUppercase:·CamelCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 26 | » fooBAR:·'string', | 26 | » fooBAR:·'string', |
| 27 | }; | 27 | }; |
| 28 | const·splitOnPunctuation:·CamelCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 29 | » fooBar:·'string', | ||
| 30 | }; | ||
| 28 | ``` | 31 | ``` |
| 29 | @category·Change·case | 32 | @category·Change·case |
| 30 | @category·Template·literal | 33 | @category·Template·literal |
| 31 | @category·Object | 34 | @category·Object |
| 32 | */ | 35 | */ |
| 33 | export·type·CamelCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function | 36 | export·type·CamelCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function |
| Offset 34, 14 lines modified | Offset 34, 15 lines modified | ||
| 34 | ``` | 34 | ``` |
| 35 | import·type·{DelimiterCase}·from·'type-fest'; | 35 | import·type·{DelimiterCase}·from·'type-fest'; |
| 36 | //·Simple | 36 | //·Simple |
| 37 | const·someVariable:·DelimiterCase<'fooBar',·'#'>·=·'foo#bar'; | 37 | const·someVariable:·DelimiterCase<'fooBar',·'#'>·=·'foo#bar'; |
| 38 | const·someVariableNoSplitOnNumbers:·DelimiterCase<'p2pNetwork',·'#',·{splitOnNumbers:·false}>·=·'p2p#network'; | 38 | const·someVariableNoSplitOnNumbers:·DelimiterCase<'p2pNetwork',·'#',·{splitOnNumbers:·false}>·=·'p2p#network'; |
| 39 | const·someVariableWithPunctuation:·DelimiterCase<'div.card::after',·'#',·{splitOnPunctuation:·true}>·=·'div#card#after'; | ||
| 39 | //·Advanced | 40 | //·Advanced |
| 40 | type·OddlyCasedProperties<T>·=·{ | 41 | type·OddlyCasedProperties<T>·=·{ |
| 41 | » [K·in·keyof·T·as·DelimiterCase<K,·'#'>]:·T[K] | 42 | » [K·in·keyof·T·as·DelimiterCase<K,·'#'>]:·T[K] |
| 42 | }; | 43 | }; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions,·NonRecursiveType}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions,·NonRecursiveType}·from·'./internal/index.d.ts'; |
| 3 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 3 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·delimiter·cas | 6 | Convert·object·properties·to·a·custom·string·delimiter·casing·recursively. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·DelimiterCase} | 8 | @see·{@link·DelimiterCase} |
| 9 | @see·{@link·DelimiterCasedProperties} | 9 | @see·{@link·DelimiterCasedProperties} |
| 10 | @example | 10 | @example |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » 'line-2':·[ | 47 | » » 'line-2':·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » 'line-3':·'string', | 49 | » » » » 'line-3':·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·DelimiterCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·'-',·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user-info':·{ | ||
| 56 | » » 'user-id':·1, | ||
| 57 | » » 'user-name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·DelimiterCasedPropertiesDeep< | 65 | export·type·DelimiterCasedPropertiesDeep< |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | import·type·{WordsOptions}·from·'./words.d.ts'; | 3 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Convert·object·properties·to· | 5 | Convert·object·properties·to·a·custom·string·delimiter·casing. |
| 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 7 | @see·{@link·DelimiterCase} | 7 | @see·{@link·DelimiterCase} |
| 8 | @see·{@link·DelimiterCasedPropertiesDeep} | 8 | @see·{@link·DelimiterCasedPropertiesDeep} |
| 9 | @example | 9 | @example |
| Offset 23, 14 lines modified | Offset 23, 18 lines modified | ||
| 23 | » 'user-id':·1, | 23 | » 'user-id':·1, |
| 24 | » 'user-name':·'Tom', | 24 | » 'user-name':·'Tom', |
| 25 | }; | 25 | }; |
| 26 | const·splitOnNumbers:·DelimiterCasedProperties<{line1:·string},·'-',·{splitOnNumbers:·true}>·=·{ | 26 | const·splitOnNumbers:·DelimiterCasedProperties<{line1:·string},·'-',·{splitOnNumbers:·true}>·=·{ |
| 27 | » 'line-1':·'string', | 27 | » 'line-1':·'string', |
| 28 | }; | 28 | }; |
| 29 | const·splitOnPunctuation:·DelimiterCasedProperties<{'foo::bar':·string},·'-',·{splitOnPunctuation:·true}>·=·{ | ||
| 30 | » 'foo-bar':·'string', | ||
| 31 | }; | ||
| 29 | ``` | 32 | ``` |
| 30 | @category·Change·case | 33 | @category·Change·case |
| 31 | @category·Template·literal | 34 | @category·Template·literal |
| 32 | @category·Object | 35 | @category·Object |
| 33 | */ | 36 | */ |
| 34 | export·type·DelimiterCasedProperties< | 37 | export·type·DelimiterCasedProperties< |
| Offset 28, 15 lines modified | Offset 28, 15 lines modified | ||
| 28 | Unfortunately,·`Record<string,·never>`,·`Record<keyof·any,·never>`·and·`Record<never,·never>`·do·not·work.·See·{@link·https://github.com/sindresorhus/type-fest/issues/395·#395}. | 28 | Unfortunately,·`Record<string,·never>`,·`Record<keyof·any,·never>`·and·`Record<never,·never>`·do·not·work.·See·{@link·https://github.com/sindresorhus/type-fest/issues/395·#395}. |
| 29 | @category·Object | 29 | @category·Object |
| 30 | */ | 30 | */ |
| 31 | export·type·EmptyObject·=·{[emptyObjectSymbol]?:·never}; | 31 | export·type·EmptyObject·=·{[emptyObjectSymbol]?:·never}; |
| 32 | /** | 32 | /** |
| 33 | Returns·a· | 33 | Returns·a·boolean·for·whether·the·type·is·strictly·equal·to·an·empty·plain·object,·the·`{}`·value. |
| 34 | @example | 34 | @example |
| 35 | ``` | 35 | ``` |
| 36 | import·type·{IsEmptyObject}·from·'type-fest'; | 36 | import·type·{IsEmptyObject}·from·'type-fest'; |
| 37 | type·Pass·=·IsEmptyObject<{}>;·//=>·true | 37 | type·Pass·=·IsEmptyObject<{}>;·//=>·true |
| 38 | type·Fail1·=·IsEmptyObject<[]>;·//=>·false | 38 | type·Fail1·=·IsEmptyObject<[]>;·//=>·false |
| Offset 2, 15 lines modified | Offset 2, 15 lines modified | ||
| 2 | type·ArrayEntries<BaseType·extends·readonly·unknown[]>·=·Array<_ArrayEntry<BaseType>>; | 2 | type·ArrayEntries<BaseType·extends·readonly·unknown[]>·=·Array<_ArrayEntry<BaseType>>; |
| 3 | type·MapEntries<BaseType>·=·Array<_MapEntry<BaseType>>; | 3 | type·MapEntries<BaseType>·=·Array<_MapEntry<BaseType>>; |
| 4 | type·ObjectEntries<BaseType>·=·Array<_ObjectEntry<BaseType>>; | 4 | type·ObjectEntries<BaseType>·=·Array<_ObjectEntry<BaseType>>; |
| 5 | type·SetEntries<BaseType·extends·Set<unknown>>·=·Array<_SetEntry<BaseType>>; | 5 | type·SetEntries<BaseType·extends·Set<unknown>>·=·Array<_SetEntry<BaseType>>; |
| 6 | /** | 6 | /** |
| 7 | 7 | Create·a·type·that·describes·the·key-value·pairs·produced·when·calling·a·collection’s·`entries`·method. | |
| 8 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. | 8 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. |
| 9 | @see·`Entry`·if·you·want·to·just·access·the·type·of·a·single·entry. | 9 | @see·`Entry`·if·you·want·to·just·access·the·type·of·a·single·entry. |
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| Offset 1, 1 lines modified | Offset 1, 1 lines modified | ||
| 1 | u | 1 | utf-8 |
| Offset 3, 15 lines modified | Offset 3, 15 lines modified | ||
| 3 | export·type·_ArrayEntry<BaseType·extends·readonly·unknown[]>·=·[number,·BaseType[number]]; | 3 | export·type·_ArrayEntry<BaseType·extends·readonly·unknown[]>·=·[number,·BaseType[number]]; |
| 4 | export·type·_MapEntry<BaseType>·=·[MapKey<BaseType>,·MapValue<BaseType>]; | 4 | export·type·_MapEntry<BaseType>·=·[MapKey<BaseType>,·MapValue<BaseType>]; |
| 5 | export·type·_ObjectEntry<BaseType>·=·[keyof·BaseType,·BaseType[keyof·BaseType]]; | 5 | export·type·_ObjectEntry<BaseType>·=·[keyof·BaseType,·BaseType[keyof·BaseType]]; |
| 6 | export·type·_SetEntry<BaseType>·=·BaseType·extends·Set<infer·ItemType>·?·[ItemType,·ItemType]·:·never; | 6 | export·type·_SetEntry<BaseType>·=·BaseType·extends·Set<infer·ItemType>·?·[ItemType,·ItemType]·:·never; |
| 7 | /** | 7 | /** |
| 8 | 8 | Create·a·type·that·describes·a·single·key-value·pair·produced·when·calling·a·collection’s·`entries`·method. | |
| 9 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. | 9 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. |
| 10 | @see·`Entries`·if·you·want·to·just·access·the·type·of·the·array·of·entries·(which·is·the·return·of·the·`.entries()`·method). | 10 | @see·`Entries`·if·you·want·to·just·access·the·type·of·the·array·of·entries·(which·is·the·return·of·the·`.entries()`·method). |
| 11 | @example | 11 | @example |
| 12 | ``` | 12 | ``` |
| Offset 1, 1 lines modified | Offset 1, 1 lines modified | ||
| 1 | u | 1 | utf-8 |
| Offset 157, 15 lines modified | Offset 157, 15 lines modified | ||
| 157 | » » » » » ) | 157 | » » » » » ) |
| 158 | » » » » » :·Key·extends·keyof·WithStringKeys<BaseType> | 158 | » » » » » :·Key·extends·keyof·WithStringKeys<BaseType> |
| 159 | » » » » » » ?·StrictPropertyOf<WithStringKeys<BaseType>,·Key,·Options> | 159 | » » » » » » ?·StrictPropertyOf<WithStringKeys<BaseType>,·Key,·Options> |
| 160 | » » » » » » :·unknown; | 160 | » » » » » » :·unknown; |
| 161 | //·This·works·by·first·splitting·the·path·based·on·`.`·and·`[...]`·characters·into·a·tuple·of·string·keys.·Then·it·recursively·uses·the·head·key·to·get·the·next·property·of·the·current·object,·until·there·are·no·keys·left.·Number·keys·extract·the·item·type·from·arrays,·or·are·converted·to·strings·to·extract·types·from·tuples·and·dictionaries·with·number·keys. | 161 | //·This·works·by·first·splitting·the·path·based·on·`.`·and·`[...]`·characters·into·a·tuple·of·string·keys.·Then·it·recursively·uses·the·head·key·to·get·the·next·property·of·the·current·object,·until·there·are·no·keys·left.·Number·keys·extract·the·item·type·from·arrays,·or·are·converted·to·strings·to·extract·types·from·tuples·and·dictionaries·with·number·keys. |
| 162 | /** | 162 | /** |
| 163 | Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·Lodash's·`.get()`·function. | 163 | Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. |
| 164 | Use-case:·Retrieve·a·property·from·deep·inside·an·API·response·or·some·other·complex·object. | 164 | Use-case:·Retrieve·a·property·from·deep·inside·an·API·response·or·some·other·complex·object. |
| 165 | @example | 165 | @example |
| 166 | ``` | 166 | ``` |
| 167 | import·type·{Get}·from·'type-fest'; | 167 | import·type·{Get}·from·'type-fest'; |
| Offset 1, 12 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{PositiveNumericStringGt}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 4 | import·type·{And}·from·'./and.d.ts'; | 4 | import·type·{And}·from·'./and.d.ts'; |
| 5 | import·type·{Or}·from·'./or.d.ts'; | 5 | import·type·{Or}·from·'./or.d.ts'; |
| 6 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 6 | /** | 7 | /** |
| 7 | Returns·a·boolean·for·whether·a·given·number·is·greater·than·another·number. | 8 | Returns·a·boolean·for·whether·a·given·number·is·greater·than·another·number. |
| 8 | @example | 9 | @example |
| 9 | ``` | 10 | ``` |
| 10 | import·type·{GreaterThan}·from·'type-fest'; | 11 | import·type·{GreaterThan}·from·'type-fest'; |
| Offset 78, 14 lines modified | Offset 79, 14 lines modified | ||
| 78 | » » » » » » » » :·[IsNegative<A>,·IsNegative<B>]·extends·infer·R·extends·[boolean,·boolean] | 79 | » » » » » » » » :·[IsNegative<A>,·IsNegative<B>]·extends·infer·R·extends·[boolean,·boolean] |
| 79 | » » » » » » » » » ?·[true,·false]·extends·R | 80 | » » » » » » » » » ?·[true,·false]·extends·R |
| 80 | » » » » » » » » » » ?·false | 81 | » » » » » » » » » » ?·false |
| 81 | » » » » » » » » » » :·[false,·true]·extends·R | 82 | » » » » » » » » » » :·[false,·true]·extends·R |
| 82 | » » » » » » » » » » » ?·true | 83 | » » » » » » » » » » » ?·true |
| 83 | » » » » » » » » » » » :·[false,·false]·extends·R | 84 | » » » » » » » » » » » :·[false,·false]·extends·R |
| 84 | » » » » » » » » » » » » ?·PositiveNumericStringGt<`${A}`,·`${B}`> | 85 | » » » » » » » » » » » » ?·PositiveNumericStringGt<`${A}`,·`${B}`> |
| 85 | » » » » » » » » » » » » :·PositiveNumericStringGt<`${ | 86 | » » » » » » » » » » » » :·PositiveNumericStringGt<`${Absolute<B>}`,·`${Absolute<A>}`> |
| 86 | » » » » » » » » » :·never | 87 | » » » » » » » » » :·never |
| 87 | » » » » » :·never | 88 | » » » » » :·never |
| 88 | » » » :·never·//·Should·never·happen | 89 | » » » :·never·//·Should·never·happen |
| 89 | » » :·never;·//·Should·never·happen | 90 | » » :·never;·//·Should·never·happen |
| 90 | export·{}; | 91 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; | 1 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·optional·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·optional·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·optional·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasOptionalKeys,·OptionalKeysOf}·from·'type-fest'; | 7 | import·type·{HasOptionalKeys,·OptionalKeysOf}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{ReadonlyKeysOf}·from·'./readonly-keys-of.d.ts'; | 1 | import·type·{ReadonlyKeysOf}·from·'./readonly-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·readonly·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·readonly·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·readonly·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasReadonlyKeys,·ReadonlyKeysOf}·from·'type-fest'; | 7 | import·type·{HasReadonlyKeys,·ReadonlyKeysOf}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{RequiredKeysOf}·from·'./required-keys-of.d.ts'; | 1 | import·type·{RequiredKeysOf}·from·'./required-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·required·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·required·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·required·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasRequiredKeys}·from·'type-fest'; | 7 | import·type·{HasRequiredKeys}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{WritableKeysOf}·from·'./writable-keys-of.d.ts'; | 1 | import·type·{WritableKeysOf}·from·'./writable-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·writable·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·writable·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·writable·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasWritableKeys,·WritableKeysOf}·from·'type-fest'; | 7 | import·type·{HasWritableKeys,·WritableKeysOf}·from·'type-fest'; |
| Offset 1, 14 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{IntRange}·from·'./int-range.d.ts'; | 1 | import·type·{IntRange}·from·'./int-range.d.ts'; |
| 2 | import·type·{Sum}·from·'./sum.d.ts'; | 2 | import·type·{Sum}·from·'./sum.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Generate·a·union·of·numbers·between·a·specified·start·and·end·(both·inclusive),·with·an·optional·step. | ||
| 4 | Generate·a·union·of·numbers. | ||
| 5 | The·numbers·are·created·from·the·given·`Start`·(inclusive)·parameter·to·the·given·`End`·(inclusive)·parameter. | ||
| 6 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntClosedRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8·|·10`. | 5 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntClosedRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8·|·10`. |
| 7 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`999`. | 6 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`999`. |
| 8 | Use-cases: | 7 | Use-cases: |
| 9 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: | 8 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: |
| Offset 1, 14 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 2 | import·type·{Subtract}·from·'./subtract.d.ts'; | 2 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Generate·a·union·of·numbers·between·a·specified·start·(inclusive)·and·end·(exclusive),·with·an·optional·step. | ||
| 4 | Generate·a·union·of·numbers. | ||
| 5 | The·numbers·are·created·from·the·given·`Start`·(inclusive)·parameter·to·the·given·`End`·(exclusive)·parameter. | ||
| 6 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8`. | 5 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8`. |
| 7 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`1000`. | 6 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`1000`. |
| 8 | Use-cases: | 7 | Use-cases: |
| 9 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: | 8 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: |
| Offset 52, 17 lines modified | Offset 50, 17 lines modified | ||
| 52 | » End·extends·number, | 50 | » End·extends·number, |
| 53 | » Step·extends·number, | 51 | » Step·extends·number, |
| 54 | » //·The·gap·between·each·number,·gap·=·step·-·1 | 52 | » //·The·gap·between·each·number,·gap·=·step·-·1 |
| 55 | » Gap·extends·number·=·Subtract<Step,·1>, | 53 | » Gap·extends·number·=·Subtract<Step,·1>, |
| 56 | » //·The·final·`List`·is·`[...StartLengthTuple,·...[number,·...GapLengthTuple],·...[number,·...GapLengthTuple],·...·...]`,·so·can·initialize·the·`List`·with·`[...StartLengthTuple]` | 54 | » //·The·final·`List`·is·`[...StartLengthTuple,·...[number,·...GapLengthTuple],·...[number,·...GapLengthTuple],·...·...]`,·so·can·initialize·the·`List`·with·`[...StartLengthTuple]` |
| 57 | » List·extends·unknown[]·=·TupleOf<Start,·never>, | 55 | » List·extends·unknown[]·=·TupleOf<Start,·never>, |
| 58 | » EndLengthTuple·extends·unknown[]·=·TupleOf<End>, | 56 | » EndLengthTuple·extends·unknown[]·=·TupleOf<End>, |
| 59 | >·=·Gap·extends·0 | 57 | >·=·Gap·extends·0 |
| 60 | » //·Handle·the·case·that·without·`Step` | 58 | » //·Handle·the·case·that·without·`Step` |
| 61 | » List['length']·extends·End·//·The·result·of·"List[length]·===·End" | 59 | » ?·List['length']·extends·End·//·The·result·of·"List[length]·===·End" |
| 62 | » » ?·Exclude<List[number],·never>·//·All·unused·elements·are·`never`,·so·exclude·them | 60 | » » ?·Exclude<List[number],·never>·//·All·unused·elements·are·`never`,·so·exclude·them |
| 63 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length']·]> | 61 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length']·]> |
| 64 | » //·Handle·the·case·that·with·`Step` | 62 | » //·Handle·the·case·that·with·`Step` |
| 65 | » :·List·extends·[...(infer·U),·...EndLengthTuple]·//·The·result·of·"List[length]·>=·End",·because·the·`...TupleOf<Gap,·never>`·maybe·make·`List`·too·long. | 63 | » :·List·extends·[...(infer·U),·...EndLengthTuple]·//·The·result·of·"List[length]·>=·End",·because·the·`...TupleOf<Gap,·never>`·maybe·make·`List`·too·long. |
| 66 | » » ?·Exclude<List[number],·never> | 64 | » » ?·Exclude<List[number],·never> |
| 67 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length'],·...TupleOf<Gap,·never>]>; | 65 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length'],·...TupleOf<Gap,·never>]>; |
| Offset 25, 16 lines modified | Offset 25, 16 lines modified | ||
| 25 | type·A·=·[string,·number,·boolean,·...string[]]; | 25 | type·A·=·[string,·number,·boolean,·...string[]]; |
| 26 | type·B·=·StaticPartOfArray<A>; | 26 | type·B·=·StaticPartOfArray<A>; |
| 27 | //=>·[string,·number,·boolean] | 27 | //=>·[string,·number,·boolean] |
| 28 | ``` | 28 | ``` |
| 29 | */ | 29 | */ |
| 30 | export·type·StaticPartOfArray<T·extends·UnknownArray,·Result·extends·UnknownArray·=·[]>·= | 30 | export·type·StaticPartOfArray<T·extends·UnknownArray,·Result·extends·UnknownArray·=·[]>·= |
| 31 | » T·extends·unknown | 31 | » T·extends·unknown |
| 32 | » » ?·number·extends·T['length'] | 32 | » » ?·number·extends·T['length'] |
| 33 | » » » T·extends·readonly·[infer·U,·...infer·V] | 33 | » » » ?·T·extends·readonly·[infer·U,·...infer·V] |
| 34 | » » » » ?·StaticPartOfArray<V,·[...Result,·U]> | 34 | » » » » ?·StaticPartOfArray<V,·[...Result,·U]> |
| 35 | » » » » :·Result | 35 | » » » » :·Result |
| 36 | » » » :·T | 36 | » » » :·T |
| 37 | » » :·never;·//·Should·never·happen | 37 | » » :·never;·//·Should·never·happen |
| 38 | /** | 38 | /** |
| 39 | Returns·the·variable,·non-fixed-length·portion·of·the·given·array,·excluding·static-length·parts. | 39 | Returns·the·variable,·non-fixed-length·portion·of·the·given·array,·excluding·static-length·parts. |
| Offset 65, 19 lines modified | Offset 65, 19 lines modified | ||
| 65 | //=>·readonly·string[] | 65 | //=>·readonly·string[] |
| 66 | type·NormalResult·=·SetArrayAccess<ReadonlyStringArray,·false>; | 66 | type·NormalResult·=·SetArrayAccess<ReadonlyStringArray,·false>; |
| 67 | //=>·string[] | 67 | //=>·string[] |
| 68 | ``` | 68 | ``` |
| 69 | */ | 69 | */ |
| 70 | export·type·SetArrayAccess<T·extends·UnknownArray,·IsReadonly·extends·boolean>·= | 70 | export·type·SetArrayAccess<T·extends·UnknownArray,·IsReadonly·extends·boolean>·= |
| 71 | T·extends·readonly·[...infer·U] | 71 | » T·extends·readonly·[...infer·U] |
| 72 | » IsReadonly·extends·true | 72 | » » ?·IsReadonly·extends·true |
| 73 | » » ?·readonly·[...U] | 73 | » » » ?·readonly·[...U] |
| 74 | » » :·[...U] | 74 | » » » :·[...U] |
| 75 | » :·T; | 75 | » » :·T; |
| 76 | /** | 76 | /** |
| 77 | Returns·whether·the·given·array·`T`·is·readonly. | 77 | Returns·whether·the·given·array·`T`·is·readonly. |
| 78 | */ | 78 | */ |
| 79 | export·type·IsArrayReadonly<T·extends·UnknownArray>·=·If<IsNever<T>,·false,·T·extends·unknown[]·?·false·:·true>; | 79 | export·type·IsArrayReadonly<T·extends·UnknownArray>·=·If<IsNever<T>,·false,·T·extends·unknown[]·?·false·:·true>; |
| 80 | /** | 80 | /** |
| Offset 83, 18 lines modified | Offset 83, 18 lines modified | ||
| 83 | type·Key4·=·ExactKey<Object,·1>; | 83 | type·Key4·=·ExactKey<Object,·1>; |
| 84 | //=>·'1' | 84 | //=>·'1' |
| 85 | ``` | 85 | ``` |
| 86 | @category·Object | 86 | @category·Object |
| 87 | */ | 87 | */ |
| 88 | export·type·ExactKey<T·extends·object,·Key·extends·PropertyKey>·= | 88 | export·type·ExactKey<T·extends·object,·Key·extends·PropertyKey>·= |
| 89 | Key·extends·keyof·T | 89 | » Key·extends·keyof·T |
| 90 | » ?·Key | 90 | » » ?·Key |
| 91 | » :·ToString<Key>·extends·keyof·T | 91 | » » :·ToString<Key>·extends·keyof·T |
| 92 | » » ?·ToString<Key> | 92 | » » » ?·ToString<Key> |
| 93 | » » :·Key·extends·`${infer·NumberKey·extends·number}` | 93 | » » » :·Key·extends·`${infer·NumberKey·extends·number}` |
| 94 | » » » ?·NumberKey·extends·keyof·T | 94 | » » » » ?·NumberKey·extends·keyof·T |
| 95 | » » » » ?·NumberKey | 95 | » » » » » ?·NumberKey |
| 96 | » » » » :·never | 96 | » » » » » :·never |
| 97 | » » » :·never; | 97 | » » » » :·never; |
| 98 | export·{}; | 98 | export·{}; |
| Offset 1, 31 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{IsNever}·from·'../is-never.d.ts'; | 1 | import·type·{IsNever}·from·'../is-never.d.ts'; |
| 2 | import·type·{Finite,·NegativeInfinity,·PositiveInfinity}·from·'../numeric.d.ts'; | 2 | import·type·{Finite,·NegativeInfinity,·PositiveInfinity}·from·'../numeric.d.ts'; |
| 3 | import·type·{UnknownArray}·from·'../unknown-array.d.ts'; | 3 | import·type·{UnknownArray}·from·'../unknown-array.d.ts'; |
| 4 | import·type·{StringToNumber}·from·'./string.d.ts'; | ||
| 5 | import·type·{IfNotAnyOrNever,·IsAnyOrNever}·from·'./type.d.ts'; | 4 | import·type·{IfNotAnyOrNever,·IsAnyOrNever}·from·'./type.d.ts'; |
| 6 | /** | 5 | /** |
| 7 | Returns·the·absolute·value·of·a·given·value. | ||
| 8 | @example | ||
| 9 | ``` | ||
| 10 | type·A·=·NumberAbsolute<-1>; | ||
| 11 | //=>·1 | ||
| 12 | type·B·=·NumberAbsolute<1>; | ||
| 13 | //=>·1 | ||
| 14 | type·C·=·NumberAbsolute<NegativeInfinity>; | ||
| 15 | //=>·PositiveInfinity | ||
| 16 | ``` | ||
| 17 | */ | ||
| 18 | export·type·NumberAbsolute<N·extends·number>·=·`${N}`·extends·`-${infer·StringPositiveN}`·?·StringToNumber<StringPositiveN>·:·N; | ||
| 19 | /** | ||
| 20 | Check·whether·the·given·type·is·a·number·or·a·number·string. | 6 | Check·whether·the·given·type·is·a·number·or·a·number·string. |
| 21 | Supports·floating-point·as·a·string. | 7 | Supports·floating-point·as·a·string. |
| 22 | @example | 8 | @example |
| 23 | ``` | 9 | ``` |
| 24 | type·A·=·IsNumberLike<'1'>; | 10 | type·A·=·IsNumberLike<'1'>; |
| Offset 138, 14 lines modified | Offset 120, 22 lines modified | ||
| 138 | type·D·=·ReverseSign<PositiveInfinity>; | 120 | type·D·=·ReverseSign<PositiveInfinity>; |
| 139 | //=>·NegativeInfinity | 121 | //=>·NegativeInfinity |
| 140 | ``` | 122 | ``` |
| 141 | */ | 123 | */ |
| 142 | export·type·ReverseSign<N·extends·number>·= | 124 | export·type·ReverseSign<N·extends·number>·= |
| 143 | » //·Handle·edge·cases | 125 | » //·Handle·edge·cases |
| 144 | » N·extends·0 | 126 | » N·extends·0 |
| 127 | » » ?·0 | ||
| 128 | » » :·N·extends·PositiveInfinity | ||
| 129 | » » » ?·NegativeInfinity | ||
| 130 | » » » :·N·extends·NegativeInfinity | ||
| 131 | » » » » ?·PositiveInfinity | ||
| 145 | » //·Handle·negative·numbers | 132 | » » » » //·Handle·negative·numbers |
| 146 | » `${N}`·extends·`-${infer·P·extends·number}` | 133 | » » » » :·`${N}`·extends·`-${infer·P·extends·number}` |
| 134 | » » » » » ?·P | ||
| 147 | » » //·Handle·positive·numbers | 135 | » » » » » //·Handle·positive·numbers |
| 148 | » » :·`-${N}`·extends·`${infer·R·extends·number}` | 136 | » » » » » :·`-${N}`·extends·`${infer·R·extends·number}` |
| 137 | » » » » » » ?·R | ||
| 138 | » » » » » » :·never; | ||
| 149 | export·{}; | 139 | export·{}; |
| Offset 42, 16 lines modified | Offset 42, 16 lines modified | ||
| 42 | //=>·5 | 42 | //=>·5 |
| 43 | type·B·=·TupleMax<[1,·2,·5,·3,·99,·-1]>; | 43 | type·B·=·TupleMax<[1,·2,·5,·3,·99,·-1]>; |
| 44 | //=>·99 | 44 | //=>·99 |
| 45 | ``` | 45 | ``` |
| 46 | */ | 46 | */ |
| 47 | export·type·TupleMax<A·extends·number[],·Result·extends·number·=·NegativeInfinity>·=·number·extends·A[number] | 47 | export·type·TupleMax<A·extends·number[],·Result·extends·number·=·NegativeInfinity>·=·number·extends·A[number] |
| 48 | » ?·never | 48 | » ?·never |
| 49 | » A·extends·[infer·F·extends·number,·...infer·R·extends·number[]] | 49 | » :·A·extends·[infer·F·extends·number,·...infer·R·extends·number[]] |
| 50 | » » ?·GreaterThan<F,·Result>·extends·true | 50 | » » ?·GreaterThan<F,·Result>·extends·true |
| 51 | » » » ?·TupleMax<R,·F> | 51 | » » » ?·TupleMax<R,·F> |
| 52 | » » » :·TupleMax<R,·Result> | 52 | » » » :·TupleMax<R,·Result> |
| 53 | » » :·Result; | 53 | » » :·Result; |
| 54 | /** | 54 | /** |
| 55 | Returns·the·minimum·value·from·a·tuple·of·integers. | 55 | Returns·the·minimum·value·from·a·tuple·of·integers. |
| Offset 43, 18 lines modified | Offset 43, 18 lines modified | ||
| 43 | //=>·false | 43 | //=>·false |
| 44 | ``` | 44 | ``` |
| 45 | @category·Type·Guard | 45 | @category·Type·Guard |
| 46 | @category·Numeric | 46 | @category·Numeric |
| 47 | */ | 47 | */ |
| 48 | export·type·IsInteger<T>·= | 48 | export·type·IsInteger<T>·= |
| 49 | T·extends·bigint | 49 | » T·extends·bigint |
| 50 | » ?·true | 50 | » » ?·true |
| 51 | » :·T·extends·number | 51 | » » :·T·extends·number |
| 52 | » » ?·number·extends·T | 52 | » » » ?·number·extends·T |
| 53 | » » » ?·false | ||
| 54 | » » » :·T·extends·PositiveInfinity·|·NegativeInfinity | ||
| 55 | » » » » ?·false | 53 | » » » » ?·false |
| 54 | » » » » :·T·extends·PositiveInfinity·|·NegativeInfinity | ||
| 55 | » » » » » ?·false | ||
| 56 | » » » » :·Not<IsFloat<T>> | 56 | » » » » » :·Not<IsFloat<T>> |
| 57 | » » :·false; | 57 | » » » :·false; |
| 58 | export·{}; | 58 | export·{}; |
| Offset 117, 19 lines modified | Offset 117, 19 lines modified | ||
| 117 | export·type·IsStringLiteral<S>·=·IfNotAnyOrNever<S, | 117 | export·type·IsStringLiteral<S>·=·IfNotAnyOrNever<S, |
| 118 | » _IsStringLiteral<CollapseLiterals<S·extends·TagContainer<any>·?·UnwrapTagged<S>·:·S>>, | 118 | » _IsStringLiteral<CollapseLiterals<S·extends·TagContainer<any>·?·UnwrapTagged<S>·:·S>>, |
| 119 | » false,·false>; | 119 | » false,·false>; |
| 120 | export·type·_IsStringLiteral<S>·= | 120 | export·type·_IsStringLiteral<S>·= |
| 121 | //·If·`T`·is·an·infinite·string·type·(e.g.,·`on${string}`),·`Record<T,·never>`·produces·an·index·signature, | 121 | //·If·`T`·is·an·infinite·string·type·(e.g.,·`on${string}`),·`Record<T,·never>`·produces·an·index·signature, |
| 122 | //·and·since·`{}`·extends·index·signatures,·the·result·becomes·`false`. | 122 | //·and·since·`{}`·extends·index·signatures,·the·result·becomes·`false`. |
| 123 | S·extends·string | 123 | » S·extends·string |
| 124 | » ?·{}·extends·Record<S,·never> | 124 | » » ?·{}·extends·Record<S,·never> |
| 125 | » » ?·false | 125 | » » » ?·false |
| 126 | » » :·true | 126 | » » » :·true |
| 127 | » :·false; | 127 | » » :·false; |
| 128 | /** | 128 | /** |
| 129 | Returns·a·boolean·for·whether·the·given·type·is·a·`number`·or·`bigint`·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). | 129 | Returns·a·boolean·for·whether·the·given·type·is·a·`number`·or·`bigint`·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). |
| 130 | Useful·for: | 130 | Useful·for: |
| 131 | » -·providing·strongly-typed·functions·when·given·literal·arguments | 131 | » -·providing·strongly-typed·functions·when·given·literal·arguments |
| 132 | » -·type·utilities,·such·as·when·constructing·parsers·and·ASTs | 132 | » -·type·utilities,·such·as·when·constructing·parsers·and·ASTs |
| Offset 17, 24 lines modified | Offset 17, 24 lines modified | ||
| 17 | */ | 17 | */ |
| 18 | export·type·IsUnion<T>·=·InternalIsUnion<T>; | 18 | export·type·IsUnion<T>·=·InternalIsUnion<T>; |
| 19 | /** | 19 | /** |
| 20 | The·actual·implementation·of·`IsUnion`. | 20 | The·actual·implementation·of·`IsUnion`. |
| 21 | */ | 21 | */ |
| 22 | type·InternalIsUnion<T,·U·=·T>·= | 22 | type·InternalIsUnion<T,·U·=·T>·= |
| 23 | ( | 23 | » ( |
| 24 | » IsNever<T>·extends·true | 24 | » » IsNever<T>·extends·true |
| 25 | » » ?·false | 25 | » » » ?·false |
| 26 | » » :·T·extends·any | 26 | » » » :·T·extends·any |
| 27 | » » » ?·IsEqual<U,·T>·extends·true | 27 | » » » » ?·IsEqual<U,·T>·extends·true |
| 28 | » » » » ?·false | 28 | » » » » » ?·false |
| 29 | » » » » :·true | 29 | » » » » » :·true |
| 30 | » » » :·never | 30 | » » » » :·never |
| 31 | )·extends·infer·Result | 31 | » )·extends·infer·Result |
| 32 | » //·In·some·cases·`Result`·will·return·`false·|·true`·which·is·`boolean`, | 32 | » //·In·some·cases·`Result`·will·return·`false·|·true`·which·is·`boolean`, |
| 33 | » //·that·means·`T`·has·at·least·two·types·and·it's·a·union·type, | 33 | » //·that·means·`T`·has·at·least·two·types·and·it's·a·union·type, |
| 34 | » //·so·we·will·return·`true`·instead·of·`boolean`. | 34 | » //·so·we·will·return·`true`·instead·of·`boolean`. |
| 35 | » ?·boolean·extends·Result·?·true | 35 | » » ?·boolean·extends·Result·?·true |
| 36 | » » :·Result | 36 | » » » :·Result |
| 37 | » :·never;·//·Should·never·happen | 37 | » » :·never;·//·Should·never·happen |
| 38 | export·{}; | 38 | export·{}; |
| Offset 53, 14 lines modified | Offset 53, 14 lines modified | ||
| 53 | type·Fruit·=·IterableElement<typeof·fruits>; | 53 | type·Fruit·=·IterableElement<typeof·fruits>; |
| 54 | //=>·'🍎'·|·'🍌'·|·'🍉' | 54 | //=>·'🍎'·|·'🍌'·|·'🍉' |
| 55 | ``` | 55 | ``` |
| 56 | @category·Iterable | 56 | @category·Iterable |
| 57 | */ | 57 | */ |
| 58 | export·type·IterableElement<TargetIterable>·= | 58 | export·type·IterableElement<TargetIterable>·= |
| 59 | » TargetIterable·extends·Iterable<infer·ElementType> | 59 | » TargetIterable·extends·Iterable<infer·ElementType> |
| 60 | » » ElementType | 60 | » » ?·ElementType |
| 61 | » » TargetIterable·extends·AsyncIterable<infer·ElementType> | 61 | » » :·TargetIterable·extends·AsyncIterable<infer·ElementType> |
| 62 | » » » ElementType | 62 | » » » ?·ElementType |
| 63 | » » » never; | 63 | » » » :·never; |
| 64 | export·{}; | 64 | export·{}; |
| Offset 94, 21 lines modified | Offset 94, 21 lines modified | ||
| 94 | */ | 94 | */ |
| 95 | export·type·Jsonify<T>·=·IsAny<T>·extends·true | 95 | export·type·Jsonify<T>·=·IsAny<T>·extends·true |
| 96 | » ?·any | 96 | » ?·any |
| 97 | » :·T·extends·PositiveInfinity·|·NegativeInfinity | 97 | » :·T·extends·PositiveInfinity·|·NegativeInfinity |
| 98 | » » ?·null | 98 | » » ?·null |
| 99 | » » :·T·extends·JsonPrimitive | 99 | » » :·T·extends·JsonPrimitive |
| 100 | » » » ?·T | 100 | » » » ?·T |
| 101 | » » » | 101 | » » » //·Any·object·with·toJSON·is·special·case |
| 102 | » » » T·extends·{toJSON():·infer·J} | 102 | » » » :·T·extends·{toJSON():·infer·J} |
| 103 | » » » » ?·(()·=>·J)·extends·()·=>·JsonValue·//·Is·J·assignable·to·JsonValue? | 103 | » » » » ?·(()·=>·J)·extends·()·=>·JsonValue·//·Is·J·assignable·to·JsonValue? |
| 104 | » » » » » ?·J·//·Then·T·is·Jsonable·and·its·Jsonable·value·is·J | 104 | » » » » » ?·J·//·Then·T·is·Jsonable·and·its·Jsonable·value·is·J |
| 105 | » » » » » :·Jsonify<J>·//·Maybe·if·we·look·a·level·deeper·we'll·find·a·JsonValue | 105 | » » » » » :·Jsonify<J>·//·Maybe·if·we·look·a·level·deeper·we'll·find·a·JsonValue |
| 106 | » » » » | 106 | » » » » //·Instanced·primitives·are·objects |
| 107 | » » » » T·extends·Number | 107 | » » » » :·T·extends·Number |
| 108 | » » » » » ?·number | 108 | » » » » » ?·number |
| 109 | » » » » » :·T·extends·String | 109 | » » » » » :·T·extends·String |
| 110 | » » » » » » ?·string | 110 | » » » » » » ?·string |
| 111 | » » » » » » :·T·extends·Boolean | 111 | » » » » » » :·T·extends·Boolean |
| 112 | » » » » » » » ?·boolean | 112 | » » » » » » » ?·boolean |
| 113 | » » » » » » » :·T·extends·Map<any,·any>·|·Set<any> | 113 | » » » » » » » :·T·extends·Map<any,·any>·|·Set<any> |
| 114 | » » » » » » » » ?·EmptyObject | 114 | » » » » » » » » ?·EmptyObject |
| Offset 11, 14 lines modified | Offset 11, 15 lines modified | ||
| 11 | ``` | 11 | ``` |
| 12 | import·type·{KebabCase}·from·'type-fest'; | 12 | import·type·{KebabCase}·from·'type-fest'; |
| 13 | //·Simple | 13 | //·Simple |
| 14 | const·someVariable:·KebabCase<'fooBar'>·=·'foo-bar'; | 14 | const·someVariable:·KebabCase<'fooBar'>·=·'foo-bar'; |
| 15 | const·someVariableNoSplitOnNumbers:·KebabCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'p2p-network'; | 15 | const·someVariableNoSplitOnNumbers:·KebabCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'p2p-network'; |
| 16 | const·someVariableWithPunctuation:·KebabCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'div-card-after'; | ||
| 16 | //·Advanced | 17 | //·Advanced |
| 17 | type·KebabCasedProperties<T>·=·{ | 18 | type·KebabCasedProperties<T>·=·{ |
| 18 | » [K·in·keyof·T·as·KebabCase<K>]:·T[K] | 19 | » [K·in·keyof·T·as·KebabCase<K>]:·T[K] |
| 19 | }; | 20 | }; |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » 'line-2':·[ | 47 | » » 'line-2':·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » 'line-3':·'string', | 49 | » » » » 'line-3':·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·KebabCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user-info':·{ | ||
| 56 | » » 'user-id':·1, | ||
| 57 | » » 'user-name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·KebabCasedPropertiesDeep< | 65 | export·type·KebabCasedPropertiesDeep< |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; | 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; |
| 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·kebab·ca | 6 | Convert·top-level·object·properties·to·kebab·case. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·KebabCase} | 8 | @see·{@link·KebabCase} |
| 9 | @see·{@link·KebabCasedPropertiesDeep} | 9 | @see·{@link·KebabCasedPropertiesDeep} |
| 10 | @example | 10 | @example |
| Offset 24, 14 lines modified | Offset 24, 18 lines modified | ||
| 24 | » 'user-id':·1, | 24 | » 'user-id':·1, |
| 25 | » 'user-name':·'Tom', | 25 | » 'user-name':·'Tom', |
| 26 | }; | 26 | }; |
| 27 | const·splitOnNumbers:·KebabCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ | 27 | const·splitOnNumbers:·KebabCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ |
| 28 | » 'line-1':·'string', | 28 | » 'line-1':·'string', |
| 29 | }; | 29 | }; |
| 30 | const·splitOnPunctuation:·KebabCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 31 | » 'foo-bar':·'string', | ||
| 32 | }; | ||
| 30 | ``` | 33 | ``` |
| 31 | @category·Change·case | 34 | @category·Change·case |
| 32 | @category·Template·literal | 35 | @category·Template·literal |
| 33 | @category·Object | 36 | @category·Object |
| 34 | */ | 37 | */ |
| 35 | export·type·KebabCasedProperties< | 38 | export·type·KebabCasedProperties< |
| Offset 34, 11 lines modified | Offset 34, 11 lines modified | ||
| 34 | type·AllKeys·=·KeysOfUnion<Union>; | 34 | type·AllKeys·=·KeysOfUnion<Union>; |
| 35 | //=>·'common'·|·'a'·|·'b'·|·'c' | 35 | //=>·'common'·|·'a'·|·'b'·|·'c' |
| 36 | ``` | 36 | ``` |
| 37 | @category·Object | 37 | @category·Object |
| 38 | */ | 38 | */ |
| 39 | export·type·KeysOfUnion<ObjectType>·= | 39 | export·type·KeysOfUnion<ObjectType>·= |
| 40 | 40 | » //·Hack·to·fix·https://github.com/sindresorhus/type-fest/issues/1008 | |
| 41 | 41 | » keyof·UnionToIntersection<ObjectType·extends·unknown·?·Record<keyof·ObjectType,·never>·:·never>; | |
| 42 | export·{}; | 42 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{GreaterThan}·from·'./greater-than.d.ts'; | 1 | import·type·{GreaterThan}·from·'./greater-than.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·a·given·number·is·less·than·or·equal·to·another·number. | |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{LessThanOrEqual}·from·'type-fest'; | 6 | import·type·{LessThanOrEqual}·from·'type-fest'; |
| 7 | type·A·=·LessThanOrEqual<1,·-5>; | 7 | type·A·=·LessThanOrEqual<1,·-5>; |
| 8 | //=>·false | 8 | //=>·false |
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the· | 2 | Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the·[primitive·type](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)·it·belongs·to,·or·`never`·if·it's·not·a·primitive. |
| 3 | Use-case:·Working·with·generic·types·that·may·be·literal·types. | 3 | Use-case:·Working·with·generic·types·that·may·be·literal·types. |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{LiteralToPrimitive}·from·'type-fest'; | 6 | import·type·{LiteralToPrimitive}·from·'type-fest'; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Primitive}·from·'./primitive.d.ts'; | 1 | import·type·{Primitive}·from·'./primitive.d.ts'; |
| 2 | export·type·_LiteralStringUnion<T>·=·LiteralUnion<T,·string>; | 2 | export·type·_LiteralStringUnion<T>·=·LiteralUnion<T,·string>; |
| 3 | /** | 3 | /** |
| 4 | 4 | Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. | |
| 5 | Currently,·when·a·union·type·of·a·primitive·type·is·combined·with·literal·types,·TypeScript·loses·all·information·about·the·combined·literals.·Thus,·when·such·type·is·used·in·an·IDE·with·autocompletion,·no·suggestions·are·made·for·the·declared·literals. | 5 | Currently,·when·a·union·type·of·a·primitive·type·is·combined·with·literal·types,·TypeScript·loses·all·information·about·the·combined·literals.·Thus,·when·such·type·is·used·in·an·IDE·with·autocompletion,·no·suggestions·are·made·for·the·declared·literals. |
| 6 | This·type·is·a·workaround·for·[Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).·It·will·be·removed·as·soon·as·it's·not·needed·anymore. | 6 | This·type·is·a·workaround·for·[Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).·It·will·be·removed·as·soon·as·it's·not·needed·anymore. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| Offset 34, 12 lines modified | Offset 34, 12 lines modified | ||
| 34 | exclusiveOptions·=·{exclusive1:·true,·exclusive2:·'hi'}; | 34 | exclusiveOptions·=·{exclusive1:·true,·exclusive2:·'hi'}; |
| 35 | //·Error | 35 | //·Error |
| 36 | ``` | 36 | ``` |
| 37 | @category·Object | 37 | @category·Object |
| 38 | */ | 38 | */ |
| 39 | export·type·MergeExclusive<FirstType,·SecondType>·= | 39 | export·type·MergeExclusive<FirstType,·SecondType>·= |
| 40 | » (FirstType·|·SecondType)·extends·object | 40 | » (FirstType·|·SecondType)·extends·object |
| 41 | » » (Without<FirstType,·SecondType>·&·SecondType)·|·(Without<SecondType,·FirstType>·&·FirstType) | 41 | » » ?·(Without<FirstType,·SecondType>·&·SecondType)·|·(Without<SecondType,·FirstType>·&·FirstType) |
| 42 | » » FirstType·|·SecondType; | 42 | » » :·FirstType·|·SecondType; |
| 43 | export·{}; | 43 | export·{}; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{Subtract}·from·'./subtract.d.ts'; | 1 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | type·Recursive<T>·=·Array<Recursive<T>>; | 3 | type·Recursive<T>·=·Array<Recursive<T>>; |
| 4 | /** | 4 | /** |
| 5 | Create | 5 | Create·a·type·that·represents·a·multidimensional·array·of·the·given·type·and·dimension. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Return·a·n-dimensional·array·from·functions. | 7 | -·Return·a·n-dimensional·array·from·functions. |
| 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. | 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. |
| 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. | 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. |
| 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. | 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{Subtract}·from·'./subtract.d.ts'; | 1 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | type·Recursive<T>·=·ReadonlyArray<Recursive<T>>; | 3 | type·Recursive<T>·=·ReadonlyArray<Recursive<T>>; |
| 4 | /** | 4 | /** |
| 5 | Create | 5 | Create·a·type·that·represents·a·multidimensional·readonly·array·of·the·given·type·and·dimension. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Return·a·n-dimensional·array·from·functions. | 7 | -·Return·a·n-dimensional·array·from·functions. |
| 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. | 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. |
| 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. | 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. |
| 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. | 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. |
| Offset 117, 17 lines modified | Offset 117, 17 lines modified | ||
| 117 | ``` | 117 | ``` |
| 118 | @see·{@link·Integer} | 118 | @see·{@link·Integer} |
| 119 | @category·Numeric | 119 | @category·Numeric |
| 120 | */ | 120 | */ |
| 121 | export·type·Float<T>·= | 121 | export·type·Float<T>·= |
| 122 | T·extends·unknown·//·To·distributive·type | 122 | » T·extends·unknown·//·To·distributive·type |
| 123 | » ?·IsFloat<T>·extends·true·?·T·:·never | 123 | » » ?·IsFloat<T>·extends·true·?·T·:·never |
| 124 | » :·never;·//·Never·happens | 124 | » » :·never;·//·Never·happens |
| 125 | /** | 125 | /** |
| 126 | A·negative·(`-∞·<·x·<·0`)·`number`·that·is·not·an·integer. | 126 | A·negative·(`-∞·<·x·<·0`)·`number`·that·is·not·an·integer. |
| 127 | Equivalent·to·`Negative<Float<T>>`. | 127 | Equivalent·to·`Negative<Float<T>>`. |
| 128 | Use-case:·Validating·and·documenting·parameters. | 128 | Use-case:·Validating·and·documenting·parameters. |
| Offset 13, 15 lines modified | Offset 13, 15 lines modified | ||
| 13 | It·supports·recursing·into·arrays. | 13 | It·supports·recursing·into·arrays. |
| 14 | It·supports·removing·specific·items·from·an·array,·replacing·each·removed·item·with·unknown·at·the·specified·index. | 14 | It·supports·removing·specific·items·from·an·array,·replacing·each·removed·item·with·unknown·at·the·specified·index. |
| 15 | Use-case:·Remove·unneeded·parts·of·complex·objects. | 15 | Use-case:·Remove·unneeded·parts·of·complex·objects. |
| 16 | Use·[`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)·if·you·only·need·one·level·deep. | 16 | Use·[`Omit<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)·if·you·only·need·one·level·deep. |
| 17 | @example | 17 | @example |
| 18 | ``` | 18 | ``` |
| 19 | import·type·{OmitDeep}·from·'type-fest'; | 19 | import·type·{OmitDeep}·from·'type-fest'; |
| 20 | type·Info·=·{ | 20 | type·Info·=·{ |
| 21 | » userInfo:·{ | 21 | » userInfo:·{ |
| Offset 89, 42 lines modified | Offset 89, 42 lines modified | ||
| 89 | » » ?·OmitDeepHelper<OmitDeepWithOnePath<T,·Path·&·(string·|·number)>,·RestPaths> | 89 | » » ?·OmitDeepHelper<OmitDeepWithOnePath<T,·Path·&·(string·|·number)>,·RestPaths> |
| 90 | » » :·T; | 90 | » » :·T; |
| 91 | /** | 91 | /** |
| 92 | Omit·one·path·from·the·given·object/array. | 92 | Omit·one·path·from·the·given·object/array. |
| 93 | */ | 93 | */ |
| 94 | type·OmitDeepWithOnePath<T,·Path·extends·string·|·number>·= | 94 | type·OmitDeepWithOnePath<T,·Path·extends·string·|·number>·= |
| 95 | T·extends·NonRecursiveType | 95 | » T·extends·NonRecursiveType |
| 96 | » ?·T | 96 | » » ?·T |
| 97 | » :·T·extends·UnknownArray·?·SetArrayAccess<OmitDeepArrayWithOnePath<T,·Path>,·IsArrayReadonly<T>> | 97 | » » :·T·extends·UnknownArray·?·SetArrayAccess<OmitDeepArrayWithOnePath<T,·Path>,·IsArrayReadonly<T>> |
| 98 | » » :·T·extends·object·?·OmitDeepObjectWithOnePath<T,·Path> | 98 | » » » :·T·extends·object·?·OmitDeepObjectWithOnePath<T,·Path> |
| 99 | » » » :·T; | 99 | » » » » :·T; |
| 100 | /** | 100 | /** |
| 101 | Omit·one·path·from·the·given·object. | 101 | Omit·one·path·from·the·given·object. |
| 102 | */ | 102 | */ |
| 103 | type·OmitDeepObjectWithOnePath<ObjectT·extends·object,·P·extends·string·|·number>·= | 103 | type·OmitDeepObjectWithOnePath<ObjectT·extends·object,·P·extends·string·|·number>·= |
| 104 | P·extends·`${infer·RecordKeyInPath}.${infer·SubPath}` | 104 | » P·extends·`${infer·RecordKeyInPath}.${infer·SubPath}` |
| 105 | » ?·{ | 105 | » » ?·{ |
| 106 | » » [Key·in·keyof·ObjectT]: | 106 | » » » [Key·in·keyof·ObjectT]: |
| 107 | » » IsEqual<RecordKeyInPath,·ToString<Key>>·extends·true | 107 | » » » IsEqual<RecordKeyInPath,·ToString<Key>>·extends·true |
| 108 | » » » ?·ExactKey<ObjectT,·Key>·extends·infer·RealKey | 108 | » » » » ?·ExactKey<ObjectT,·Key>·extends·infer·RealKey |
| 109 | » » » » ?·RealKey·extends·keyof·ObjectT | 109 | » » » » » ?·RealKey·extends·keyof·ObjectT |
| 110 | » » » » » ?·OmitDeepWithOnePath<ObjectT[RealKey],·SubPath> | 110 | » » » » » » ?·OmitDeepWithOnePath<ObjectT[RealKey],·SubPath> |
| 111 | » » » » » » :·ObjectT[Key] | ||
| 111 | » » » » » :·ObjectT[Key] | 112 | » » » » » :·ObjectT[Key] |
| 112 | » » » » :·ObjectT[Key] | 113 | » » » » :·ObjectT[Key] |
| 113 | » » » :·ObjectT[Key] | ||
| 114 | » } | 114 | » » } |
| 115 | » :·ExactKey<ObjectT,·P>·extends·infer·Key | 115 | » » :·ExactKey<ObjectT,·P>·extends·infer·Key |
| 116 | » » ?·IsNever<Key>·extends·true | 116 | » » » ?·IsNever<Key>·extends·true |
| 117 | » » » ?·ObjectT | 117 | » » » » ?·ObjectT |
| 118 | » » » :·Key·extends·PropertyKey | 118 | » » » » :·Key·extends·PropertyKey |
| 119 | » » » » ?·Omit<ObjectT,·Key> | 119 | » » » » » ?·Omit<ObjectT,·Key> |
| 120 | » » » » :·ObjectT | 120 | » » » » » :·ObjectT |
| 121 | » » :·ObjectT; | 121 | » » » :·ObjectT; |
| 122 | /** | 122 | /** |
| 123 | Omit·one·path·from·from·the·given·array. | 123 | Omit·one·path·from·from·the·given·array. |
| 124 | It·replaces·the·item·to·`unknown`·at·the·given·index. | 124 | It·replaces·the·item·to·`unknown`·at·the·given·index. |
| 125 | @example | 125 | @example |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{OrAll}·from·'./or-all.d.ts'; | 1 | import·type·{OrAll}·from·'./or-all.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | Returns·a·boolean·for·whether·either·of·two·given·types·is·true. | 3 | Returns·a·boolean·for·whether·either·of·two·given·types·is·`true`. |
| 4 | Use-case:·Constructing·complex·conditional·types·where·at·least·one·condition·must·be·satisfied. | 4 | Use-case:·Constructing·complex·conditional·types·where·at·least·one·condition·must·be·satisfied. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{Or}·from·'type-fest'; | 7 | import·type·{Or}·from·'type-fest'; |
| Offset 695, 16 lines modified | Offset 695, 16 lines modified | ||
| 695 | /** | 695 | /** |
| 696 | Type·for·[npm's·`package.json`·file](https://docs.npmjs.com/creating-a-package-json-file).·Also·includes·types·for·fields·used·by·other·popular·projects,·like·TypeScript·and·Yarn. | 696 | Type·for·[npm's·`package.json`·file](https://docs.npmjs.com/creating-a-package-json-file).·Also·includes·types·for·fields·used·by·other·popular·projects,·like·TypeScript·and·Yarn. |
| 697 | @category·File | 697 | @category·File |
| 698 | */ | 698 | */ |
| 699 | export·type·PackageJson·= | 699 | export·type·PackageJson·= |
| 700 | » JsonObject | 700 | » JsonObject |
| 701 | » PackageJson.NodeJsStandard | 701 | » &·PackageJson.NodeJsStandard |
| 702 | » PackageJson.PackageJsonStandard | 702 | » &·PackageJson.PackageJsonStandard |
| 703 | » PackageJson.NonStandardEntryPoints | 703 | » &·PackageJson.NonStandardEntryPoints |
| 704 | » PackageJson.TypeScriptConfiguration | 704 | » &·PackageJson.TypeScriptConfiguration |
| 705 | » PackageJson.YarnConfiguration | 705 | » &·PackageJson.YarnConfiguration |
| 706 | » PackageJson.JSPMConfiguration; | 706 | » &·PackageJson.JSPMConfiguration; |
| 707 | export·{}; | 707 | export·{}; |
| Offset 40, 20 lines modified | Offset 40, 22 lines modified | ||
| 40 | type·DefaultPartialDeepOptions·=·{ | 40 | type·DefaultPartialDeepOptions·=·{ |
| 41 | » recurseIntoArrays:·false; | 41 | » recurseIntoArrays:·false; |
| 42 | » allowUndefinedInNonTupleArrays:·false; | 42 | » allowUndefinedInNonTupleArrays:·false; |
| 43 | }; | 43 | }; |
| 44 | /** | 44 | /** |
| 45 | Create·a· | 45 | Create·a·deeply·optional·version·of·another·type. |
| 46 | Use-cases: | 46 | Use-cases: |
| 47 | -·Merging·a·default·settings/config·object·with·another·object,·the·second·object·would·be·a·deep·partial·of·the·default·object. | 47 | -·Merging·a·default·settings/config·object·with·another·object,·the·second·object·would·be·a·deep·partial·of·the·default·object. |
| 48 | -·Mocking·and·testing·complex·entities,·where·populating·an·entire·object·with·its·keys·would·be·redundant·in·terms·of·the·mock·or·test. | 48 | -·Mocking·and·testing·complex·entities,·where·populating·an·entire·object·with·its·keys·would·be·redundant·in·terms·of·the·mock·or·test. |
| 49 | Use·[`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)·if·you·only·need·one·level·deep. | ||
| 49 | @example | 50 | @example |
| 50 | ``` | 51 | ``` |
| 51 | import·type·{PartialDeep}·from·'type-fest'; | 52 | import·type·{PartialDeep}·from·'type-fest'; |
| 52 | let·settings·=·{ | 53 | let·settings·=·{ |
| 53 | » textEditor:·{ | 54 | » textEditor:·{ |
| 54 | » » fontSize:·14, | 55 | » » fontSize:·14, |
| Offset 8, 14 lines modified | Offset 8, 15 lines modified | ||
| 8 | ``` | 8 | ``` |
| 9 | import·type·{PascalCase}·from·'type-fest'; | 9 | import·type·{PascalCase}·from·'type-fest'; |
| 10 | //·Simple | 10 | //·Simple |
| 11 | const·someVariable:·PascalCase<'foo-bar'>·=·'FooBar'; | 11 | const·someVariable:·PascalCase<'foo-bar'>·=·'FooBar'; |
| 12 | const·preserveConsecutiveUppercase:·PascalCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'FooBARBaz'; | 12 | const·preserveConsecutiveUppercase:·PascalCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'FooBARBaz'; |
| 13 | const·splitOnPunctuation:·PascalCase<'foo-bar>>baz',·{splitOnPunctuation:·true}>·=·'FooBarBaz'; | ||
| 13 | //·Advanced | 14 | //·Advanced |
| 14 | type·PascalCasedProperties<T>·=·{ | 15 | type·PascalCasedProperties<T>·=·{ |
| 15 | » [K·in·keyof·T·as·PascalCase<K>]:·T[K] | 16 | » [K·in·keyof·T·as·PascalCase<K>]:·T[K] |
| 16 | }; | 17 | }; |
| Offset 44, 14 lines modified | Offset 44, 21 lines modified | ||
| 44 | const·preserveConsecutiveUppercase:·PascalCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ | 44 | const·preserveConsecutiveUppercase:·PascalCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 45 | » FooBAR:·{ | 45 | » FooBAR:·{ |
| 46 | » » FooBARBiz:·[{ | 46 | » » FooBARBiz:·[{ |
| 47 | » » » FooBARBaz:·'string', | 47 | » » » FooBARBaz:·'string', |
| 48 | » » }], | 48 | » » }], |
| 49 | » }, | 49 | » }, |
| 50 | }; | 50 | }; |
| 51 | const·splitOnPunctuation:·PascalCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 52 | » UserInfo:·{ | ||
| 53 | » » UserId:·1, | ||
| 54 | » » UserName:·'Tom', | ||
| 55 | » }, | ||
| 56 | }; | ||
| 51 | ``` | 57 | ``` |
| 52 | @category·Change·case | 58 | @category·Change·case |
| 53 | @category·Template·literal | 59 | @category·Template·literal |
| 54 | @category·Object | 60 | @category·Object |
| 55 | */ | 61 | */ |
| 56 | export·type·PascalCasedPropertiesDeep<Value,·Options·extends·CamelCaseOptions·=·{}>·= | 62 | export·type·PascalCasedPropertiesDeep<Value,·Options·extends·CamelCaseOptions·=·{}>·= |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; | 1 | import·type·{CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | import·type·{PascalCase}·from·'./pascal-case.d.ts'; | 3 | import·type·{PascalCase}·from·'./pascal-case.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Convert·object·properties·to·pascal·ca | 5 | Convert·top-level·object·properties·to·pascal·case. |
| 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 7 | @see·{@link·PascalCase} | 7 | @see·{@link·PascalCase} |
| 8 | @see·{@link·PascalCasedPropertiesDeep} | 8 | @see·{@link·PascalCasedPropertiesDeep} |
| 9 | @example | 9 | @example |
| Offset 23, 14 lines modified | Offset 23, 18 lines modified | ||
| 23 | » UserId:·1, | 23 | » UserId:·1, |
| 24 | » UserName:·'Tom', | 24 | » UserName:·'Tom', |
| 25 | }; | 25 | }; |
| 26 | const·preserveConsecutiveUppercase:·PascalCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ | 26 | const·preserveConsecutiveUppercase:·PascalCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 27 | » FooBAR:·'string', | 27 | » FooBAR:·'string', |
| 28 | }; | 28 | }; |
| 29 | const·splitOnPunctuation:·PascalCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 30 | » FooBar:·'string', | ||
| 31 | }; | ||
| 29 | ``` | 32 | ``` |
| 30 | @category·Change·case | 33 | @category·Change·case |
| 31 | @category·Template·literal | 34 | @category·Template·literal |
| 32 | @category·Object | 35 | @category·Object |
| 33 | */ | 36 | */ |
| 34 | export·type·PascalCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function | 37 | export·type·PascalCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function |
| Offset 10, 14 lines modified | Offset 10, 16 lines modified | ||
| 10 | /** | 10 | /** |
| 11 | Pick·properties·from·a·deeply-nested·object. | 11 | Pick·properties·from·a·deeply-nested·object. |
| 12 | It·supports·recursing·into·arrays. | 12 | It·supports·recursing·into·arrays. |
| 13 | Use-case:·Distill·complex·objects·down·to·the·components·you·need·to·target. | 13 | Use-case:·Distill·complex·objects·down·to·the·components·you·need·to·target. |
| 14 | Use·[`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)·if·you·only·need·one·level·deep. | ||
| 14 | @example | 15 | @example |
| 15 | ``` | 16 | ``` |
| 16 | import·type·{PickDeep,·PartialDeep}·from·'type-fest'; | 17 | import·type·{PickDeep,·PartialDeep}·from·'type-fest'; |
| 17 | type·Configuration·=·{ | 18 | type·Configuration·=·{ |
| 18 | » userConfig:·{ | 19 | » userConfig:·{ |
| 19 | » » name:·string; | 20 | » » name:·string; |
| Offset 1, 16 lines modified | Offset 1, 18 lines modified | ||
| 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; | 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | C | 3 | Create·a·deeply·immutable·version·of·another·type. |
| 4 | This·is·useful·when·a·deeply·nested·structure·needs·to·be·exposed·as·completely·immutable,·for·example,·an·imported·JSON·module·or·when·receiving·an·API·response·that·is·passed·around. | 4 | This·is·useful·when·a·deeply·nested·structure·needs·to·be·exposed·as·completely·immutable,·for·example,·an·imported·JSON·module·or·when·receiving·an·API·response·that·is·passed·around. |
| 5 | Please·upvote·[this·issue](https://github.com/microsoft/TypeScript/issues/13923)·if·you·want·to·have·this·type·as·a·built-in·in·TypeScript. | 5 | Please·upvote·[this·issue](https://github.com/microsoft/TypeScript/issues/13923)·if·you·want·to·have·this·type·as·a·built-in·in·TypeScript. |
| 6 | Use·[`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype)·if·you·only·need·one·level·deep. | ||
| 6 | @example | 7 | @example |
| 7 | ``` | 8 | ``` |
| 8 | import·type·{ReadonlyDeep}·from·'type-fest'; | 9 | import·type·{ReadonlyDeep}·from·'type-fest'; |
| 9 | declare·const·foo:·{ | 10 | declare·const·foo:·{ |
| 10 | » a:·string; | 11 | » a:·string; |
| 11 | » b:·{c:·number}; | 12 | » b:·{c:·number}; |
| Offset 79, 16 lines modified | Offset 81, 16 lines modified | ||
| 79 | » » » » :·HasMultipleCallSignatures<T>·extends·true | 81 | » » » » :·HasMultipleCallSignatures<T>·extends·true |
| 80 | » » » » » ?·T | 82 | » » » » » ?·T |
| 81 | » » » » » :·((...arguments_:·Parameters<T>)·=>·ReturnType<T>)·&·_ReadonlyObjectDeep<T> | 83 | » » » » » :·((...arguments_:·Parameters<T>)·=>·ReturnType<T>)·&·_ReadonlyObjectDeep<T> |
| 82 | » » » :·T·extends·Readonly<ReadonlyMap<infer·KeyType,·infer·ValueType>> | 84 | » » » :·T·extends·Readonly<ReadonlyMap<infer·KeyType,·infer·ValueType>> |
| 83 | » » » » ?·ReadonlyMapDeep<KeyType,·ValueType> | 85 | » » » » ?·ReadonlyMapDeep<KeyType,·ValueType> |
| 84 | » » » » :·T·extends·Readonly<ReadonlySet<infer·ItemType>> | 86 | » » » » :·T·extends·Readonly<ReadonlySet<infer·ItemType>> |
| 85 | » » » » » ?·ReadonlySetDeep<ItemType> | 87 | » » » » » ?·ReadonlySetDeep<ItemType> |
| 86 | » » » » » | 88 | » » » » » //·Identify·tuples·to·avoid·converting·them·to·arrays·inadvertently;·special·case·`readonly·[...never[]]`,·as·it·emerges·undesirably·from·recursive·invocations·of·ReadonlyDeep·below. |
| 87 | » » » » » T·extends·readonly·[]·|·readonly·[...never[]] | 89 | » » » » » :·T·extends·readonly·[]·|·readonly·[...never[]] |
| 88 | » » » » » » ?·readonly·[] | 90 | » » » » » » ?·readonly·[] |
| 89 | » » » » » » :·T·extends·readonly·[infer·U,·...infer·V] | 91 | » » » » » » :·T·extends·readonly·[infer·U,·...infer·V] |
| 90 | » » » » » » » ?·readonly·[ReadonlyDeep<U>,·...ReadonlyDeep<V>] | 92 | » » » » » » » ?·readonly·[ReadonlyDeep<U>,·...ReadonlyDeep<V>] |
| 91 | » » » » » » » :·T·extends·readonly·[...infer·U,·infer·V] | 93 | » » » » » » » :·T·extends·readonly·[...infer·U,·infer·V] |
| 92 | » » » » » » » » ?·readonly·[...ReadonlyDeep<U>,·ReadonlyDeep<V>] | 94 | » » » » » » » » ?·readonly·[...ReadonlyDeep<U>,·ReadonlyDeep<V>] |
| 93 | » » » » » » » » :·T·extends·ReadonlyArray<infer·ItemType> | 95 | » » » » » » » » :·T·extends·ReadonlyArray<infer·ItemType> |
| 94 | » » » » » » » » » ?·ReadonlyArray<ReadonlyDeep<ItemType>> | 96 | » » » » » » » » » ?·ReadonlyArray<ReadonlyDeep<ItemType>> |
| Offset 106, 27 lines modified | Offset 106, 27 lines modified | ||
| 106 | @see·{@link·RemovePrefixOptions} | 106 | @see·{@link·RemovePrefixOptions} |
| 107 | @category·String | 107 | @category·String |
| 108 | @category·Template·literal | 108 | @category·Template·literal |
| 109 | */ | 109 | */ |
| 110 | export·type·RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·RemovePrefixOptions·=·{}>·= | 110 | export·type·RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·RemovePrefixOptions·=·{}>·= |
| 111 | IfNotAnyOrNever< | ||
| 112 | » S, | ||
| 113 | » IfNotAnyOrNever< | 111 | » IfNotAnyOrNever< |
| 112 | » » S, | ||
| 113 | » » IfNotAnyOrNever< | ||
| 114 | » » Prefix, | 114 | » » » Prefix, |
| 115 | » » _RemovePrefix<S,·Prefix,·ApplyDefaultOptions<RemovePrefixOptions,·DefaultRemovePrefixOptions,·Options>>, | 115 | » » » _RemovePrefix<S,·Prefix,·ApplyDefaultOptions<RemovePrefixOptions,·DefaultRemovePrefixOptions,·Options>>, |
| 116 | » » string, | 116 | » » » string, |
| 117 | » » S | 117 | » » » S |
| 118 | » > | 118 | » » > |
| 119 | >; | 119 | » >; |
| 120 | type·_RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·Required<RemovePrefixOptions>>·= | 120 | type·_RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·Required<RemovePrefixOptions>>·= |
| 121 | Prefix·extends·string·//·For·distributing·`Prefix` | 121 | » Prefix·extends·string·//·For·distributing·`Prefix` |
| 122 | » ?·S·extends·`${Prefix}${infer·Rest}` | 122 | » » ?·S·extends·`${Prefix}${infer·Rest}` |
| 123 | » » ?·Or<IsStringLiteral<Prefix>,·Not<Options['strict']>>·extends·true | 123 | » » » ?·Or<IsStringLiteral<Prefix>,·Not<Options['strict']>>·extends·true |
| 124 | » » » ?·Rest | 124 | » » » » ?·Rest |
| 125 | » » » :·string·//·Fallback·to·`string`·when·`Prefix`·is·non-literal·and·`strict`·is·disabled | 125 | » » » » :·string·//·Fallback·to·`string`·when·`Prefix`·is·non-literal·and·`strict`·is·disabled |
| 126 | » » :·S·//·Return·back·`S`·when·`Prefix`·is·not·present·at·the·start·of·`S` | 126 | » » » :·S·//·Return·back·`S`·when·`Prefix`·is·not·present·at·the·start·of·`S` |
| 127 | » :·never; | 127 | » » :·never; |
| 128 | export·{}; | 128 | export·{}; |
| Offset 23, 25 lines modified | Offset 23, 25 lines modified | ||
| 23 | declare·function·replace< | 23 | declare·function·replace< |
| 24 | » Input·extends·string, | 24 | » Input·extends·string, |
| 25 | » Search·extends·string, | 25 | » Search·extends·string, |
| 26 | » Replacement·extends·string, | 26 | » Replacement·extends·string, |
| 27 | >( | 27 | >( |
| 28 | » input:·Input, | 28 | » input:·Input, |
| 29 | » search:·Search, | 29 | » search:·Search, |
| 30 | » replacement:·Replacement | 30 | » replacement:·Replacement, |
| 31 | ):·Replace<Input,·Search,·Replacement>; | 31 | ):·Replace<Input,·Search,·Replacement>; |
| 32 | declare·function·replaceAll< | 32 | declare·function·replaceAll< |
| 33 | » Input·extends·string, | 33 | » Input·extends·string, |
| 34 | » Search·extends·string, | 34 | » Search·extends·string, |
| 35 | » Replacement·extends·string, | 35 | » Replacement·extends·string, |
| 36 | >( | 36 | >( |
| 37 | » input:·Input, | 37 | » input:·Input, |
| 38 | » search:·Search, | 38 | » search:·Search, |
| 39 | » replacement:·Replacement | 39 | » replacement:·Replacement, |
| 40 | ):·Replace<Input,·Search,·Replacement,·{all:·true}>; | 40 | ):·Replace<Input,·Search,·Replacement,·{all:·true}>; |
| 41 | //·The·return·type·is·the·exact·string·literal,·not·just·`string`. | 41 | //·The·return·type·is·the·exact·string·literal,·not·just·`string`. |
| 42 | replace('hello·?',·'?',·'🦄'); | 42 | replace('hello·?',·'?',·'🦄'); |
| 43 | //=>·'hello·🦄' | 43 | //=>·'hello·🦄' |
| Offset 5, 15 lines modified | Offset 5, 15 lines modified | ||
| 5 | /** | 5 | /** |
| 6 | Requires·all·of·the·keys·in·the·given·object. | 6 | Requires·all·of·the·keys·in·the·given·object. |
| 7 | */ | 7 | */ |
| 8 | type·RequireAll<ObjectType,·KeysType·extends·keyof·ObjectType>·=·Required<Pick<ObjectType,·KeysType>>; | 8 | type·RequireAll<ObjectType,·KeysType·extends·keyof·ObjectType>·=·Required<Pick<ObjectType,·KeysType>>; |
| 9 | /** | 9 | /** |
| 10 | Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys | 10 | Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 11 | Use-cases: | 11 | Use-cases: |
| 12 | -·Creating·interfaces·for·components·with·mutually-inclusive·keys. | 12 | -·Creating·interfaces·for·components·with·mutually-inclusive·keys. |
| 13 | The·caveat·with·`RequireAllOrNone`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireAllOrNone`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. | 13 | The·caveat·with·`RequireAllOrNone`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireAllOrNone`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. |
| 14 | @example | 14 | @example |
| Offset 1, 15 lines modified | Offset 1, 15 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{If}·from·'./if.d.ts'; | 2 | import·type·{If}·from·'./if.d.ts'; |
| 3 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; | 3 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; |
| 4 | import·type·{IsAny}·from·'./is-any.d.ts'; | 4 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 5 | import·type·{IsNever}·from·'./is-never.d.ts'; | 5 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | Create·a·type·that·requires·at·least·one·of·the·given·keys | 7 | Create·a·type·that·requires·at·least·one·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 8 | @example | 8 | @example |
| 9 | ``` | 9 | ``` |
| 10 | import·type·{RequireAtLeastOne}·from·'type-fest'; | 10 | import·type·{RequireAtLeastOne}·from·'type-fest'; |
| 11 | type·Responder·=·{ | 11 | type·Responder·=·{ |
| 12 | » text?:·()·=>·string; | 12 | » text?:·()·=>·string; |
| Offset 36, 15 lines modified | Offset 36, 13 lines modified | ||
| 36 | » » >>; | 36 | » » >>; |
| 37 | type·_RequireAtLeastOne< | 37 | type·_RequireAtLeastOne< |
| 38 | » ObjectType, | 38 | » ObjectType, |
| 39 | » KeysType·extends·keyof·ObjectType, | 39 | » KeysType·extends·keyof·ObjectType, |
| 40 | >·=·{ | 40 | >·=·{ |
| 41 | » //·For·each·`Key`·in·`KeysType`·make·a·mapped·type: | 41 | » //·For·each·`Key`·in·`KeysType`·make·a·mapped·type: |
| 42 | » [Key·in·KeysType]-?:·Required<Pick<ObjectType,·Key>>· | 42 | » [Key·in·KeysType]-?:·Required<Pick<ObjectType,·Key>>·//·1.·Make·`Key`'s·type·required |
| 43 | » » &·Partial<Pick<ObjectType,·Exclude<KeysType,·Key>>>;·//·2.·Make·all·other·keys·in·`KeysType`·optional | ||
| 43 | » //·2.·Make·all·other·keys·in·`KeysType`·optional | ||
| 44 | » » Partial<Pick<ObjectType,·Exclude<KeysType,·Key>>>; | ||
| 45 | }[KeysType] | 44 | }[KeysType] |
| 45 | &·Except<ObjectType,·KeysType>;·//·3.·Add·the·remaining·keys·not·in·`KeysType` | ||
| 46 | //·3.·Add·the·remaining·keys·not·in·`KeysType` | ||
| 47 | Except<ObjectType,·KeysType>; | ||
| 48 | export·{}; | 46 | export·{}; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{If}·from·'./if.d.ts'; | 1 | import·type·{If}·from·'./if.d.ts'; |
| 2 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; | 2 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; |
| 3 | import·type·{IsAny}·from·'./is-any.d.ts'; | 3 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 4 | import·type·{IsNever}·from·'./is-never.d.ts'; | 4 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more | 6 | Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more,·while·keeping·the·remaining·keys·as·is. |
| 7 | Use-cases: | 7 | Use-cases: |
| 8 | -·Creating·interfaces·for·components·that·only·need·one·of·the·keys·to·display·properly. | 8 | -·Creating·interfaces·for·components·that·only·need·one·of·the·keys·to·display·properly. |
| 9 | -·Declaring·generic·keys·in·a·single·place·for·a·single·use-case·that·gets·narrowed·down·via·`RequireExactlyOne`. | 9 | -·Declaring·generic·keys·in·a·single·place·for·a·single·use-case·that·gets·narrowed·down·via·`RequireExactlyOne`. |
| 10 | The·caveat·with·`RequireExactlyOne`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireExactlyOne`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. | 10 | The·caveat·with·`RequireExactlyOne`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireExactlyOne`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. |
| Offset 37, 12 lines modified | Offset 37, 12 lines modified | ||
| 37 | » » If<IsNever<KeysType>, | 37 | » » If<IsNever<KeysType>, |
| 38 | » » » never, | 38 | » » » never, |
| 39 | » » » _RequireExactlyOne<ObjectType,·If<IsAny<KeysType>,·keyof·ObjectType,·KeysType>> | 39 | » » » _RequireExactlyOne<ObjectType,·If<IsAny<KeysType>,·keyof·ObjectType,·KeysType>> |
| 40 | » » >>; | 40 | » » >>; |
| 41 | type·_RequireExactlyOne<ObjectType,·KeysType·extends·keyof·ObjectType>·= | 41 | type·_RequireExactlyOne<ObjectType,·KeysType·extends·keyof·ObjectType>·= |
| 42 | » {[Key·in·KeysType]:·( | 42 | » {[Key·in·KeysType]:·( |
| 43 | » » Required<Pick<ObjectType,·Key>> | 43 | » » Required<Pick<ObjectType,·Key>> |
| 44 | » » Partial<Record<Exclude<KeysType,·Key>,·never>> | 44 | » » &·Partial<Record<Exclude<KeysType,·Key>,·never>> |
| 45 | » )}[KeysType]·&·Omit<ObjectType,·KeysType>; | 45 | » )}[KeysType]·&·Omit<ObjectType,·KeysType>; |
| 46 | export·{}; | 46 | export·{}; |
| Offset 1, 15 lines modified | Offset 1, 15 lines modified | ||
| 1 | import·type·{RequireExactlyOne}·from·'./require-exactly-one.d.ts'; | 1 | import·type·{RequireExactlyOne}·from·'./require-exactly-one.d.ts'; |
| 2 | import·type·{IfNotAnyOrNever,·RequireNone}·from·'./internal/index.d.ts'; | 2 | import·type·{IfNotAnyOrNever,·RequireNone}·from·'./internal/index.d.ts'; |
| 3 | import·type·{If}·from·'./if.d.ts'; | 3 | import·type·{If}·from·'./if.d.ts'; |
| 4 | import·type·{IsAny}·from·'./is-any.d.ts'; | 4 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 5 | import·type·{IsNever}·from·'./is-never.d.ts'; | 5 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | Create·a·type·that·requires·exactly·one·of·the·given·keys· | 7 | Create·a·type·that·requires·exactly·one·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 8 | @example | 8 | @example |
| 9 | ``` | 9 | ``` |
| 10 | import·type·{RequireOneOrNone}·from·'type-fest'; | 10 | import·type·{RequireOneOrNone}·from·'type-fest'; |
| 11 | type·Responder·=·RequireOneOrNone<{ | 11 | type·Responder·=·RequireOneOrNone<{ |
| 12 | » text:·()·=>·string; | 12 | » text:·()·=>·string; |
| Offset 1, 18 lines modified | Offset 1, 20 lines modified | ||
| 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; | 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsNever}·from·'./is-never.d.ts'; | 2 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a· | 5 | Create·a·deeply·required·version·of·another·type. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Creating·optional·configuration·interfaces·where·the·underlying·implementation·still·requires·all·options·to·be·fully·specified. | 7 | -·Creating·optional·configuration·interfaces·where·the·underlying·implementation·still·requires·all·options·to·be·fully·specified. |
| 8 | -·Modeling·the·resulting·type·after·a·deep·merge·with·a·set·of·defaults. | 8 | -·Modeling·the·resulting·type·after·a·deep·merge·with·a·set·of·defaults. |
| 9 | Use·[`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype)·if·you·only·need·one·level·deep. | ||
| 9 | @example | 10 | @example |
| 10 | ``` | 11 | ``` |
| 11 | import·type·{RequiredDeep}·from·'type-fest'; | 12 | import·type·{RequiredDeep}·from·'type-fest'; |
| 12 | type·Settings·=·{ | 13 | type·Settings·=·{ |
| 13 | » textEditor?:·{ | 14 | » textEditor?:·{ |
| 14 | » » fontSize?:·number; | 15 | » » fontSize?:·number; |
| Offset 10, 14 lines modified | Offset 10, 15 lines modified | ||
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| 12 | import·type·{ScreamingSnakeCase}·from·'type-fest'; | 12 | import·type·{ScreamingSnakeCase}·from·'type-fest'; |
| 13 | const·someVariable:·ScreamingSnakeCase<'fooBar'>·=·'FOO_BAR'; | 13 | const·someVariable:·ScreamingSnakeCase<'fooBar'>·=·'FOO_BAR'; |
| 14 | const·someVariableNoSplitOnNumbers:·ScreamingSnakeCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'P2P_NETWORK'; | 14 | const·someVariableNoSplitOnNumbers:·ScreamingSnakeCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'P2P_NETWORK'; |
| 15 | const·someVariableWithPunctuation:·ScreamingSnakeCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'DIV_CARD_AFTER'; | ||
| 15 | ``` | 16 | ``` |
| 16 | @category·Change·case | 17 | @category·Change·case |
| 17 | @category·Template·literal | 18 | @category·Template·literal |
| 18 | ·*/ | 19 | ·*/ |
| 19 | export·type·ScreamingSnakeCase< | 20 | export·type·ScreamingSnakeCase< |
| Offset 1, 18 lines modified | Offset 1, 20 lines modified | ||
| 1 | import·type·{NonRecursiveType,·StringToNumber}·from·'./internal/index.d.ts'; | 1 | import·type·{NonRecursiveType,·StringToNumber}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsAny}·from·'./is-any.d.ts'; | ||
| 3 | import·type·{NonNullableDeep}·from·'./non-nullable-deep.d.ts'; | ||
| 2 | import·type·{Paths}·from·'./paths.d.ts'; | 4 | import·type·{Paths}·from·'./paths.d.ts'; |
| 3 | import·type·{SetNonNullable}·from·'./set-non-nullable.d.ts'; | 5 | import·type·{SetNonNullable}·from·'./set-non-nullable.d.ts'; |
| 4 | import·type·{Simplify}·from·'./simplify.d.ts'; | 6 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 5 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; | 7 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; |
| 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 7 | /** | 9 | /** |
| 8 | Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. | 10 | Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. |
| 9 | NOTE:·Optional·modifiers·(`?`)·are·not·removed·from·properties.·For·example,·`SetNonNullableDeep<{foo?:·string·|·null·|·undefined},·'foo'>`·will·result·in·`{foo?:·string}`. | 11 | NOTE:·Optional·modifiers·(`?`)·are·not·removed·from·properties.·For·example,·`SetNonNullableDeep<{foo?:·string·|·null·|·undefined},·'foo'>`·will·result·in·`{foo?:·string}`.·To·remove·both·optional·modifiers·and·nullables,·use·{@link·SetRequiredDeep}·in·conjunction·with·this·type. |
| 10 | @example | 12 | @example |
| 11 | ``` | 13 | ``` |
| 12 | import·type·{SetNonNullableDeep}·from·'type-fest'; | 14 | import·type·{SetNonNullableDeep}·from·'type-fest'; |
| 13 | type·User·=·{ | 15 | type·User·=·{ |
| 14 | » name:·string; | 16 | » name:·string; |
| Offset 51, 16 lines modified | Offset 53, 17 lines modified | ||
| 51 | //·Optional·modifier·(`?`)·is·not·removed. | 53 | //·Optional·modifier·(`?`)·is·not·removed. |
| 52 | type·ArrayExample2·=·SetNonNullableDeep<{a:·[(number·|·null)?,·(number·|·null)?]},·'a.1'>; | 54 | type·ArrayExample2·=·SetNonNullableDeep<{a:·[(number·|·null)?,·(number·|·null)?]},·'a.1'>; |
| 53 | //=>·{a:·[(number·|·null)?,·number?]} | 55 | //=>·{a:·[(number·|·null)?,·number?]} |
| 54 | ``` | 56 | ``` |
| 55 | @category·Object | 57 | @category·Object |
| 56 | */ | 58 | */ |
| 57 | export·type·SetNonNullableDeep<BaseType,·KeyPaths·extends·Paths<BaseType>>·= | 59 | export·type·SetNonNullableDeep<BaseType,·KeyPaths·extends·Paths<BaseType>>·=·IsAny<KeyPaths>·extends·true |
| 60 | » ?·NonNullableDeep<BaseType> | ||
| 58 | » SetNonNullableDeepHelper<BaseType,·UnionToTuple<KeyPaths>>; | 61 | » :·SetNonNullableDeepHelper<BaseType,·UnionToTuple<KeyPaths>>; |
| 59 | /** | 62 | /** |
| 60 | Internal·helper·for·{@link·SetNonNullableDeep}. | 63 | Internal·helper·for·{@link·SetNonNullableDeep}. |
| 61 | Recursively·transforms·the·`BaseType`·by·applying·{@link·SetNonNullableDeepSinglePath}·for·each·path·in·`KeyPathsTuple`. | 64 | Recursively·transforms·the·`BaseType`·by·applying·{@link·SetNonNullableDeepSinglePath}·for·each·path·in·`KeyPathsTuple`. |
| 62 | */ | 65 | */ |
| 63 | type·SetNonNullableDeepHelper<BaseType,·KeyPathsTuple·extends·UnknownArray>·= | 66 | type·SetNonNullableDeepHelper<BaseType,·KeyPathsTuple·extends·UnknownArray>·= |
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Create·a·type·that·makes·the·given·keys·non-nullable,·whe | 2 | Create·a·type·that·makes·the·given·keys·non-nullable,·while·keeping·the·remaining·keys·as·is. |
| 3 | If·no·keys·are·given,·all·keys·will·be·made·non-nullable. | 3 | If·no·keys·are·given,·all·keys·will·be·made·non-nullable. |
| 4 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·or·all·of·the·keys·are·non-nullable. | 4 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·or·all·of·the·keys·are·non-nullable. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; | 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a·type·that·makes·the·given·keys·optional | 5 | Create·a·type·that·makes·the·given·keys·optional,·while·keeping·the·remaining·keys·as·is. |
| 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·optional. | 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·optional. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{SetOptional}·from·'type-fest'; | 9 | import·type·{SetOptional}·from·'type-fest'; |
| Offset 28, 15 lines modified | Offset 28, 15 lines modified | ||
| 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> | 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> |
| 29 | » » :·unknown) | 29 | » » :·unknown) |
| 30 | » &·_SetOptional<BaseType,·Keys>; | 30 | » &·_SetOptional<BaseType,·Keys>; |
| 31 | type·_SetOptional<BaseType,·Keys·extends·keyof·BaseType>·= | 31 | type·_SetOptional<BaseType,·Keys·extends·keyof·BaseType>·= |
| 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. | 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. |
| 33 | » » ?·Simplify< | 33 | » » ?·Simplify< |
| 34 | » » //·Pick·just·the·keys·that·are·readonly·from·the·base·type. | 34 | » » » //·Pick·just·the·keys·that·are·readonly·from·the·base·type. |
| 35 | » » » Except<BaseType,·Keys> | 35 | » » » Except<BaseType,·Keys> |
| 36 | » » //·Pick·the·keys·that·should·be·mutable·from·the·base·type·and·make·them·mutable. | 36 | » » » //·Pick·the·keys·that·should·be·mutable·from·the·base·type·and·make·them·mutable. |
| 37 | » » » Partial<HomomorphicPick<BaseType,·Keys>> | 37 | » » » &·Partial<HomomorphicPick<BaseType,·Keys>> |
| 38 | » » > | 38 | » » > |
| 39 | » » :·never; | 39 | » » :·never; |
| 40 | export·{}; | 40 | export·{}; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; | 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a·type·that·makes·the·given·keys·readonly | 5 | Create·a·type·that·makes·the·given·keys·readonly,·while·keeping·the·remaining·keys·as·is. |
| 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·readonly. | 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·readonly. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{SetReadonly}·from·'type-fest'; | 9 | import·type·{SetReadonly}·from·'type-fest'; |
| Offset 28, 13 lines modified | Offset 28, 13 lines modified | ||
| 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> | 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> |
| 29 | » » :·unknown) | 29 | » » :·unknown) |
| 30 | » &·_SetReadonly<BaseType,·Keys>; | 30 | » &·_SetReadonly<BaseType,·Keys>; |
| 31 | export·type·_SetReadonly<BaseType,·Keys·extends·keyof·BaseType>·= | 31 | export·type·_SetReadonly<BaseType,·Keys·extends·keyof·BaseType>·= |
| 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. | 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. |
| 33 | » » ?·Simplify< | 33 | » » ?·Simplify< |
| 34 | » » » Except<BaseType,·Keys> | 34 | » » » Except<BaseType,·Keys> |
| 35 | » » » Readonly<HomomorphicPick<BaseType,·Keys>> | 35 | » » » &·Readonly<HomomorphicPick<BaseType,·Keys>> |
| 36 | » » > | 36 | » » > |
| 37 | » » :·never; | 37 | » » :·never; |
| 38 | export·{}; | 38 | export·{}; |
| Offset 4, 15 lines modified | Offset 4, 15 lines modified | ||
| 4 | import·type·{SetRequired}·from·'./set-required.d.ts'; | 4 | import·type·{SetRequired}·from·'./set-required.d.ts'; |
| 5 | import·type·{SimplifyDeep}·from·'./simplify-deep.d.ts'; | 5 | import·type·{SimplifyDeep}·from·'./simplify-deep.d.ts'; |
| 6 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; | 6 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; |
| 7 | import·type·{RequiredDeep}·from·'./required-deep.d.ts'; | 7 | import·type·{RequiredDeep}·from·'./required-deep.d.ts'; |
| 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 9 | /** | 9 | /** |
| 10 | Create·a·type·that·makes·the·given·keys·required | 10 | Create·a·type·that·makes·the·given·keys·required,·with·support·for·deeply·nested·key·paths,·while·keeping·the·remaining·keys·as·is. |
| 11 | Use-case:·Selectively·make·nested·properties·required·in·complex·types·like·models. | 11 | Use-case:·Selectively·make·nested·properties·required·in·complex·types·like·models. |
| 12 | @example | 12 | @example |
| 13 | ``` | 13 | ``` |
| 14 | import·type·{SetRequiredDeep}·from·'type-fest'; | 14 | import·type·{SetRequiredDeep}·from·'type-fest'; |
| Offset 2, 15 lines modified | Offset 2, 15 lines modified | ||
| 2 | import·type·{If}·from·'./if.d.ts'; | 2 | import·type·{If}·from·'./if.d.ts'; |
| 3 | import·type·{HomomorphicPick,·IsArrayReadonly}·from·'./internal/index.d.ts'; | 3 | import·type·{HomomorphicPick,·IsArrayReadonly}·from·'./internal/index.d.ts'; |
| 4 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; | 4 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; |
| 5 | import·type·{Simplify}·from·'./simplify.d.ts'; | 5 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 7 | /** | 7 | /** |
| 8 | Create·a·type·that·makes·the·given·keys·required | 8 | Create·a·type·that·makes·the·given·keys·required,·while·keeping·the·remaining·keys·as·is. |
| 9 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·required. | 9 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·required. |
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| 12 | import·type·{SetRequired}·from·'type-fest'; | 12 | import·type·{SetRequired}·from·'type-fest'; |
| Offset 39, 17 lines modified | Offset 39, 17 lines modified | ||
| 39 | type·_SetRequired<BaseType,·Keys·extends·keyof·BaseType>·= | 39 | type·_SetRequired<BaseType,·Keys·extends·keyof·BaseType>·= |
| 40 | » BaseType·extends·UnknownArray | 40 | » BaseType·extends·UnknownArray |
| 41 | » » ?·SetArrayRequired<BaseType,·Keys>·extends·infer·ResultantArray | 41 | » » ?·SetArrayRequired<BaseType,·Keys>·extends·infer·ResultantArray |
| 42 | » » » ?·If<IsArrayReadonly<BaseType>,·Readonly<ResultantArray>,·ResultantArray> | 42 | » » » ?·If<IsArrayReadonly<BaseType>,·Readonly<ResultantArray>,·ResultantArray> |
| 43 | » » » :·never | 43 | » » » :·never |
| 44 | » » :·Simplify< | 44 | » » :·Simplify< |
| 45 | » » //·Pick·just·the·keys·that·are·optional·from·the·base·type. | 45 | » » //·Pick·just·the·keys·that·are·optional·from·the·base·type. |
| 46 | » » » Except<BaseType,·Keys> | 46 | » » » Except<BaseType,·Keys> |
| 47 | » » //·Pick·the·keys·that·should·be·required·from·the·base·type·and·make·them·required. | 47 | » » //·Pick·the·keys·that·should·be·required·from·the·base·type·and·make·them·required. |
| 48 | » » » Required<HomomorphicPick<BaseType,·Keys>> | 48 | » » » &·Required<HomomorphicPick<BaseType,·Keys>> |
| 49 | » » >; | 49 | » » >; |
| 50 | /** | 50 | /** |
| 51 | Remove·the·optional·modifier·from·the·specified·keys·in·an·array. | 51 | Remove·the·optional·modifier·from·the·specified·keys·in·an·array. |
| 52 | */ | 52 | */ |
| 53 | type·SetArrayRequired< | 53 | type·SetArrayRequired< |
| 54 | » TArray·extends·UnknownArray, | 54 | » TArray·extends·UnknownArray, |
| Offset 62, 18 lines modified | Offset 62, 18 lines modified | ||
| 62 | @see·{@link·SharedUnionFieldsDeep} | 62 | @see·{@link·SharedUnionFieldsDeep} |
| 63 | @see·{@link·AllUnionFields} | 63 | @see·{@link·AllUnionFields} |
| 64 | @category·Object | 64 | @category·Object |
| 65 | @category·Union | 65 | @category·Union |
| 66 | */ | 66 | */ |
| 67 | export·type·SharedUnionFields<Union>·= | 67 | export·type·SharedUnionFields<Union>·= |
| 68 | Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers | 68 | » Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers |
| 69 | » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers | 69 | » » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers |
| 70 | » » ? | 70 | » » » ?·//·eslint-disable-line·@stylistic/operator-linebreak |
| 71 | » » |·SkippedMembers | 71 | » » » |·SkippedMembers |
| 72 | » » |·(IsNever<RelevantMembers>·extends·true | 72 | » » » |·(IsNever<RelevantMembers>·extends·true |
| 73 | » » » ?·never | 73 | » » » » ?·never |
| 74 | » » » :·Simplify<Pick<RelevantMembers,·keyof·RelevantMembers>>) | 74 | » » » » :·Simplify<Pick<RelevantMembers,·keyof·RelevantMembers>>) |
| 75 | » » :·never | 75 | » » » :·never |
| 76 | » :·never; | 76 | » » :·never; |
| 77 | export·{}; | 77 | export·{}; |
| Offset 12, 14 lines modified | Offset 12, 15 lines modified | ||
| 12 | import·type·{SnakeCase}·from·'type-fest'; | 12 | import·type·{SnakeCase}·from·'type-fest'; |
| 13 | //·Simple | 13 | //·Simple |
| 14 | const·someVariable:·SnakeCase<'fooBar'>·=·'foo_bar'; | 14 | const·someVariable:·SnakeCase<'fooBar'>·=·'foo_bar'; |
| 15 | const·noSplitOnNumbers:·SnakeCase<'p2pNetwork'>·=·'p2p_network'; | 15 | const·noSplitOnNumbers:·SnakeCase<'p2pNetwork'>·=·'p2p_network'; |
| 16 | const·splitOnNumbers:·SnakeCase<'p2pNetwork',·{splitOnNumbers:·true}>·=·'p_2_p_network'; | 16 | const·splitOnNumbers:·SnakeCase<'p2pNetwork',·{splitOnNumbers:·true}>·=·'p_2_p_network'; |
| 17 | const·splitOnPunctuation:·SnakeCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'div_card_after'; | ||
| 17 | //·Advanced | 18 | //·Advanced |
| 18 | type·SnakeCasedProperties<T>·=·{ | 19 | type·SnakeCasedProperties<T>·=·{ |
| 19 | » [K·in·keyof·T·as·SnakeCase<K>]:·T[K] | 20 | » [K·in·keyof·T·as·SnakeCase<K>]:·T[K] |
| 20 | }; | 21 | }; |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » line_2:·[ | 47 | » » line_2:·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » line_3:·'string', | 49 | » » » » line_3:·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·SnakeCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user_info':·{ | ||
| 56 | » » 'user_id':·1, | ||
| 57 | » » 'user_name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·SnakeCasedPropertiesDeep< | 65 | export·type·SnakeCasedPropertiesDeep< |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; | 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; |
| 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·snake·ca | 6 | Convert·top-level·object·properties·to·snake·case. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·SnakeCase} | 8 | @see·{@link·SnakeCase} |
| 9 | @see·{@link·SnakeCasedPropertiesDeep} | 9 | @see·{@link·SnakeCasedPropertiesDeep} |
| 10 | @example | 10 | @example |
| Offset 24, 14 lines modified | Offset 24, 18 lines modified | ||
| 24 | » user_id:·1, | 24 | » user_id:·1, |
| 25 | » user_name:·'Tom', | 25 | » user_name:·'Tom', |
| 26 | }; | 26 | }; |
| 27 | const·splitOnNumbers:·SnakeCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ | 27 | const·splitOnNumbers:·SnakeCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ |
| 28 | » 'line_1':·'string', | 28 | » 'line_1':·'string', |
| 29 | }; | 29 | }; |
| 30 | const·splitOnPunctuation:·SnakeCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 31 | » 'foo_bar':·'string', | ||
| 32 | }; | ||
| 30 | ``` | 33 | ``` |
| 31 | @category·Change·case | 34 | @category·Change·case |
| 32 | @category·Template·literal | 35 | @category·Template·literal |
| 33 | @category·Object | 36 | @category·Object |
| 34 | */ | 37 | */ |
| 35 | export·type·SnakeCasedProperties< | 38 | export·type·SnakeCasedProperties< |
| Offset 1, 11 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{ReverseSign}·from·'./internal/index.d.ts'; |
| 2 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 2 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 3 | import·type·{LessThan}·from·'./less-than.d.ts'; | 3 | import·type·{LessThan}·from·'./less-than.d.ts'; |
| 4 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 4 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 5 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 5 | /** | 6 | /** |
| 6 | Returns·the·difference·between·two·numbers. | 7 | Returns·the·difference·between·two·numbers. |
| 7 | Note: | 8 | Note: |
| 8 | -·A·or·B·can·only·support·`-999`·~·`999`. | 9 | -·A·or·B·can·only·support·`-999`·~·`999`. |
| Offset 55, 17 lines modified | Offset 56, 17 lines modified | ||
| 55 | Subtracts·two·numbers·A·and·B,·such·that·they·are·not·equal·and·neither·of·them·are·0,·+/-·infinity·or·the·`number`·type | 56 | Subtracts·two·numbers·A·and·B,·such·that·they·are·not·equal·and·neither·of·them·are·0,·+/-·infinity·or·the·`number`·type |
| 56 | */ | 57 | */ |
| 57 | type·SubtractPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= | 58 | type·SubtractPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= |
| 58 | » AreNegative·extends·[false,·false] | 59 | » AreNegative·extends·[false,·false] |
| 59 | » » ?·SubtractPositives<A,·B> | 60 | » » ?·SubtractPositives<A,·B> |
| 60 | » » :·AreNegative·extends·[true,·true] | 61 | » » :·AreNegative·extends·[true,·true] |
| 61 | » » » //·When·both·numbers·are·negative·we·subtract·the·absolute·values·and·then·reverse·the·sign | 62 | » » » //·When·both·numbers·are·negative·we·subtract·the·absolute·values·and·then·reverse·the·sign |
| 62 | » » » ?·ReverseSign<SubtractPositives< | 63 | » » » ?·ReverseSign<SubtractPositives<Absolute<A>,·Absolute<B>>> |
| 63 | » » » //·When·the·signs·are·different·we·can·add·the·absolute·values·and·then·reverse·the·sign·if·A·<·B | 64 | » » » //·When·the·signs·are·different·we·can·add·the·absolute·values·and·then·reverse·the·sign·if·A·<·B |
| 64 | » » » :·[...TupleOf< | 65 | » » » :·[...TupleOf<Absolute<A>>,·...TupleOf<Absolute<B>>]·extends·infer·R·extends·unknown[] |
| 65 | » » » » ?·LessThan<A,·B>·extends·true·?·ReverseSign<R['length']>·:·R['length'] | 66 | » » » » ?·LessThan<A,·B>·extends·true·?·ReverseSign<R['length']>·:·R['length'] |
| 66 | » » » » :·never; | 67 | » » » » :·never; |
| 67 | /** | 68 | /** |
| 68 | Subtracts·two·positive·numbers. | 69 | Subtracts·two·positive·numbers. |
| 69 | */ | 70 | */ |
| 70 | type·SubtractPositives<A·extends·number,·B·extends·number>·= | 71 | type·SubtractPositives<A·extends·number,·B·extends·number>·= |
| Offset 1, 11 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 2 | import·type·{ | 2 | import·type·{TupleMax,·ReverseSign}·from·'./internal/index.d.ts'; |
| 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 4 | import·type·{Subtract}·from·'./subtract.d.ts'; | 4 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 5 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 5 | /** | 6 | /** |
| 6 | Returns·the·sum·of·two·numbers. | 7 | Returns·the·sum·of·two·numbers. |
| 7 | Note: | 8 | Note: |
| 8 | -·A·or·B·can·only·support·`-999`·~·`999`. | 9 | -·A·or·B·can·only·support·`-999`·~·`999`. |
| Offset 53, 19 lines modified | Offset 54, 19 lines modified | ||
| 53 | */ | 54 | */ |
| 54 | type·SumPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= | 55 | type·SumPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= |
| 55 | » AreNegative·extends·[false,·false] | 56 | » AreNegative·extends·[false,·false] |
| 56 | » » //·When·both·numbers·are·positive·we·can·add·them·together | 57 | » » //·When·both·numbers·are·positive·we·can·add·them·together |
| 57 | » » ?·SumPositives<A,·B> | 58 | » » ?·SumPositives<A,·B> |
| 58 | » » :·AreNegative·extends·[true,·true] | 59 | » » :·AreNegative·extends·[true,·true] |
| 59 | » » » //·When·both·numbers·are·negative·we·add·the·absolute·values·and·then·reverse·the·sign | 60 | » » » //·When·both·numbers·are·negative·we·add·the·absolute·values·and·then·reverse·the·sign |
| 60 | » » » ?·ReverseSign<SumPositives< | 61 | » » » ?·ReverseSign<SumPositives<Absolute<A>,·Absolute<B>>> |
| 61 | » » » //·When·the·signs·are·different·we·can·subtract·the·absolute·values,·remove·the·sign | 62 | » » » //·When·the·signs·are·different·we·can·subtract·the·absolute·values,·remove·the·sign |
| 62 | » » » //·and·then·reverse·the·sign·if·the·larger·absolute·value·is·negative | 63 | » » » //·and·then·reverse·the·sign·if·the·larger·absolute·value·is·negative |
| 63 | » » » :· | 64 | » » » :·Absolute<Subtract<Absolute<A>,·Absolute<B>>>·extends·infer·Result·extends·number |
| 64 | » » » » ?·TupleMax<[ | 65 | » » » » ?·TupleMax<[Absolute<A>,·Absolute<B>]>·extends·infer·Max_·extends·number |
| 65 | » » » » » ?·Max_·extends·A·|·B | 66 | » » » » » ?·Max_·extends·A·|·B |
| 66 | » » » » » » //·The·larger·absolute·value·is·positive,·so·the·result·is·positive | 67 | » » » » » » //·The·larger·absolute·value·is·positive,·so·the·result·is·positive |
| 67 | » » » » » » ?·Result | 68 | » » » » » » ?·Result |
| 68 | » » » » » » //·The·larger·absolute·value·is·negative,·so·the·result·is·negative | 69 | » » » » » » //·The·larger·absolute·value·is·negative,·so·the·result·is·negative |
| 69 | » » » » » » :·ReverseSign<Result> | 70 | » » » » » » :·ReverseSign<Result> |
| 70 | » » » » » :·never | 71 | » » » » » :·never |
| 71 | » » » » :·never; | 72 | » » » » :·never; |
| Offset 4, 20 lines modified | Offset 4, 18 lines modified | ||
| 4 | export·type·TagContainer<Token>·=·{ | 4 | export·type·TagContainer<Token>·=·{ |
| 5 | » readonly·[tag]:·Token; | 5 | » readonly·[tag]:·Token; |
| 6 | }; | 6 | }; |
| 7 | type·Tag<Token·extends·PropertyKey,·TagMetadata>·=·TagContainer<{[K·in·Token]:·TagMetadata}>; | 7 | type·Tag<Token·extends·PropertyKey,·TagMetadata>·=·TagContainer<{[K·in·Token]:·TagMetadata}>; |
| 8 | /** | 8 | /** |
| 9 | 9 | Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.[·...·truncated·by·diffoscope;·len:·99,·SHA:·3fd8c7a5ebcae5c18ca9e42cbf2316354997c57f4e24714709786008b221556b·...·] | |
| 10 | A·type·returned·by·`Tagged`·can·be·passed·to·`Tagged`·again,·to·create·a·type·with·multiple·tags. | 10 | A·type·returned·by·`Tagged`·can·be·passed·to·`Tagged`·again,·to·create·a·type·with·multiple·tags. |
| 11 | [Read·more·about·tagged·types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) | ||
| 12 | A·tag's·name·is·usually·a·string·(and·must·be·a·string,·number,·or·symbol),·but·each·application·of·a·tag·can·also·contain·an·arbitrary·type·as·its·"metadata".·See·{@link·GetTagMetadata}·for·examples·and·explanation. | 11 | A·tag's·name·is·usually·a·string·(and·must·be·a·string,·number,·or·symbol),·but·each·application·of·a·tag·can·also·contain·an·arbitrary·type·as·its·"metadata".·See·{@link·GetTagMetadata}·for·examples·and·explanation. |
| 13 | A·type·`A`·returned·by·`Tagged`·is·assignable·to·another·type·`B`·returned·by·`Tagged`·if·and·only·if: | 12 | A·type·`A`·returned·by·`Tagged`·is·assignable·to·another·type·`B`·returned·by·`Tagged`·if·and·only·if: |
| 14 | ··-·the·underlying·(untagged)·type·of·`A`·is·assignable·to·the·underlying·type·of·`B`; | 13 | ··-·the·underlying·(untagged)·type·of·`A`·is·assignable·to·the·underlying·type·of·`B`; |
| 15 | » -·`A`·contains·at·least·all·the·tags·`B`·has; | 14 | » -·`A`·contains·at·least·all·the·tags·`B`·has; |
| 16 | » -·and·the·metadata·type·for·each·of·`A`'s·tags·is·assignable·to·the·metadata·type·of·`B`'s·corresponding·tag. | 15 | » -·and·the·metadata·type·for·each·of·`A`'s·tags·is·assignable·to·the·metadata·type·of·`B`'s·corresponding·tag. |
| Offset 96, 15 lines modified | Offset 94, 15 lines modified | ||
| 96 | ``` | 94 | ``` |
| 97 | @category·Type | 95 | @category·Type |
| 98 | */ | 96 | */ |
| 99 | export·type·GetTagMetadata<Type·extends·Tag<TagName,·unknown>,·TagName·extends·PropertyKey>·=·Type[typeof·tag][TagName]; | 97 | export·type·GetTagMetadata<Type·extends·Tag<TagName,·unknown>,·TagName·extends·PropertyKey>·=·Type[typeof·tag][TagName]; |
| 100 | /** | 98 | /** |
| 101 | 99 | Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. | |
| 102 | Why·is·this·necessary? | 100 | Why·is·this·necessary? |
| 103 | 1.·Use·a·`Tagged`·type·as·object·keys | 101 | 1.·Use·a·`Tagged`·type·as·object·keys |
| 104 | 2.·Prevent·TS4058·error:·"Return·type·of·exported·function·has·or·is·using·name·X·from·external·module·Y·but·cannot·be·named" | 102 | 2.·Prevent·TS4058·error:·"Return·type·of·exported·function·has·or·is·using·name·X·from·external·module·Y·but·cannot·be·named" |
| 105 | @example | 103 | @example |
| Offset 125, 15 lines modified | Offset 123, 15 lines modified | ||
| 125 | //·@ts-expect-error | 123 | //·@ts-expect-error |
| 126 | type·WontWork·=·UnwrapTagged<string>; | 124 | type·WontWork·=·UnwrapTagged<string>; |
| 127 | ``` | 125 | ``` |
| 128 | @category·Type | 126 | @category·Type |
| 129 | */ | 127 | */ |
| 130 | export·type·UnwrapTagged<TaggedType·extends·Tag<PropertyKey,·any>>·= | 128 | export·type·UnwrapTagged<TaggedType·extends·Tag<PropertyKey,·any>>·= |
| 131 | RemoveAllTags<TaggedType>; | 129 | » RemoveAllTags<TaggedType>; |
| 132 | type·RemoveAllTags<T>·=·T·extends·Tag<PropertyKey,·any> | 130 | type·RemoveAllTags<T>·=·T·extends·Tag<PropertyKey,·any> |
| 133 | » ?·{ | 131 | » ?·{ |
| 134 | » » [ThisTag·in·keyof·T[typeof·tag]]:·T·extends·Tagged<infer·Type,·ThisTag,·T[typeof·tag][ThisTag]> | 132 | » » [ThisTag·in·keyof·T[typeof·tag]]:·T·extends·Tagged<infer·Type,·ThisTag,·T[typeof·tag][ThisTag]> |
| 135 | » » » ?·RemoveAllTags<Type> | 133 | » » » ?·RemoveAllTags<Type> |
| 136 | » » » :·never | 134 | » » » :·never |
| 137 | » }[keyof·T[typeof·tag]] | 135 | » }[keyof·T[typeof·tag]] |
| Offset 57, 14 lines modified | Offset 57, 15 lines modified | ||
| 57 | » » » |·'ES2018' | 57 | » » » |·'ES2018' |
| 58 | » » » |·'ES2019' | 58 | » » » |·'ES2019' |
| 59 | » » » |·'ES2020' | 59 | » » » |·'ES2020' |
| 60 | » » » |·'ES2021' | 60 | » » » |·'ES2021' |
| 61 | » » » |·'ES2022' | 61 | » » » |·'ES2022' |
| 62 | » » » |·'ES2023' | 62 | » » » |·'ES2023' |
| 63 | » » » |·'ES2024' | 63 | » » » |·'ES2024' |
| 64 | » » » |·'ES2025' | ||
| 64 | » » » |·'ESNext' | 65 | » » » |·'ESNext' |
| 65 | » » » //·Lowercase·alternatives | 66 | » » » //·Lowercase·alternatives |
| 66 | » » » |·'es3' | 67 | » » » |·'es3' |
| 67 | » » » |·'es5' | 68 | » » » |·'es5' |
| 68 | » » » |·'es6' | 69 | » » » |·'es6' |
| 69 | » » » |·'es2015' | 70 | » » » |·'es2015' |
| 70 | » » » |·'es2016' | 71 | » » » |·'es2016' |
| Offset 72, 14 lines modified | Offset 73, 15 lines modified | ||
| 72 | » » » |·'es2018' | 73 | » » » |·'es2018' |
| 73 | » » » |·'es2019' | 74 | » » » |·'es2019' |
| 74 | » » » |·'es2020' | 75 | » » » |·'es2020' |
| 75 | » » » |·'es2021' | 76 | » » » |·'es2021' |
| 76 | » » » |·'es2022' | 77 | » » » |·'es2022' |
| 77 | » » » |·'es2023' | 78 | » » » |·'es2023' |
| 78 | » » » |·'es2024' | 79 | » » » |·'es2024' |
| 80 | » » » |·'es2025' | ||
| 79 | » » » |·'esnext'; | 81 | » » » |·'esnext'; |
| 80 | » » type·Lib·= | 82 | » » type·Lib·= |
| 81 | » » » |·'ES5' | 83 | » » » |·'ES5' |
| 82 | » » » |·'ES6' | 84 | » » » |·'ES6' |
| 83 | » » » |·'ES7' | 85 | » » » |·'ES7' |
| 84 | » » » |·'ES2015' | 86 | » » » |·'ES2015' |
| Offset 144, 29 lines modified | Offset 146, 38 lines modified | ||
| 144 | » » » |·'ES2024.ArrayBuffer' | 146 | » » » |·'ES2024.ArrayBuffer' |
| 145 | » » » |·'ES2024.Collection' | 147 | » » » |·'ES2024.Collection' |
| 146 | » » » |·'ES2024.Object' | 148 | » » » |·'ES2024.Object' |
| 147 | » » » |·'ES2024.Promise' | 149 | » » » |·'ES2024.Promise' |
| 148 | » » » |·'ES2024.Regexp' | 150 | » » » |·'ES2024.Regexp' |
| 149 | » » » |·'ES2024.SharedMemory' | 151 | » » » |·'ES2024.SharedMemory' |
| 150 | » » » |·'ES2024.String' | 152 | » » » |·'ES2024.String' |
| 153 | » » » |·'ES2025' | ||
| 154 | » » » |·'ES2025.Collection' | ||
| 155 | » » » |·'ES2025.Float16' | ||
| 156 | » » » |·'ES2025.Intl' | ||
| 157 | » » » |·'ES2025.Iterator' | ||
| 158 | » » » |·'ES2025.Promise' | ||
| 159 | » » » |·'ES2025.RegExp' | ||
| 151 | » » » |·'ESNext' | 160 | » » » |·'ESNext' |
| 152 | » » » |·'ESNext.Array' | 161 | » » » |·'ESNext.Array' |
| 153 | » » » |·'ESNext.AsyncIterable' | 162 | » » » |·'ESNext.AsyncIterable' |
| 154 | » » » |·'ESNext.BigInt' | 163 | » » » |·'ESNext.BigInt' |
| 155 | » » » |·'ESNext.Collection' | 164 | » » » |·'ESNext.Collection' |
| 156 | » » » |·'ESNext.Decorators' | 165 | » » » |·'ESNext.Decorators' |
| 157 | » » » |·'ESNext.Disposable' | 166 | » » » |·'ESNext.Disposable' |
| 158 | » » » |·'ESNext.Error' | 167 | » » » |·'ESNext.Error' |
| 168 | » » » |·'ESNext.Float16' | ||
| 159 | » » » |·'ESNext.Intl' | 169 | » » » |·'ESNext.Intl' |
| 160 | » » » |·'ESNext.Iterator' | 170 | » » » |·'ESNext.Iterator' |
| 161 | » » » |·'ESNext.Object' | 171 | » » » |·'ESNext.Object' |
| 162 | » » » |·'ESNext.Promise' | 172 | » » » |·'ESNext.Promise' |
| 163 | » » » |·'ESNext.Regexp' | 173 | » » » |·'ESNext.Regexp' |
| 164 | » » » |·'ESNext.String' | 174 | » » » |·'ESNext.String' |
| 165 | » » » |·'ESNext.Symbol' | 175 | » » » |·'ESNext.Symbol' |
| 176 | » » » |·'ESNext.Temporal' | ||
| 166 | » » » |·'ESNext.WeakRef' | 177 | » » » |·'ESNext.WeakRef' |
| 167 | » » » |·'DOM' | 178 | » » » |·'DOM' |
| 168 | » » » |·'DOM.AsyncIterable' | 179 | » » » |·'DOM.AsyncIterable' |
| 169 | » » » |·'DOM.Iterable' | 180 | » » » |·'DOM.Iterable' |
| 170 | » » » |·'Decorators' | 181 | » » » |·'Decorators' |
| 171 | » » » |·'Decorators.Legacy' | 182 | » » » |·'Decorators.Legacy' |
| 172 | » » » |·'ScriptHost' | 183 | » » » |·'ScriptHost' |
| Offset 240, 29 lines modified | Offset 251, 38 lines modified | ||
| 240 | » » » |·'es2024.arraybuffer' | 251 | » » » |·'es2024.arraybuffer' |
| 241 | » » » |·'es2024.collection' | 252 | » » » |·'es2024.collection' |
| 242 | » » » |·'es2024.object' | 253 | » » » |·'es2024.object' |
| 243 | » » » |·'es2024.promise' | 254 | » » » |·'es2024.promise' |
| 244 | » » » |·'es2024.regexp' | 255 | » » » |·'es2024.regexp' |
| 245 | » » » |·'es2024.sharedmemory' | 256 | » » » |·'es2024.sharedmemory' |
| 246 | » » » |·'es2024.string' | 257 | » » » |·'es2024.string' |
| 258 | » » » |·'es2025' | ||
| 259 | » » » |·'es2025.collection' | ||
| 260 | » » » |·'es2025.float16' | ||
| 261 | » » » |·'es2025.intl' | ||
| 262 | » » » |·'es2025.iterator' | ||
| 263 | » » » |·'es2025.promise' | ||
| 264 | » » » |·'es2025.regexp' | ||
| 247 | » » » |·'esnext' | 265 | » » » |·'esnext' |
| 248 | » » » |·'esnext.array' | 266 | » » » |·'esnext.array' |
| 249 | » » » |·'esnext.asynciterable' | 267 | » » » |·'esnext.asynciterable' |
| 250 | » » » |·'esnext.bigint' | 268 | » » » |·'esnext.bigint' |
| 251 | » » » |·'esnext.collection' | 269 | » » » |·'esnext.collection' |
| 252 | » » » |·'esnext.decorators' | 270 | » » » |·'esnext.decorators' |
| 253 | » » » |·'esnext.disposable' | 271 | » » » |·'esnext.disposable' |
| 254 | » » » |·'esnext.error' | 272 | » » » |·'esnext.error' |
| 273 | » » » |·'esnext.float16' | ||
| 255 | » » » |·'esnext.intl' | 274 | » » » |·'esnext.intl' |
| 256 | » » » |·'esnext.iterator' | 275 | » » » |·'esnext.iterator' |
| 257 | » » » |·'esnext.object' | 276 | » » » |·'esnext.object' |
| 258 | » » » |·'esnext.promise' | 277 | » » » |·'esnext.promise' |
| 259 | » » » |·'esnext.regexp' | 278 | » » » |·'esnext.regexp' |
| Max diff block lines reached; 4334/6374 bytes (67.99%) of diff not shown. | |||
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Convert·a·union·type·to·an·intersection·type | 2 | Convert·a·union·type·to·an·intersection·type. |
| 3 | Inspired·by·[this·Stack·Overflow·answer](https://stackoverflow.com/a/50375286/2172153). | 3 | Inspired·by·[this·Stack·Overflow·answer](https://stackoverflow.com/a/50375286/2172153). |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{UnionToIntersection}·from·'type-fest'; | 6 | import·type·{UnionToIntersection}·from·'type-fest'; |
| Offset 1, 10 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{ExcludeExactly}·from·'./exclude-exactly.d.ts'; | 1 | import·type·{ExcludeExactly}·from·'./exclude-exactly.d.ts'; |
| 2 | import·type·{IsNever}·from·'./is-never.d.ts'; | 2 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 3 | import·type·{UnionMember}·from·'./union-member.d.ts'; | 3 | import·type·{UnionMember}·from·'./union-member.d.ts'; |
| 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | ||
| 4 | /** | 5 | /** |
| 5 | Convert·a·union·type·into·an·unordered·tuple·type·of·its·elements. | 6 | Convert·a·union·type·into·an·unordered·tuple·type·of·its·elements. |
| 6 | "Unordered"·means·the·elements·of·the·tuple·are·not·guaranteed·to·be·in·the·same·order·as·in·the·union·type.·The·arrangement·can·appear·random·and·may·change·at·any·time. | 7 | "Unordered"·means·the·elements·of·the·tuple·are·not·guaranteed·to·be·in·the·same·order·as·in·the·union·type.·The·arrangement·can·appear·random·and·may·change·at·any·time. |
| 7 | This·can·be·useful·when·you·have·objects·with·a·finite·set·of·keys·and·want·a·type·defining·only·the·allowed·keys,·but·do·not·want·to·repeat·yourself. | 8 | This·can·be·useful·when·you·have·objects·with·a·finite·set·of·keys·and·want·a·type·defining·only·the·allowed·keys,·but·do·not·want·to·repeat·yourself. |
| Offset 33, 13 lines modified | Offset 34, 16 lines modified | ||
| 33 | const·petList·=·Object.keys(pets)·as·UnionToTuple<Pet>; | 34 | const·petList·=·Object.keys(pets)·as·UnionToTuple<Pet>; |
| 34 | //=>·['dog',·'cat',·'snake'] | 35 | //=>·['dog',·'cat',·'snake'] |
| 35 | ``` | 36 | ``` |
| 36 | @category·Array | 37 | @category·Array |
| 37 | */ | 38 | */ |
| 38 | export·type·UnionToTuple< | 39 | export·type·UnionToTuple<Union>·= |
| 39 | IsNever<T>·extends·false | ||
| 40 | » ?·[...UnionToTuple<ExcludeExactly<T,·L>>,·L] | ||
| 41 | » :· | 40 | » _UnionToTuple<Union>·extends·infer·Result·extends·UnknownArray·?·Result·:·never;·//·Nudges·the·compiler·that·`UnionToTuple`·always·yields·an·array. |
| 41 | type·_UnionToTuple<Union,·Accumulator·extends·UnknownArray·=·[],·Member·=·UnionMember<Union>>·= | ||
| 42 | » IsNever<Union>·extends·true | ||
| 43 | » » ?·Accumulator | ||
| 44 | » » :·_UnionToTuple<ExcludeExactly<Union,·Member>,·[Member,·...Accumulator]>; | ||
| 42 | export·{}; | 45 | export·{}; |
| Offset 1, 9 lines modified | Offset 1, 10 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{ |
| 2 | » ApplyDefaultOptions, | 2 | » ApplyDefaultOptions, |
| 3 | » AsciiPunctuation, | ||
| 3 | » IsNumeric, | 4 | » IsNumeric, |
| 4 | » WordSeparators, | 5 | » WordSeparators, |
| 5 | }·from·'./internal/index.d.ts'; | 6 | }·from·'./internal/index.d.ts'; |
| 6 | import·type·{IsLowercase}·from·'./is-lowercase.d.ts'; | 7 | import·type·{IsLowercase}·from·'./is-lowercase.d.ts'; |
| 7 | import·type·{IsUppercase}·from·'./is-uppercase.d.ts'; | 8 | import·type·{IsUppercase}·from·'./is-uppercase.d.ts'; |
| 8 | type·SkipEmptyWord<Word·extends·string>·=·Word·extends·''·?·[]·:·[Word]; | 9 | type·SkipEmptyWord<Word·extends·string>·=·Word·extends·''·?·[]·:·[Word]; |
| Offset 34, 25 lines modified | Offset 35, 42 lines modified | ||
| 34 | » //=>·['p',·'2',·'p',·'Network'] | 35 | » //=>·['p',·'2',·'p',·'Network'] |
| 35 | » type·Example2·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; | 36 | » type·Example2·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; |
| 36 | » //=>·['p2p',·'Network'] | 37 | » //=>·['p2p',·'Network'] |
| 37 | » ``` | 38 | » ``` |
| 38 | » */ | 39 | » */ |
| 39 | » splitOnNumbers?:·boolean; | 40 | » splitOnNumbers?:·boolean; |
| 41 | » /** | ||
| 42 | » Split·on·{@link·AsciiPunctuation·|·punctuation·characters}·(e.g.,·`#`,·`&`,·`*`,·`:`,·`?`,·`@`,·`~`). | ||
| 43 | » @example | ||
| 44 | » ``` | ||
| 45 | » import·type·{Words}·from·'type-fest'; | ||
| 46 | » type·Example1·=·Words<'hello:world',·{splitOnPunctuation:·true}>; | ||
| 47 | » //=>·['hello',·'world'] | ||
| 48 | » type·Example2·=·Words<'hello:world',·{splitOnPunctuation:·false}>; | ||
| 49 | » //=>·['hello',·':world'] | ||
| 50 | » ``` | ||
| 51 | » */ | ||
| 52 | » splitOnPunctuation?:·boolean; | ||
| 40 | }; | 53 | }; |
| 41 | export·type·_DefaultWordsOptions·=·{ | 54 | export·type·_DefaultWordsOptions·=·{ |
| 42 | » splitOnNumbers:·true; | 55 | » splitOnNumbers:·true; |
| 56 | » splitOnPunctuation:·false; | ||
| 43 | }; | 57 | }; |
| 44 | /** | 58 | /** |
| 45 | Split·a·string· | 59 | Split·a·string·similar·to·Lodash's·`_.words()`·function. |
| 46 | -·Split·on·each·word·that·begins·with·a·capital·letter. | 60 | -·Split·on·each·word·that·begins·with·a·capital·letter. |
| 47 | -·Split·on·each·{@link·WordSeparators}. | 61 | -·Split·on·each·{@link·WordSeparators}. |
| 62 | -·Split·on·each·{@link·AsciiPunctuation}·(if·{@link·WordsOptions.splitOnPunctuation}·is·enabled). | ||
| 48 | -·Split·on·numeric·sequence. | 63 | -·Split·on·numeric·sequence. |
| 49 | @example | 64 | @example |
| 50 | ``` | 65 | ``` |
| 51 | import·type·{Words}·from·'type-fest'; | 66 | import·type·{Words}·from·'type-fest'; |
| 52 | type·Words0·=·Words<'helloWorld'>; | 67 | type·Words0·=·Words<'helloWorld'>; |
| Offset 68, 29 lines modified | Offset 86, 37 lines modified | ||
| 68 | //=>·['hello',·'the',·'world'] | 86 | //=>·['hello',·'the',·'world'] |
| 69 | type·Words4·=·Words<'lifeIs42'>; | 87 | type·Words4·=·Words<'lifeIs42'>; |
| 70 | //=>·['life',·'Is',·'42'] | 88 | //=>·['life',·'Is',·'42'] |
| 71 | type·Words5·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; | 89 | type·Words5·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; |
| 72 | //=>·['p2p',·'Network'] | 90 | //=>·['p2p',·'Network'] |
| 91 | type·Words6·=·Words<'hello:world',·{splitOnPunctuation:·true}>; | ||
| 92 | //=>·['hello',·'world'] | ||
| 93 | type·Words7·=·Words<'hello:world',·{splitOnPunctuation:·false}>; | ||
| 94 | //=>·['hello',·':world'] | ||
| 95 | type·Words8·=·Words<'hello::world',·{splitOnPunctuation:·true}>; | ||
| 96 | //=>·['hello',·'world'] | ||
| 73 | ``` | 97 | ``` |
| 74 | @category·Change·case | 98 | @category·Change·case |
| 75 | @category·Template·literal | 99 | @category·Template·literal |
| 76 | */ | 100 | */ |
| 101 | export·type·Words<Sentence·extends·string,·Options·extends·WordsOptions·=·{}>·=·WordsImplementation<Sentence,·ApplyDefaultOptions<WordsOptions,·_DefaultWordsOptions,·Options>>; | ||
| 77 | export·type·Words<Sentence·extends·string,·Options·extends·WordsOptions·=·{}>·= | ||
| 78 | » WordsImplementation<Sentence,·ApplyDefaultOptions<WordsOptions,·_DefaultWordsOptions,·Options>>; | ||
| 79 | type·WordsImplementation< | 102 | type·WordsImplementation< |
| 80 | » Sentence·extends·string, | 103 | » Sentence·extends·string, |
| 81 | » Options·extends·Required<WordsOptions>, | 104 | » Options·extends·Required<WordsOptions>, |
| 82 | » LastCharacter·extends·string·=·'', | 105 | » LastCharacter·extends·string·=·'', |
| 83 | » CurrentWord·extends·string·=·'', | 106 | » CurrentWord·extends·string·=·'', |
| 84 | >·=·Sentence·extends·`${infer·FirstCharacter}${infer·RemainingCharacters}` | 107 | >·=·Sentence·extends·`${infer·FirstCharacter}${infer·RemainingCharacters}` |
| 85 | » ?·FirstCharacter·extends·WordSeparators | 108 | » ?·FirstCharacter·extends·WordSeparators·|·(Options['splitOnPunctuation']·extends·true·?·AsciiPunctuation·:·never) |
| 86 | » » //·Skip·word·separator | 109 | » » //·Skip·word·separator |
| 87 | » » ?·[...SkipEmptyWord<CurrentWord>,·...WordsImplementation<RemainingCharacters,·Options>] | 110 | » » ?·[...SkipEmptyWord<CurrentWord>,·...WordsImplementation<RemainingCharacters,·Options>] |
| 88 | » » :·LastCharacter·extends·'' | 111 | » » :·LastCharacter·extends·'' |
| 89 | » » » //·Fist·char·of·word | 112 | » » » //·Fist·char·of·word |
| 90 | » » » ?·WordsImplementation<RemainingCharacters,·Options,·FirstCharacter,·FirstCharacter> | 113 | » » » ?·WordsImplementation<RemainingCharacters,·Options,·FirstCharacter,·FirstCharacter> |
| 91 | » » » //·Case·change:·non-numeric·to·numeric | 114 | » » » //·Case·change:·non-numeric·to·numeric |
| 92 | » » » :·[false,·true]·extends·[IsNumeric<LastCharacter>,·IsNumeric<FirstCharacter>] | 115 | » » » :·[false,·true]·extends·[IsNumeric<LastCharacter>,·IsNumeric<FirstCharacter>] |
| Offset 46, 23 lines modified | Offset 46, 23 lines modified | ||
| 46 | const·writableArray:·Writable<typeof·readonlyArray>·=·readonlyArray·as·Writable<typeof·readonlyArray>; | 46 | const·writableArray:·Writable<typeof·readonlyArray>·=·readonlyArray·as·Writable<typeof·readonlyArray>; |
| 47 | writableArray.push(4);·//·Will·work·as·the·array·itself·is·now·writable. | 47 | writableArray.push(4);·//·Will·work·as·the·array·itself·is·now·writable. |
| 48 | ``` | 48 | ``` |
| 49 | @category·Object | 49 | @category·Object |
| 50 | */ | 50 | */ |
| 51 | export·type·Writable<BaseType,·Keys·extends·keyof·BaseType·=·keyof·BaseType>·= | 51 | export·type·Writable<BaseType,·Keys·extends·keyof·BaseType·=·keyof·BaseType>·= |
| 52 | BaseType·extends·ReadonlyMap<infer·KeyType,·infer·ValueType> | 52 | » BaseType·extends·ReadonlyMap<infer·KeyType,·infer·ValueType> |
| 53 | » ?·Map<KeyType,·ValueType> | 53 | » » ?·Map<KeyType,·ValueType> |
| 54 | » :·BaseType·extends·ReadonlySet<infer·ItemType> | 54 | » » :·BaseType·extends·ReadonlySet<infer·ItemType> |
| 55 | » » ?·Set<ItemType> | 55 | » » » ?·Set<ItemType> |
| 56 | » » :·BaseType·extends·readonly·unknown[] | 56 | » » » :·BaseType·extends·readonly·unknown[] |
| 57 | » » » //·Handle·array | 57 | » » » » //·Handle·array |
| 58 | » » » ?·WritableArray<BaseType> | 58 | » » » » ?·WritableArray<BaseType> |
| 59 | » » » //·Handle·object | 59 | » » » » //·Handle·object |
| 60 | » » » :·Simplify< | 60 | » » » » :·Simplify< |
| 61 | » » » //·Pick·just·the·keys·that·are·not·writable·from·the·base·type. | 61 | » » » » » //·Pick·just·the·keys·that·are·not·writable·from·the·base·type. |
| 62 | » » » » Except<BaseType,·Keys> | 62 | » » » » » Except<BaseType,·Keys> |
| 63 | » » » //·Pick·the·keys·that·should·be·writable·from·the·base·type·and·make·them·writable·by·removing·the·`readonly`·modifier·from·the·key. | 63 | » » » » » //·Pick·the·keys·that·should·be·writable·from·the·base·type·and·make·them·writable·by·removing·the·`readonly`·modifier·from·the·key. |
| 64 | » » » » {-readonly·[KeyType·in·keyof·Pick<BaseType,·Keys>]:·Pick<BaseType,·Keys>[KeyType]} | 64 | » » » » » &·{-readonly·[KeyType·in·keyof·Pick<BaseType,·Keys>]:·Pick<BaseType,·Keys>[KeyType]} |
| 65 | » » » >; | 65 | » » » » >; |
| 66 | export·{}; | 66 | export·{}; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Not}·from·'./internal/type.d.ts'; | 1 | import·type·{Not}·from·'./internal/type.d.ts'; |
| 2 | import·type·{And}·from·'./and.d.ts'; | 2 | import·type·{And}·from·'./and.d.ts'; |
| 3 | import·type·{Or}·from·'./or.d.ts'; | 3 | import·type·{Or}·from·'./or.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Returns·a·boolean·for·whether·only·one·of·two·given·types·is·true. | 5 | Returns·a·boolean·for·whether·only·one·of·two·given·types·is·`true`. |
| 6 | Use-case:·Constructing·complex·conditional·types·where·one·single·condition·must·be·satisfied. | 6 | Use-case:·Constructing·complex·conditional·types·where·one·single·condition·must·be·satisfied. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{Xor}·from·'type-fest'; | 9 | import·type·{Xor}·from·'type-fest'; |
| Offset 1, 12 lines modified | Offset 1, 12 lines modified | ||
| 1 | -rw-r--r--···0········0········0······509·2026-04-14·11:07:36.000000·info/about.json | 1 | -rw-r--r--···0········0········0······509·2026-04-14·11:07:36.000000·info/about.json |
| 2 | -rw-r--r--···0········0········0······118·2026-04-14·11:07:36.000000·info/hash_input.json | 2 | -rw-r--r--···0········0········0······118·2026-04-14·11:07:36.000000·info/hash_input.json |
| 3 | -rw-r--r--···0········0········0······224·2026-04-14·11:07:36.000000·info/index.json | 3 | -rw-r--r--···0········0········0······224·2026-04-14·11:07:36.000000·info/index.json |
| 4 | -rw-r--r--···0········0········0·····1085·2026-04-14·11:07:36.000000·info/licenses/LICENSE | 4 | -rw-r--r--···0········0········0·····1085·2026-04-14·11:07:36.000000·info/licenses/LICENSE |
| 5 | -rw-r--r--···0········0········0···231329·2026-04-14·11:07:36.000000·info/licenses/third-party-licenses.txt | 5 | -rw-r--r--···0········0········0···231329·2026-04-14·11:07:36.000000·info/licenses/third-party-licenses.txt |
| 6 | -rw-r--r--···0········0········0···98 | 6 | -rw-r--r--···0········0········0···986947·2026-04-14·11:07:36.000000·info/paths.json |
| 7 | -rwxr-xr-x···0········0········0······745·2026-04-14·11:07:36.000000·info/recipe/build.sh | 7 | -rwxr-xr-x···0········0········0······745·2026-04-14·11:07:36.000000·info/recipe/build.sh |
| 8 | -rw-r--r--···0········0········0·····1520·2026-04-14·11:07:36.000000·info/recipe/recipe-scripts-license.txt | 8 | -rw-r--r--···0········0········0·····1520·2026-04-14·11:07:36.000000·info/recipe/recipe-scripts-license.txt |
| 9 | -rw-r--r--···0········0········0······727·2026-04-14·11:07:36.000000·info/recipe/recipe.yaml | 9 | -rw-r--r--···0········0········0······727·2026-04-14·11:07:36.000000·info/recipe/recipe.yaml |
| 10 | -rw-r--r--···0········0········0····10948·2026-04-14·11:07:36.000000·info/recipe/rendered_recipe.yaml | 10 | -rw-r--r--···0········0········0····10948·2026-04-14·11:07:36.000000·info/recipe/rendered_recipe.yaml |
| 11 | -rw-r--r--···0········0········0······100·2026-04-14·11:07:36.000000·info/recipe/variant_config.yaml | 11 | -rw-r--r--···0········0········0······100·2026-04-14·11:07:36.000000·info/recipe/variant_config.yaml |
| 12 | -rw-r--r--···0········0········0·······42·2026-04-14·11:07:36.000000·info/tests/tests.yaml | 12 | -rw-r--r--···0········0········0·······42·2026-04-14·11:07:36.000000·info/tests/tests.yaml |
| Offset 4223, 15 lines modified | Offset 4223, 15 lines modified | ||
| 4223 | ····Work. | 4223 | ····Work. |
| 4224 | ·d.·Affirmer·understands·and·acknowledges·that·Creative·Commons·is·not·a | 4224 | ·d.·Affirmer·understands·and·acknowledges·that·Creative·Commons·is·not·a |
| 4225 | ····party·to·this·document·and·has·no·duty·or·obligation·with·respect·to | 4225 | ····party·to·this·document·and·has·no·duty·or·obligation·with·respect·to |
| 4226 | ····this·CC0·or·use·of·the·Work. | 4226 | ····this·CC0·or·use·of·the·Work. |
| 4227 | --- | 4227 | --- |
| 4228 | The·following·software·may·be·included·in·this·product:·type-fest·(5. | 4228 | The·following·software·may·be·included·in·this·product:·type-fest·(5.6.0) |
| 4229 | This·software·contains·the·following·license·and·notice·below: | 4229 | This·software·contains·the·following·license·and·notice·below: |
| 4230 | Creative·Commons·Legal·Code | 4230 | Creative·Commons·Legal·Code |
| 4231 | CC0·1.0·Universal | 4231 | CC0·1.0·Universal |
| 4232 | ····CREATIVE·COMMONS·CORPORATION·IS·NOT·A·LAW·FIRM·AND·DOES·NOT·PROVIDE | 4232 | ····CREATIVE·COMMONS·CORPORATION·IS·NOT·A·LAW·FIRM·AND·DOES·NOT·PROVIDE |
| Offset 14495, 16 lines modified | Offset 14495, 16 lines modified | ||
| 14495 | ············"path_type":·"hardlink", | 14495 | ············"path_type":·"hardlink", |
| 14496 | ············"sha256":·"5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3", | 14496 | ············"sha256":·"5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3", |
| 14497 | ············"size_in_bytes":·1117 | 14497 | ············"size_in_bytes":·1117 |
| 14498 | ········}, | 14498 | ········}, |
| 14499 | ········{ | 14499 | ········{ |
| 14500 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/index.d.ts", | 14500 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/index.d.ts", |
| 14501 | ············"path_type":·"hardlink", | 14501 | ············"path_type":·"hardlink", |
| 14502 | ············"sha256":·" | 14502 | ············"sha256":·"f9bc5af361d305d7496ffcedb342efbb413061f13923fa42818735fa4987d2ba", |
| 14503 | ············"size_in_bytes":·12 | 14503 | ············"size_in_bytes":·12928 |
| 14504 | ········}, | 14504 | ········}, |
| 14505 | ········{ | 14505 | ········{ |
| 14506 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-cc0", | 14506 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-cc0", |
| 14507 | ············"path_type":·"hardlink", | 14507 | ············"path_type":·"hardlink", |
| 14508 | ············"sha256":·"a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499", | 14508 | ············"sha256":·"a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499", |
| 14509 | ············"size_in_bytes":·7048 | 14509 | ············"size_in_bytes":·7048 |
| 14510 | ········}, | 14510 | ········}, |
| Offset 14513, 46 lines modified | Offset 14513, 52 lines modified | ||
| 14513 | ············"path_type":·"hardlink", | 14513 | ············"path_type":·"hardlink", |
| 14514 | ············"sha256":·"5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3", | 14514 | ············"sha256":·"5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3", |
| 14515 | ············"size_in_bytes":·1117 | 14515 | ············"size_in_bytes":·1117 |
| 14516 | ········}, | 14516 | ········}, |
| 14517 | ········{ | 14517 | ········{ |
| 14518 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/package.json", | 14518 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/package.json", |
| 14519 | ············"path_type":·"hardlink", | 14519 | ············"path_type":·"hardlink", |
| 14520 | ············"sha256":·" | 14520 | ············"sha256":·"8a776054945d5e17167686aff89c210605cdb310585e7d18fb95a0e2c9e3de13", |
| 14521 | ············"size_in_bytes":·1 | 14521 | ············"size_in_bytes":·1654 |
| 14522 | ········}, | 14522 | ········}, |
| 14523 | ········{ | 14523 | ········{ |
| 14524 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/readme.md", | 14524 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/readme.md", |
| 14525 | ············"path_type":·"hardlink", | 14525 | ············"path_type":·"hardlink", |
| 14526 | ············"sha256":·" | 14526 | ············"sha256":·"16fd3399f2980e2ec7b7f02a0a2ea087399598f1baad1ddc7cd96f3292b747da", |
| 14527 | ············"size_in_bytes":·62 | 14527 | ············"size_in_bytes":·62264 |
| 14528 | ········}, | ||
| 14529 | ········{ | ||
| 14530 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/absolute.d.ts", | ||
| 14531 | ············"path_type":·"hardlink", | ||
| 14532 | ············"sha256":·"560fb7cb6377416f9be984a0ea75992e4e2e0b6b0105c1877a03d1cd42c7be76", | ||
| 14533 | ············"size_in_bytes":·1000 | ||
| 14528 | ········}, | 14534 | ········}, |
| 14529 | ········{ | 14535 | ········{ |
| 14530 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-extend.d.ts", | 14536 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-extend.d.ts", |
| 14531 | ············"path_type":·"hardlink", | 14537 | ············"path_type":·"hardlink", |
| 14532 | ············"sha256":·"67ac4c97d6f84990ecf9775877b40abdd1169d06aec51750325491221a6fed4f", | 14538 | ············"sha256":·"67ac4c97d6f84990ecf9775877b40abdd1169d06aec51750325491221a6fed4f", |
| 14533 | ············"size_in_bytes":·3343 | 14539 | ············"size_in_bytes":·3343 |
| 14534 | ········}, | 14540 | ········}, |
| 14535 | ········{ | 14541 | ········{ |
| 14536 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-union-fields.d.ts", | 14542 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-union-fields.d.ts", |
| 14537 | ············"path_type":·"hardlink", | 14543 | ············"path_type":·"hardlink", |
| 14538 | ············"sha256":·"6 | 14544 | ············"sha256":·"4869351067bfe590c999008942fcacec26e4af771ec27ed1b27d1dfc86c2c1a5", |
| 14539 | ············"size_in_bytes":·2 | 14545 | ············"size_in_bytes":·2462 |
| 14540 | ········}, | 14546 | ········}, |
| 14541 | ········{ | 14547 | ········{ |
| 14542 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and-all.d.ts", | 14548 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and-all.d.ts", |
| 14543 | ············"path_type":·"hardlink", | 14549 | ············"path_type":·"hardlink", |
| 14544 | ············"sha256":·"0c7905fb84c0678fdf4ca3c5d7f0e3ff1d6f096749a32d18d3f516e40c3b8cb7", | 14550 | ············"sha256":·"0c7905fb84c0678fdf4ca3c5d7f0e3ff1d6f096749a32d18d3f516e40c3b8cb7", |
| 14545 | ············"size_in_bytes":·2050 | 14551 | ············"size_in_bytes":·2050 |
| 14546 | ········}, | 14552 | ········}, |
| 14547 | ········{ | 14553 | ········{ |
| 14548 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and.d.ts", | 14554 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and.d.ts", |
| 14549 | ············"path_type":·"hardlink", | 14555 | ············"path_type":·"hardlink", |
| 14550 | ············"sha256":·" | 14556 | ············"sha256":·"ce9a92fa30beb6aa039c8e6b3ced2261a2fea149fa70046a543531bd4d767975", |
| 14551 | ············"size_in_bytes":·150 | 14557 | ············"size_in_bytes":·1509 |
| 14552 | ········}, | 14558 | ········}, |
| 14553 | ········{ | 14559 | ········{ |
| 14554 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-element.d.ts", | 14560 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-element.d.ts", |
| 14555 | ············"path_type":·"hardlink", | 14561 | ············"path_type":·"hardlink", |
| 14556 | ············"sha256":·"a23b404fbd4eeb4dbe9a16c3cb6c77cdb6969d433c0b723b0f5aa4de5f7b7953", | 14562 | ············"sha256":·"a23b404fbd4eeb4dbe9a16c3cb6c77cdb6969d433c0b723b0f5aa4de5f7b7953", |
| 14557 | ············"size_in_bytes":·1219 | 14563 | ············"size_in_bytes":·1219 |
| 14558 | ········}, | 14564 | ········}, |
| Offset 14579, 16 lines modified | Offset 14585, 16 lines modified | ||
| 14579 | ············"path_type":·"hardlink", | 14585 | ············"path_type":·"hardlink", |
| 14580 | ············"sha256":·"70acecbbb46d43b76ee7e3b4e6f2b0539eede73fe747491caaa093d61f29e4db", | 14586 | ············"sha256":·"70acecbbb46d43b76ee7e3b4e6f2b0539eede73fe747491caaa093d61f29e4db", |
| 14581 | ············"size_in_bytes":·4320 | 14587 | ············"size_in_bytes":·4320 |
| 14582 | ········}, | 14588 | ········}, |
| 14583 | ········{ | 14589 | ········{ |
| 14584 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-splice.d.ts", | 14590 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-splice.d.ts", |
| 14585 | ············"path_type":·"hardlink", | 14591 | ············"path_type":·"hardlink", |
| 14586 | ············"sha256":·" | 14592 | ············"sha256":·"6e1435c1c4300a30ee53a812a002e9e37f5ca02a5d6c7cbccad7ec667d02aacf", |
| 14587 | ············"size_in_bytes":·31 | 14593 | ············"size_in_bytes":·3171 |
| 14588 | ········}, | 14594 | ········}, |
| 14589 | ········{ | 14595 | ········{ |
| 14590 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-tail.d.ts", | 14596 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-tail.d.ts", |
| 14591 | ············"path_type":·"hardlink", | 14597 | ············"path_type":·"hardlink", |
| 14592 | ············"sha256":·"37df01381ecd3595e4c63c67d8bb959bb9794282e88b6e3f768b6f8fb4cb7093", | 14598 | ············"sha256":·"37df01381ecd3595e4c63c67d8bb959bb9794282e88b6e3f768b6f8fb4cb7093", |
| 14593 | ············"size_in_bytes":·1873 | 14599 | ············"size_in_bytes":·1873 |
| 14594 | ········}, | 14600 | ········}, |
| Offset 14621, 28 lines modified | Offset 14627, 28 lines modified | ||
| 14621 | ············"path_type":·"hardlink", | 14627 | ············"path_type":·"hardlink", |
| 14622 | ············"sha256":·"04dc33f1dbf2f463c6480d431da59a772140be86c438f9445a0f2181b2893bfc", | 14628 | ············"sha256":·"04dc33f1dbf2f463c6480d431da59a772140be86c438f9445a0f2181b2893bfc", |
| 14623 | ············"size_in_bytes":·1293 | 14629 | ············"size_in_bytes":·1293 |
| 14624 | ········}, | 14630 | ········}, |
| 14625 | ········{ | 14631 | ········{ |
| 14626 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-case.d.ts", | 14632 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-case.d.ts", |
| 14627 | ············"path_type":·"hardlink", | 14633 | ············"path_type":·"hardlink", |
| 14628 | ············"sha256":·" | 14634 | ············"sha256":·"399a3acb5e52325ee91ae74c95666f5071e9cdcce29c28b4e6f68f6038972f32", |
| 14629 | ············"size_in_bytes":· | 14635 | ············"size_in_bytes":·3403 |
| 14630 | ········}, | 14636 | ········}, |
| 14631 | ········{ | 14637 | ········{ |
| 14632 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-cased-properties-deep.d.ts", | 14638 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-cased-properties-deep.d.ts", |
| Max diff block lines reached; 104897/110945 bytes (94.55%) of diff not shown. | |||