Skip to content

Instantly share code, notes, and snippets.

@ranbena
Last active December 14, 2018 10:06
Show Gist options
  • Save ranbena/adb13faad8be30d4f3c0b40bb5959b0c to your computer and use it in GitHub Desktop.
Save ranbena/adb13faad8be30d4f3c0b40bb5959b0c to your computer and use it in GitHub Desktop.
Extending Flow types
// extending existing type
type SelectOption = {
value: string,
label: string
}
const option1: SelectOption = {
value: 'value',
label: 'label'
}
type DurationSelectOption = {
...SelectOption,
value: '1m' | '1w' | '1d'
}
const option2: DurationSelectOption = {
value: '1m',
label: 'label'
}
// if it's in flow/dom.js
declare interface Navigator extends Navigator {
mediaDevices: MediaDevicesType;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment