@bemedev/typings
v0.0.2
Published
Typings by variables
Readme
@bemedev/typings
Typings by variables
Usage
import { transform } from '@bemedev/typings';
const result = transform(({ array, maybe, intersection }) => ({
nodes: maybe(
array(
intersection(
{
position: {
x: 'number',
y: 'number',
},
data: {
label: maybe('string'),
content: 'string',
},
input: 'boolean',
},
{ id: 'string' },
),
),
),
}));
expectTypeOf(result).toEqualTypeOf<{
nodes?: Array<{
position: { x: number; y: number };
data: { label?: string; content: string };
input: boolean;
id: string;
}>;
}>();Available Helpers
any: Any typearray: Array of typescustom: Custom typeintersection: Intersection of typeslitterals: Literal typesmaybe: Optional typespartial: Partial typesrecord: Record typessoa: Single or Array typessv: State Valuetuple: Tuple typesunion: Union types
Licence
MIT
CHANGE_LOG
Auteur
chlbri ([email protected])
