Skip to content

Commit

Permalink
feat(types): add NonEmptyArray type and checkNonEmptyArray function (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ertugrulcan-ays authored Jan 3, 2025
2 parents 764ac2d + 9282cd8 commit 827ed21
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/web/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type NonEmptyArray<T> = [T, ...T[]];
export function checkNonEmptyArray<T>(arr: T[]): arr is NonEmptyArray<T> {
return arr.length > 0;
}

0 comments on commit 827ed21

Please sign in to comment.