mapeo-schema
Version:
JSON schema and flow types for Mapeo
41 lines (37 loc) • 1.48 kB
Flow
/**
* @flow
* These are manual tests for stricter manually written types, to ensure that
* the example JSON objects also pass the stricter types in ../../types
*/
import type { SelectOneField, SelectMultipleField, TextField, NumberField } from '../../types'
import { field_number, field_select_one, field_select_one_labels, field_text, field_select_multiple } from './generated.js.flow'
const numberField: NumberField = {...field_number}
const selectOneField: SelectOneField = {...field_select_one}
const selectOneFieldLabels: SelectOneField = {...field_select_one_labels}
const selectMultipleField: SelectMultipleField = {...field_select_multiple}
const textField: TextField = {...field_text}
// Just check this does actually throw an error
// $FlowExpectedError
;({...field_number}: TextField)
// $FlowExpectedError
;({...field_number}: SelectOneField)
// $FlowExpectedError
;({...field_number}: SelectMultipleField)
// $FlowExpectedError
;({...field_text}: NumberField)
// $FlowExpectedError
;({...field_text}: SelectOneField)
// $FlowExpectedError
;({...field_text}: SelectMultipleField)
// $FlowExpectedError
;({...field_select_one}: NumberField)
// $FlowExpectedError
;({...field_select_one}: TextField)
// $FlowExpectedError
;({...field_select_one}: SelectMultipleField)
// $FlowExpectedError
;({...field_select_multiple}: NumberField)
// $FlowExpectedError
;({...field_select_multiple}: TextField)
// $FlowExpectedError
;({...field_select_multiple}: SelectOneField)