2023-04-01から1ヶ月間の記事一覧
jest // src/utils/fetchData.ts import axios, { AxiosResponse } from 'axios'; // fetchData関数の引数であるurlの型を定義 type Url = string; // fetchData関数の戻り値の型を定義 interface Data { id: number; title: string; } // fetchData関数の定…
import { FastifyRequest } from 'fastify'; // 'value'が'string'型かどうかをチェックする型ガード関数を定義する function isUserIdString(value: unknown): value is string { return typeof value === 'string'; } // FastifyRequest型の引数を受け取り…
tsで型が気になる時など。