Add ArrayElement type helper
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user