Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split internal.d.ts into multiple files #906

Merged
merged 10 commits into from
Jul 14, 2024
6 changes: 5 additions & 1 deletion script/test/source-files-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ const process = require('node:process');

const checkSourceFilesExtension = async () => {
try {
const files = await fs.promises.readdir('source');
const files = await fs.promises.readdir('source', {recursive: true});

let hasIncorrectFileExtension = false;
for (const file of files) {
if (!file.includes('.')) {
continue;
}

if (!file.endsWith('.d.ts')) {
hasIncorrectFileExtension = true;
console.error(`source/${file} extension should be \`.d.ts\`.`);
Expand Down
4 changes: 2 additions & 2 deletions source/array-slice.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {LessThanOrEqual} from './less-than-or-equal';
import type {GreaterThanOrEqual} from './greater-than-or-equal';
import type {GreaterThan} from './greater-than';
import type {IsNegative} from './numeric';
import type {Not, ArrayMin} from './internal';
import type {Not, TupleMin} from './internal';
import type {IsEqual} from './is-equal';
import type {And} from './and';
import type {ArraySplice} from './array-splice';
Expand Down Expand Up @@ -95,7 +95,7 @@ type ArraySliceHelper<
PositiveE extends number = IsNegative<End> extends true ? Sum<ArrayLength, End> : End,
> = true extends [IsNegative<PositiveS>, LessThanOrEqual<PositiveE, PositiveS>, GreaterThanOrEqual<PositiveS, ArrayLength>][number]
? []
: ArraySliceByPositiveIndex<Array_, ArrayMin<[PositiveS, ArrayLength]>, ArrayMin<[PositiveE, ArrayLength]>>;
: ArraySliceByPositiveIndex<Array_, TupleMin<[PositiveS, ArrayLength]>, TupleMin<[PositiveE, ArrayLength]>>;

type ArraySliceByPositiveIndex<
Array_ extends readonly unknown[],
Expand Down
2 changes: 1 addition & 1 deletion source/delimiter-case.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {UpperCaseCharacters, WordSeparators} from '../source/internal';
import type {UpperCaseCharacters, WordSeparators} from './internal';

// Transforms a string that is fully uppercase into a fully lowercase version. Needed to add support for SCREAMING_SNAKE_CASE, see https://github.com/sindresorhus/type-fest/issues/385
type UpperCaseToLowerCase<T extends string> = T extends Uppercase<T> ? Lowercase<T> : T;
Expand Down
2 changes: 1 addition & 1 deletion source/get.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {StringDigit} from '../source/internal';
import type {StringDigit} from './internal';
import type {Split} from './split';
import type {StringKeyOf} from './string-key-of';

Expand Down
Loading