Skip to content

Commit

Permalink
fix: revert Nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 12, 2021
1 parent eccda4c commit 9d030b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Arrayable, Nullable } from './types'
/**
* Convert Arrayable<T> to Array<T>
*/
export function toArray<T>(array: Nullable<Arrayable<T>>): Array<T> {
export function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T> {
array = array || []
if (Array.isArray(array))
return array
Expand All @@ -13,7 +13,7 @@ export function toArray<T>(array: Nullable<Arrayable<T>>): Array<T> {
/**
* Convert Arrayable<T> to Array<T>
*/
export function flattenArrayable<T>(array: Nullable<Arrayable<T | Array<T>>>): Array<T> {
export function flattenArrayable<T>(array?: Nullable<Arrayable<T | Array<T>>>): Array<T> {
return toArray(array).flat(1) as Array<T>
}

Expand Down
12 changes: 1 addition & 11 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,10 @@
*/
export type Awaitable<T> = T | PromiseLike<T>

/**
* Null or underfind whatever
*/
export type Nilable<T> = T | null | undefined

/**
* Null or whatever
*/
export type Nullable<T> = T | null

/**
* Undefined or whatever
*/
export type Undefineable<T> = T | undefined
export type Nullable<T> = T | null | undefined

/**
* Array, or not yet
Expand Down

0 comments on commit 9d030b7

Please sign in to comment.