# compactArray · FT4 TypeScript client · Chromia Docs (concept)

> compactArray< T >(elements: ( T | null | undefined)[]): T [] Accepts an array which might be a mix of values and null/undefined and returns
the same array 

Source: https://docs.chromia.com/pages/ft4-ts-client/functions/utils.compactArray/

Function

# compactArray

* ```signature
  compactArray<T>(elements: (T | null | undefined)[]): T[]
  ```

  Accepts an array which might be a mix of values and null/undefined and returns
  the same array without said null/undefined values.

  #### Type Parameters

  + T

  #### Parameters

  + elements: ([T](#compactarrayt) | null | undefined)[]

    the array to compact

  #### Returns [T](#compactarrayt)[]

[View this page on docs.chromia.com](https://docs.chromia.com/pages/ft4-ts-client/functions/utils.compactArray.html)Generated API reference, mirrored from the live docs
