I am working on validating API responses using io-ts.
I have already defined the following type in regular TypeScript:
export type Group = {
id: number;
name: string;
}
And I want to use this type in io-ts like this:
const UploadedSearch = t.type({
id: t.number,
title: t.string,
groups: t.array(Group),
});
But I get the following error.
TS2693: 'Group' only refers to a type, but is being used as a value here.
Is there any way to use Group
in the io-ts code?