0.0.2 • Published 6 years ago

funny-types-custom-options v0.0.2

Weekly downloads
6
License
-
Repository
-
Last release
6 years ago

Custom types validations

Only types for create your custom dropdown, select box, tooltip or etc. How it works:

import {DropdownOptionsMapKeys, Option} from 'funny-types/custom-options'

type Map = {valueKey: 'value', labelKey: 'label'}

const data = [{value: '1', label: '2', test: 4}]
const options: Array<Option<Map, string>> = data

So, DropdownOptionsMapKeys - it is interface for your custom component, it has two properties: options - it's options:) and optionsMapKeys - it`s map for detect your custom keys for value and label. options - use type Option for validate your data, for example if your change data to

const data = [{value: '1', label: '2', test: 4}, {test: 4}]
const options: Array<Option<Map, string>> = data

you will get error by typescript

0.0.2

6 years ago

0.0.1

6 years ago