Comparing version 1.0.6 to 1.0.7
@@ -64,2 +64,4 @@ import { ITSTypeBuildIn } from './build-in'; | ||
export declare type ITSAnyFunction = (...args: any[]) => any; | ||
export declare type ITSOverwriteThisFunction<T extends any, F extends (...args: any[]) => any> = (this: T, ...args: Parameters<F>) => ReturnType<F>; | ||
export declare type ITSUnpackedThisFunction<T extends (...args: any[]) => any> = T extends (this: infer R, ...args: any[]) => any ? R : unknown; | ||
/** | ||
@@ -66,0 +68,0 @@ * https://stackoverflow.com/questions/49285864/is-there-a-valueof-similar-to-keyof-in-typescript |
{ | ||
"name": "ts-type", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "add some typescript type and re-export some build-in typescript type", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -67,2 +67,48 @@ # README | ||
### this | ||
```ts | ||
export declare function t1(this: string, a: number): Promise<number> | ||
export declare let t1_this: ITSUnpackedThisFunction<typeof t1>; | ||
// => t1_this is string | ||
``` | ||
```ts | ||
export declare function t2(this: string, a: number): number | ||
export declare let t3: ITSOverwriteThisFunction<number, typeof t2>; | ||
t3 = function () | ||
{ | ||
this.toFixed() // => this is number | ||
return 1 | ||
} | ||
``` | ||
```ts | ||
interface Function2 extends Function | ||
{ | ||
bind<T extends any, F extends (...args: any[]) => any>(this: F, thisArg: T, ...argArray: any[]): ITSOverwriteThisFunction<T, F>; | ||
} | ||
export interface t4 extends Function2 | ||
{ | ||
(): string | ||
} | ||
export declare let t5: t4 | ||
export let t6 = t5.bind([] as string[]) | ||
t6 = function () | ||
{ | ||
this.includes('') // => this is string[] | ||
return '' | ||
} | ||
``` | ||
## other | ||
@@ -69,0 +115,0 @@ |
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
7618
98
122