NeatTypeの作り方
こんにちわ。nap5です。
NeatTypeの作り方について紹介したいと思います。
type-festライブラリのSimplifyを使います
デモコードです。
import type { Simplify } from "type-fest";
type Blog = {
id: number;
title: string;
};
type PositionProps = {
top: number;
left: number;
};
type AuthorProps = {
width: number;
height: number;
blogs: Blog[];
};
type CowboyProps = {
cowboy: string;
bebop: string;
};
type NeatType = Simplify<PositionProps & AuthorProps & CowboyProps>;
const a: NeatType = {};
簡単ですが、以上です。