Add ArrayElement type helper
This commit is contained in:
parent
2e43b5bda9
commit
fe9170282f
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@extollo/lib",
|
||||
"version": "0.9.48",
|
||||
"version": "0.9.49",
|
||||
"description": "The framework library that lifts up your code.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -80,3 +80,6 @@ export type Integer = TypeTag<'@extollo/lib.Integer'> & number
|
||||
export function isInteger(num: number): num is Integer {
|
||||
return !isNaN(num) && parseInt(String(num), 10) === num
|
||||
}
|
||||
|
||||
export type ArrayElement<ArrayType extends readonly unknown[]> =
|
||||
ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
|
||||
|
Loading…
Reference in New Issue
Block a user