Typescript
Filter undefined & properly type the output
export const isDefined = <T>(argument: T | undefined): argument is T =>
argument !== undefined
const definedArray = withUndefined.filter(isDefined)
Otherwise TS doesn't infer that the result is defined.
Remove unused exports
External library
ts-prune
or knip