Skip to content

Instantly share code, notes, and snippets.

@vieiralucas
Created January 16, 2019 17:36
Show Gist options
  • Select an option

  • Save vieiralucas/0ec735807c61aae688d32add7e4befd2 to your computer and use it in GitHub Desktop.

Select an option

Save vieiralucas/0ec735807c61aae688d32add7e4befd2 to your computer and use it in GitHub Desktop.
interface ILocation {
cc: string
admin1: string
admin2: string
}
const location: Option<Partial<ILocation>> = some({cc: 'BR', admin1: 'SC'})
const first = 100
const offset = 10
const params = [
first,
offset,
...location
.map(l => [l.cc, l.admin1, l.admin2].filter(v => v !== undefined)
.getOrElse([]),
]
// o tipo de params eh (number | string | undefined)[]
// pra mim deveria ser (number | string)[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment