@signpostmarv/js-types
v0.2.0
Published
JavaScript types more specific than TypeScript supports natively
Readme
JS Types
Array.prototype
Array.prototype.map
declare global {
interface Array<T> {
map<U>(
callbackfn: (value: T, index: number, array: [T, T, ...T[]]) => U,
thisArg?: unknown
): [U, U, ...U[]];
map<U>(
callbackfn: (value: T, index: number, array: [T, ...T[]]) => U,
thisArg?: unknown
): [U, ...U[]];
map<U>(
callbackfn: (value: T, index: number, array: T[]) => U,
thisArg?: unknown
): U[];
}
}Object
Object.entries
declare global {
interface ObjectConstructor {
entries<K extends string, V>(o: {[key in K]: V}): [
keyof typeof o,
(typeof o)[keyof typeof o],
][];
entries<T>(o: {[s: string]: T} | ArrayLike<T>): [string, T][];
}
}Object.keys
declare global {
interface ObjectConstructor {
keys<
T extends Exclude<{[key: string]: unknown}, Record<string, never>>,
K = keyof T & string,
>(
o: T
): [K, ...K[]];
keys<T extends {[key: string]: unknown}, K = keyof T & string>(
o: T
): K[];
keys(o: object): string[];
}
}