-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import whichBoxedPrimitive from 'which-boxed-primitive'; | ||
import whichCollection from 'which-collection'; | ||
import whichTypedArray from 'which-typed-array'; | ||
|
||
type AsyncFunction<T = unknown> = (...args: unknown[]) => Promise<T>; | ||
|
||
declare function whichBuiltinType<T>(value: Parameters<typeof whichCollection>[0]): ReturnType<typeof whichCollection>; | ||
declare function whichBuiltinType<T>(value: Parameters<typeof whichTypedArray>[0]): ReturnType<typeof whichTypedArray>; | ||
declare function whichBuiltinType<T>(value: ReadonlyArray<T>): 'Array'; | ||
declare function whichBuiltinType<T>(value: Date): 'Date'; | ||
declare function whichBuiltinType<T>(value: RegExp): 'RegExp'; | ||
declare function whichBuiltinType<T>(value: T extends object ? WeakRef<T> : never): 'WeakRef'; | ||
declare function whichBuiltinType<T>(value: FinalizationRegistry<T>): 'FinalizationRegistry'; | ||
declare function whichBuiltinType<T>(value: GeneratorFunction): 'GeneratorFunction'; | ||
declare function whichBuiltinType<T>(value: AsyncFunction<T>): 'AsyncFunction'; | ||
declare function whichBuiltinType<T>(value: Function): 'Function'; | ||
declare function whichBuiltinType<T>(value: Promise<T>): 'Promise'; | ||
|
||
declare function whichBuiltinType<T>(value: T): 'Object' | Exclude<ReturnType<typeof whichBoxedPrimitive>, null | undefined> | string; | ||
|
||
export = whichBuiltinType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "@ljharb/tsconfig", | ||
"compilerOptions": { | ||
"target": "ES2021", | ||
}, | ||
"exclude": [ | ||
"coverage" | ||
] | ||
} |