Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "core-dts", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"types": "./src/index.d.ts", | ||
"author": "kingwl", | ||
"repository": { | ||
"url": "https://github.com/Kingwl/core-dts" | ||
}, | ||
"scripts": { | ||
"test": "tsc", | ||
"format:check": "prettier ./{src,tests}/**/*.ts", | ||
"format:check": "prettier \"./{src,tests}/**/*.ts\" -c", | ||
"format": "pnpm format:check --write" | ||
@@ -9,0 +13,0 @@ }, |
@@ -27,2 +27,23 @@ # core-dts | ||
## Proposals | ||
Default proposals are above `stage-3`. If you want to use something like `stage-2` proposal. | ||
```json | ||
{ | ||
"compilerOptions": { | ||
"types": ["core-dts/src/proposals/stage-2"] | ||
} | ||
} | ||
``` | ||
Or you want to use some specific proposal. | ||
```json | ||
{ | ||
"compilerOptions": { | ||
"types": ["core-dts/src/proposals/stage-2/iterator-helper.d.ts"] | ||
} | ||
} | ||
``` | ||
## Features | ||
@@ -29,0 +50,0 @@ - [x] Finished proposals |
/// <reference path="./proposals/stage-3/index.d.ts" /> |
/// <reference path="./stage-2/index.d.ts" /> |
interface ArrayConstructor { | ||
fromAsync<T>(asyncItems: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn?: never, thisArg?: any): T[] | ||
fromAsync<T, U>(asyncItems: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn?: (value: T, index: number) => U, thisArg?: any): U[] | ||
fromAsync<T, U>(asyncItems: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn?: (value: T, index: number) => U, thisArg?: any): U[] | ||
fromAsync<T>( | ||
asyncItems: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, | ||
mapFn?: never, | ||
thisArg?: any, | ||
): T[]; | ||
fromAsync<T, U>( | ||
asyncItems: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, | ||
mapFn?: (value: T, index: number) => U, | ||
thisArg?: any, | ||
): U[]; | ||
fromAsync<T, U>( | ||
asyncItems: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, | ||
mapFn?: (value: T, index: number) => U, | ||
thisArg?: any, | ||
): U[]; | ||
} |
interface ArrayConstructor { | ||
isTemplateObject(value: any): boolean; | ||
isTemplateObject(value: any): boolean; | ||
} |
@@ -0,0 +0,0 @@ /// <reference path="../stage-3/index.d.ts" /> |
interface IteratorProto<T, TReturn, TNext> { | ||
map<U, UReturn, UNext>(callback: (value: T) => U): IteratorProto<U, UReturn, UNext> | ||
map<U, UReturn, UNext>( | ||
callback: (value: T) => U, | ||
): IteratorProto<U, UReturn, UNext>; | ||
filter<S extends T>(callback: (value: T) => value is S): IteratorProto<S, TReturn, TNext> | ||
filter(callback: (value: T) => unknown): IteratorProto<T, TReturn, TNext> | ||
filter(callback: (value: T) => unknown): IteratorProto<T, TReturn, TNext> | ||
filter<S extends T>( | ||
callback: (value: T) => value is S, | ||
): IteratorProto<S, TReturn, TNext>; | ||
filter(callback: (value: T) => unknown): IteratorProto<T, TReturn, TNext>; | ||
filter(callback: (value: T) => unknown): IteratorProto<T, TReturn, TNext>; | ||
take(limit: number): IteratorProto<T, TReturn, TNext> | ||
take(limit: number): IteratorProto<T, TReturn, TNext>; | ||
drop(limit: number): IteratorProto<T, TReturn, TNext> | ||
drop(limit: number): IteratorProto<T, TReturn, TNext>; | ||
indexed(): IteratorProto<[number, T], [number, TReturn], [number, TNext]> | ||
indexed(): IteratorProto<[number, T], [number, TReturn], [number, TNext]>; | ||
flatMap<U, UReturn, UNext>(callback: (value: T) => U | ReadonlyArray<U>): IteratorProto<U, UReturn, UNext>[] | ||
flatMap<U, UReturn, UNext>( | ||
callback: (value: T) => U | ReadonlyArray<U>, | ||
): IteratorProto<U, UReturn, UNext>[]; | ||
reduce(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined; | ||
reduce(callbackfn: (previousValue: T, currentValue: T) => T, initialValue: T): T; | ||
reduce(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined; | ||
reduce( | ||
callbackfn: (previousValue: T, currentValue: T) => T, | ||
initialValue: T, | ||
): T; | ||
toArray(): T[] | ||
toArray(): T[]; | ||
toAsync(): AsyncIteratorProto<T, TReturn, TNext> | ||
toAsync(): AsyncIteratorProto<T, TReturn, TNext>; | ||
forEach(callback: (value: T) => void): void | ||
forEach(callback: (value: T) => void): void; | ||
some(callback: (value: T) => unknown): boolean | ||
some(callback: (value: T) => unknown): boolean; | ||
every(callback: (value: T) => unknown): boolean | ||
every(callback: (value: T) => unknown): boolean; | ||
find(callback: (value: T) => unknown): T | undefined | ||
find(callback: (value: T) => unknown): T | undefined; | ||
} | ||
interface AsyncIteratorProto<T, TReturn, TNext> { | ||
map<U, UReturn, UNext>(callback: (value: T) => U): AsyncIteratorProto<U, UReturn, UNext> | ||
map<U, UReturn, UNext>( | ||
callback: (value: T) => U, | ||
): AsyncIteratorProto<U, UReturn, UNext>; | ||
filter(callback: (value: T) => Promise<unknown>): AsyncIteratorProto<T, TReturn, TNext> | ||
filter( | ||
callback: (value: T) => Promise<unknown>, | ||
): AsyncIteratorProto<T, TReturn, TNext>; | ||
take(limit: number): AsyncIteratorProto<T, TReturn, TNext> | ||
take(limit: number): AsyncIteratorProto<T, TReturn, TNext>; | ||
drop(limit: number): AsyncIteratorProto<T, TReturn, TNext> | ||
drop(limit: number): AsyncIteratorProto<T, TReturn, TNext>; | ||
indexed(): AsyncIteratorProto<[number, T], [number, TReturn], [number, TNext]> | ||
indexed(): AsyncIteratorProto< | ||
[number, T], | ||
[number, TReturn], | ||
[number, TNext] | ||
>; | ||
flatMap<U, UReturn, UNext>(callback: (value: T) => Promise<U | ReadonlyArray<U>>): AsyncIteratorProto<U, UReturn, UNext>[] | ||
flatMap<U, UReturn, UNext>( | ||
callback: (value: T) => Promise<U | ReadonlyArray<U>>, | ||
): AsyncIteratorProto<U, UReturn, UNext>[]; | ||
reduce(callbackfn: (previousValue: T, currentValue: T) => Promise<T>): Promise<T | undefined>; | ||
reduce(callbackfn: (previousValue: T, currentValue: T) => Promise<T>, initialValue: T): Promise<T>; | ||
reduce( | ||
callbackfn: (previousValue: T, currentValue: T) => Promise<T>, | ||
): Promise<T | undefined>; | ||
reduce( | ||
callbackfn: (previousValue: T, currentValue: T) => Promise<T>, | ||
initialValue: T, | ||
): Promise<T>; | ||
toArray(): T[] | ||
toArray(): T[]; | ||
forEach(callback: (value: T) => void): void | ||
forEach(callback: (value: T) => void): void; | ||
some(callback: (value: T) => Promise<unknown>): Promise<boolean> | ||
some(callback: (value: T) => Promise<unknown>): Promise<boolean>; | ||
every(callback: (value: T) => Promise<unknown>): Promise<boolean> | ||
every(callback: (value: T) => Promise<unknown>): Promise<boolean>; | ||
find(callback: (value: T) => Promise<unknown>): Promise<T | undefined> | ||
find(callback: (value: T) => Promise<unknown>): Promise<T | undefined>; | ||
} | ||
interface IteratorConstructor { | ||
new <T = any, TReturn = any, TNext = any>(values?: readonly T[] | null): IteratorProto<T, TReturn, TNext>; | ||
readonly prototype: IteratorProto<any, any, any>; | ||
new <T = any, TReturn = any, TNext = any>( | ||
values?: readonly T[] | null, | ||
): IteratorProto<T, TReturn, TNext>; | ||
readonly prototype: IteratorProto<any, any, any>; | ||
from<T, TReturn, TNext>(obj: Iterator<T, TReturn, TNext>): IteratorProto<T, TReturn, TNext> | ||
from<T, TReturn, TNext>( | ||
obj: Iterator<T, TReturn, TNext>, | ||
): IteratorProto<T, TReturn, TNext>; | ||
} | ||
interface AsyncIteratorConstructor { | ||
new <T = any, TReturn = any, TNext = any>(values?: readonly T[] | null): AsyncIteratorProto<T, TReturn, TNext>; | ||
readonly prototype: AsyncIteratorProto<any, any, any>; | ||
new <T = any, TReturn = any, TNext = any>( | ||
values?: readonly T[] | null, | ||
): AsyncIteratorProto<T, TReturn, TNext>; | ||
readonly prototype: AsyncIteratorProto<any, any, any>; | ||
from<T, TReturn, TNext>(obj: AsyncIterator<T, TReturn, TNext>): AsyncIteratorProto<T, TReturn, TNext> | ||
from<T, TReturn, TNext>( | ||
obj: AsyncIterator<T, TReturn, TNext>, | ||
): AsyncIteratorProto<T, TReturn, TNext>; | ||
} | ||
@@ -72,0 +104,0 @@ |
interface MapEmplaceHander<K, V> { | ||
insert?: (key: K, map: Map<K, V>) => V | ||
update?: (existing: V, key: K, map: Map<K, V>) => V | ||
insert?: (key: K, map: Map<K, V>) => V; | ||
update?: (existing: V, key: K, map: Map<K, V>) => V; | ||
} | ||
interface Map<K, V> { | ||
emplace(key: K, hander: MapEmplaceHander<K, V>): V; | ||
emplace(key: K, hander: MapEmplaceHander<K, V>): V; | ||
} | ||
interface WeakMapEmplaceHander<K extends object, V> { | ||
insert?: (key: K, map: WeakMap<K, V>) => V | ||
update?: (existing: V, key: K, map: Map<K, V>) => V | ||
insert?: (key: K, map: WeakMap<K, V>) => V; | ||
update?: (existing: V, key: K, map: Map<K, V>) => V; | ||
} | ||
interface WeakMap<K extends object, V> { | ||
emplace(key: K, hander: WeakMapEmplaceHander<K, V>): V; | ||
emplace(key: K, hander: WeakMapEmplaceHander<K, V>): V; | ||
} |
interface Set<T> { | ||
difference(iterable: Iterable<T>): Set<T> | ||
intersection(iterable: Iterable<T>): Set<T> | ||
isDisjointFrom(iterable: Iterable<T>): boolean | ||
isSubsetOf(iterable: Iterable<T>): boolean | ||
isSupersetOf(iterable: Iterable<T>): boolean | ||
symmetricDifference(iterable: Iterable<T>): Set<T> | ||
union(iterable: Iterable<T>): Set<T> | ||
difference(iterable: Iterable<T>): Set<T>; | ||
intersection(iterable: Iterable<T>): Set<T>; | ||
isDisjointFrom(iterable: Iterable<T>): boolean; | ||
isSubsetOf(iterable: Iterable<T>): boolean; | ||
isSupersetOf(iterable: Iterable<T>): boolean; | ||
symmetricDifference(iterable: Iterable<T>): Set<T>; | ||
union(iterable: Iterable<T>): Set<T>; | ||
} |
interface SymbolConstructor { | ||
readonly dispose: unique symbol | ||
readonly asyncDispose: unique symbol | ||
readonly dispose: unique symbol; | ||
readonly asyncDispose: unique symbol; | ||
} |
interface SymbolConstructor { | ||
readonly metadataKey: unique symbol | ||
readonly metadataKey: unique symbol; | ||
} |
interface Array<T> { | ||
group<K extends keyof any>(callback: (value: T, index: number, obj: T[]) => K, thisArg?: any): Record<K, T[]>; | ||
groupToMap<K>(callback: (value: T, index: number, obj: T[]) => K, thisArg?: any): Map<K, T[]>; | ||
group<K extends keyof any>( | ||
callback: (value: T, index: number, obj: T[]) => K, | ||
thisArg?: any, | ||
): Record<K, T[]>; | ||
groupToMap<K>( | ||
callback: (value: T, index: number, obj: T[]) => K, | ||
thisArg?: any, | ||
): Map<K, T[]>; | ||
} |
interface Array<T> { | ||
toReversed(): T[]; | ||
toReversed(): T[]; | ||
toSorted(compareFn?: (a: T, b: T) => number): T[] | ||
toSorted(compareFn?: (a: T, b: T) => number): T[]; | ||
toSpliced(start: number, deleteCount: number, ...items: T[]): T[] | ||
toSpliced(start: number, deleteCount: number, ...items: T[]): T[]; | ||
with(index: number, value: T): T[] | ||
with(index: number, value: T): T[]; | ||
} |
@@ -0,0 +0,0 @@ /// <reference path="../stage-4/index.d.ts" /> |
interface Array<T> { | ||
findLast<S extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined; | ||
findLast(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined; | ||
findLast<S extends T>( | ||
predicate: (this: void, value: T, index: number, obj: T[]) => value is S, | ||
thisArg?: any, | ||
): S | undefined; | ||
findLast( | ||
predicate: (value: T, index: number, obj: T[]) => unknown, | ||
thisArg?: any, | ||
): T | undefined; | ||
findLastIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number; | ||
findLastIndex( | ||
predicate: (value: T, index: number, obj: T[]) => unknown, | ||
thisArg?: any, | ||
): number; | ||
} |
/// <reference path="./array-find-from-last.d.ts" /> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
9912
171
1
83