Last active
December 14, 2018 10:06
-
-
Save ranbena/adb13faad8be30d4f3c0b40bb5959b0c to your computer and use it in GitHub Desktop.
Extending Flow types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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