Comparing version 1.0.9 to 1.1.0
import { ITSTypeBuildIn } from './build-in'; | ||
import Bluebird = require('bluebird'); | ||
export declare type ITSPickMember<T, K extends keyof T> = T[K]; | ||
import { ITSMapLike, ITSResolvable, ITSTypeFunction } from './generic'; | ||
import ITSType = require('./index'); | ||
export * from './helper'; | ||
export * from './generic'; | ||
export declare type ITSUnpackedReturnType<T extends (...args: any[]) => any> = ITSUnpacked<ReturnType<T>>; | ||
/** | ||
* @see https://stackoverflow.com/questions/49198713/override-the-properties-of-an-interface-in-typescript | ||
*/ | ||
export declare type ITSDiff<T extends keyof any, U extends keyof any> = ({ | ||
[P in T]: P; | ||
} & { | ||
[P in U]: never; | ||
} & { | ||
[x: string]: never; | ||
})[T]; | ||
/** | ||
* @see https://stackoverflow.com/questions/49198713/override-the-properties-of-an-interface-in-typescript | ||
* | ||
* @example | ||
* export interface A1 { s: string;} | ||
* export declare type A2 = ITSOverwrite<A1, { s: number; }>; | ||
* export declare let a2: A2; | ||
*/ | ||
export declare type ITSOverwrite<T, U> = Pick<T, ITSDiff<keyof T, keyof U>> & U; | ||
/** | ||
* copy current function with Parameters and return to new value | ||
* | ||
* not support overload | ||
* | ||
* @example | ||
* declare function f(a: number): number | ||
* declare let c: ITSOverwriteReturnType<typeof f, string>; | ||
* // c = (a: number) => string | ||
*/ | ||
export declare type ITSOverwriteReturnType<T extends (...args: any[]) => any, R extends unknown> = (...args: Parameters<T>) => R; | ||
export declare type ITSWrapFunctionPromiseLike<T extends (...args: any[]) => any> = (...args: Parameters<T>) => PromiseLike<ITSUnpackedReturnType<T>>; | ||
export declare type ITSWrapFunctionPromise<T extends (...args: any[]) => any> = (...args: Parameters<T>) => Promise<ITSUnpackedReturnType<T>>; | ||
export declare type ITSWrapFunctionBluebird<T extends (...args: any[]) => any> = (...args: Parameters<T>) => Bluebird<ITSUnpackedReturnType<T>>; | ||
export declare type ITSUnpackedReturnType<T extends (...args: any[]) => any> = T extends (...args: any[]) => infer R ? ITSUnpacked<R> : unknown; | ||
/** | ||
* @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html | ||
*/ | ||
export declare type ITSUnpacked<T> = T extends (infer U)[] ? U : T extends (...args: any[]) => infer U ? U : T extends ITSResolvable<infer U> ? U : T; | ||
export declare type ITSUnpacked<T> = T extends ITSMapLike<any, infer U> ? U : T extends (infer U)[] ? U : T extends ArrayLike<infer U> ? U : T extends Iterator<infer U> ? U : T extends IteratorResult<infer U> ? U : T extends ITSTypeFunction<infer U> ? U : T extends ITSResolvable<infer U> ? U : T; | ||
/** | ||
* for Iterator IteratorResult | ||
*/ | ||
export declare type ITSUnpackedIteratorLike<T> = T extends Iterator<infer U> ? U : T extends IteratorResult<infer U> ? U : T; | ||
export declare type ITSUnpackedIteratorLike<T extends Iterator<any> | IteratorResult<any>> = T extends Iterator<infer U> ? ITSUnpacked<U> : T extends IteratorResult<infer U> ? ITSUnpacked<U> : T; | ||
export declare type ITSUnpackedArrayLike<T extends ArrayLike<any> | any[]> = T extends (infer U)[] ? ITSUnpacked<U> : T extends ArrayLike<infer U> ? ITSUnpacked<U> : T; | ||
/** | ||
* @see bluebird | ||
*/ | ||
export declare type ITSResolvable<R> = R | PromiseLike<R>; | ||
/** | ||
* Same property names, but make the value a promise instead of a concrete one | ||
@@ -67,3 +33,3 @@ * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html | ||
}; | ||
export declare type ITSAnyFunction = (...args: any[]) => any; | ||
export declare type ITSAnyFunction = ITSTypeFunction<any>; | ||
export declare type ITSOverwriteThisFunction<T extends any, F extends (...args: any[]) => any> = (this: T, ...args: Parameters<F>) => ReturnType<F>; | ||
@@ -77,11 +43,9 @@ export declare type ITSUnpackedThisFunction<T extends (...args: any[]) => any> = T extends (this: infer R, ...args: any[]) => any ? R : unknown; | ||
export declare type ITSPickValueOf<T, K extends keyof T> = ITSValueOf<Pick<T, K>>; | ||
/** | ||
* @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html | ||
*/ | ||
export declare type ITSReadonlyPartial<T> = { | ||
readonly [P in keyof T]?: T[P]; | ||
}; | ||
import * as TSType from './index'; | ||
export declare type ITSType = typeof TSType; | ||
export { ITSType }; | ||
export { ITSTypeBuildIn }; | ||
export default ITSType; | ||
export declare type ITSValueOfIterator<T extends ITSIteratorLazy<any>> = (T extends Iterator<infer U> ? U : T extends IteratorResult<infer U> ? U : any)[]; | ||
export declare type ITSValueOfMap<T extends ITSMapLike<any, any>> = T extends ITSMapLike<any, infer U> ? U[] : any[]; | ||
export declare type ITSIteratorLazy<T extends Iterator<any> | IteratorResult<any>> = T extends IteratorResult<infer U> ? IteratorResult<U> : T extends Iterator<infer U> ? Iterator<U> : T; | ||
export declare type ITSTypeOfArrayLike<T extends any[]> = T extends (infer U)[] ? U : T extends ArrayLike<infer U> ? U : any; | ||
export declare type ITSTypeOfIterator<T extends ITSIteratorLazy<any>> = T extends Iterator<infer U> ? U : T extends IteratorResult<infer U> ? U : any; |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ITSType = require("./index"); | ||
exports.ITSType = ITSType; | ||
exports.default = ITSType; |
{ | ||
"name": "ts-type", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "add some typescript type and re-export some build-in typescript type", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
9457
10
128