@minofrk/msf-io-ts
Version:
Type utilities with io-ts for MSF format.
19 lines (15 loc) • 404 B
text/typescript
import { union, literal, brand, Int, TypeOf, Branded } from 'io-ts';
export interface FalaTypeBrand {
readonly FalaType: unique symbol;
}
export const FalaType = union([
literal(0),
brand(
Int,
(x): x is Branded<Int, FalaTypeBrand> => {
return 0 <= x && x <= 2147483647;
},
'FalaType',
),
]);
export type FalaType = TypeOf<typeof FalaType>;