Skip to content

Commit d5a86a5

Browse files
committed
Create package with core-js types
1 parent f4acaef commit d5a86a5

File tree

161 files changed

+1177
-720
lines changed

Some content is hidden

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

161 files changed

+1177
-720
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ node_modules/
4545
/packages/core-js-pure/index.js
4646
/packages/core-js-pure/index.d.ts
4747
/packages/core-js-pure/configurator.js
48+
/packages/core-js-types/dist/
49+
/packages/core-js-types/LICENSE
4850
/tests/**/bundles/
4951
/tests/compat/*.jar
5052
/tests/compat/compat-data.js

package-lock.json

Lines changed: 113 additions & 100 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"prepare": "npm run zxi scripts/prepare.mjs",
2020
"build-entries": "npm run zxi time scripts/build-entries/index.mjs",
2121
"build-compat": "npm run zxi scripts/build-compat/index.mjs",
22+
"build-types": "npm run zxi time scripts/build-types/index.mjs",
2223
"build-web": "npm run zxi time website/index.mjs",
2324
"bundle": "run-s bundle-package bundle-tests",
2425
"bundle-package": "npm run zxi time scripts/bundle-package/bundle-package.mjs",
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "@core-js/types",
3+
"version": "4.0.0-alpha.0",
4+
"publishConfig": {
5+
"access": "public"
6+
},
7+
"type": "commonjs",
8+
"description": "TypeScript types for core-js",
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/zloirock/core-js.git",
12+
"directory": "packages/core-js-types"
13+
},
14+
"homepage": "https://core-js.io",
15+
"bugs": {
16+
"url": "https://github.com/zloirock/core-js/issues"
17+
},
18+
"funding": {
19+
"type": "opencollective",
20+
"url": "https://opencollective.com/core-js"
21+
},
22+
"license": "SEE LICENSE IN LICENSE.md",
23+
"author": {
24+
"name": "Denis Pushkarev",
25+
"email": "zloirock@zloirock.ru",
26+
"url": "http://zloirock.ru"
27+
},
28+
"types": "dist/core-js-types.latest.d.ts",
29+
"files": [
30+
"dist/core-js-types.latest.d.ts"
31+
]
32+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
interface AggregateError extends Error {
2+
errors: any[];
3+
}
4+
5+
interface AggregateErrorConstructor {
6+
new (errors: Iterable<any>, message?: string): AggregateError;
7+
(errors: Iterable<any>, message?: string): AggregateError;
8+
readonly prototype: AggregateError;
9+
}
10+
11+
declare var AggregateError: AggregateErrorConstructor;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
interface Object {
2+
__defineGetter__(prop: PropertyKey, getter: () => any): void;
3+
4+
__defineSetter__(prop: PropertyKey, setter: (val: any) => void): void;
5+
6+
__lookupGetter__(prop: PropertyKey): (() => any) | undefined;
7+
8+
__lookupSetter__(prop: PropertyKey): ((val: any) => void) | undefined;
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
interface SymbolConstructor {
2+
readonly matchAll: unique symbol;
3+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type Immediate = object;
2+
3+
declare function setImmediate(handler: (...args: any[]) => void, ...args: any[]): Immediate;
4+
declare function clearImmediate(immediate: Immediate): void;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 global {
6+
interface IteratorObject<T, TReturn, TNext> extends Iterator<T, TReturn, TNext> {}
7+
8+
interface AsyncIteratorObject<T, TReturn, TNext> extends AsyncIterator<T, TReturn, TNext> {
9+
[Symbol.asyncIterator](): AsyncIteratorObject<T, TReturn, TNext>;
10+
}
11+
12+
interface AsyncIterableIterator<T, TReturn, TNext> extends AsyncIterator<T, TReturn, TNext> {
13+
[Symbol.asyncIterator](): AsyncIterableIterator<T, TReturn, TNext>;
14+
}
15+
16+
interface PromiseFulfilledResult<T> { status: "fulfilled"; value: T; }
17+
18+
interface PromiseRejectedResult { status: "rejected"; reason: any; }
19+
20+
interface AsyncIterable<T, TReturn = any, TNext = any> { [Symbol.asyncIterator](): AsyncIterator<T, TReturn, TNext>; }
21+
}
22+
23+
export type CoreJsDecoratorMetadataObject = typeof globalThis extends { DecoratorMetadataObject: infer O }
24+
? O
25+
: Record<PropertyKey, unknown> & object;
26+
27+
export type CoreJsIteratorObject<T, TReturn = any, TNext = undefined> = IteratorObject<T, TReturn, TNext>;
28+
29+
export type CoreJsFlatArray<Arr, Depth extends number> = typeof globalThis extends { FlatArray: infer O }
30+
? O
31+
: {
32+
done: Arr;
33+
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]>
34+
: Arr;
35+
}[Depth extends -1 ? "done" : "recur"];
36+
37+
export type CoreJsPromiseSettledResult<T> = typeof globalThis extends { PromiseSettledResult: infer O }
38+
? O
39+
: PromiseFulfilledResult<T> | PromiseRejectedResult;

packages/core-js/types/proposals/accessible-object-hasownproperty.d.ts renamed to packages/core-js-types/src/56/proposals/accessible-object-hasownproperty.d.ts

File renamed without changes.

0 commit comments

Comments
 (0)