Skip to content

Commit 6a1ad75

Browse files
committed
Pure types refactoring & some improvements
1 parent 5ba88f8 commit 6a1ad75

File tree

81 files changed

+430
-763
lines changed

Some content is hidden

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

81 files changed

+430
-763
lines changed

packages/core-js-types/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"types@>=5.6": "./dist/56/pure.d.ts",
6060
"types": "./dist/52/pure.d.ts",
6161
"default": "./dist/56/pure.d.ts"
62-
6362
},
6463
"./stable": {
6564
"types@>=5.6": "./dist/56/stable.d.ts",

packages/core-js-types/src/56/proposals/pure/global-this.d.ts renamed to packages/core-js-types/src/56/common/pure/global-this.d.ts

File renamed without changes.

packages/core-js-types/src/56/proposals/pure/reflect.d.ts renamed to packages/core-js-types/src/56/common/pure/reflect.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// For ensuring compatibility with TypeScript standard types, this code is based on:
2+
// https://github.com/microsoft/TypeScript/blob/38d95c8001300f525fd601dd0ce6d0ff5f12baee/src/lib/es2015.reflect.d.ts
3+
// License: https://github.com/microsoft/TypeScript/blob/v5.9.3/LICENSE.txt
4+
15
declare namespace CoreJS {
26
interface Reflect {
37
/**
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare namespace CoreJS {
2+
export interface CoreJSAsyncIterable<T, TReturn = any, TNext = any> {}
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare namespace CoreJS {
2+
export interface CoreJSAsyncIteratorObject<T, TReturn = unknown, TNext = unknown> {}
3+
}

packages/core-js-types/src/56/core-js-types/core-js-types.d.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,3 @@ export type CoreJSDecoratorMetadataObject = typeof globalThis extends { Decorato
3838
: Record<PropertyKey, unknown> & object;
3939

4040
export type CoreJSIteratorObject<T, TReturn = any, TNext = undefined> = IteratorObject<T, TReturn, TNext>;
41-
42-
export type CoreJSPromiseSettledResult<T> = typeof globalThis extends { PromiseSettledResult: infer O } // from ts 3.8 and es2020
43-
? O
44-
: PromiseFulfilledResult<T> | PromiseRejectedResult;
45-
46-
export type CoreJSFlatArray<Arr, Depth extends number> = typeof globalThis extends { FlatArray: infer O } // from ts 4.4
47-
? O
48-
: {
49-
done: Arr;
50-
recur: Arr extends ReadonlyArray<infer InnerArr> ? CoreJSFlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
51-
: Arr;
52-
}[Depth extends -1 ? "done" : "recur"];

packages/core-js-types/src/56/core-js-types/core-js-types.pure.d.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,4 @@ declare namespace CoreJS {
99
export type CoreJSDecoratorMetadataObject = typeof globalThis extends { DecoratorMetadataObject: infer O } // from ts 5.2
1010
? O
1111
: Record<PropertyKey, unknown> & object;
12-
13-
interface PromiseFulfilledResult<T> { status: "fulfilled"; value: T; }
14-
15-
interface PromiseRejectedResult { status: "rejected"; reason: any; }
16-
17-
export type CoreJSPromiseSettledResult<T> = typeof globalThis extends { PromiseSettledResult: infer O } // from ts 3.8 and es2020
18-
? O
19-
: PromiseFulfilledResult<T> | PromiseRejectedResult;
20-
21-
export type CoreJSFlatArray<Arr, Depth extends number> = typeof globalThis extends { FlatArray: infer O } // from ts 4.4
22-
? O
23-
: {
24-
done: Arr;
25-
recur: Arr extends ReadonlyArray<infer InnerArr> ? CoreJSFlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
26-
: Arr;
27-
}[Depth extends -1 ? "done" : "recur"];
2812
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare namespace CoreJS {
2+
export type CoreJSDecoratorMetadataObject = typeof globalThis extends { DecoratorMetadataObject: infer O } // from ts 5.2
3+
? O
4+
: Record<PropertyKey, unknown> & object;
5+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// For ensuring compatibility with TypeScript standard types, this code is based on:
2+
// https://github.com/microsoft/TypeScript/blob/2a90a739c1c1e87e3c3d0c93e16f7e5baadf8035/src/lib/es2019.array.d.ts
3+
// License: https://github.com/microsoft/TypeScript/blob/v5.9.3/LICENSE.txt
4+
5+
declare namespace CoreJS {
6+
export type CoreJSFlatArray<Arr, Depth extends number> = typeof globalThis extends { FlatArray: infer O } // from ts 4.4
7+
? O
8+
: {
9+
done: Arr;
10+
recur: Arr extends ReadonlyArray<infer InnerArr> ? CoreJSFlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
11+
: Arr;
12+
}[Depth extends -1 ? "done" : "recur"];
13+
}

0 commit comments

Comments
 (0)