問題 25 / 28

関数の型定義 - TypeScript

約3分

以下のエラー型定義において、API呼び出しが成功した場合のデータアクセス方法として正しいものは...

上級
関数の型定義
TypeScript

問題

答えを考えてから、正解と解説を確認してください

正解

result.successで判定してからresult.dataにアクセス
typescript icon

関数の型定義 の関連問題

関連問題 1

カスタムエラークラスを作成する際の正しい書き方はどれですか?

関連問題 2

以下のコードの空欄に入る適切な型はどれですか? ```typescript function filterArray(items: number[], condition: ____): number[] { const result = []; for (const item of items) { if (condition(item)) { result.push(item); } } return result; } ```

関連問題 3

以下のコードで、`transformArray`関数に渡すコールバック関数として**適切でない**ものはどれですか? ```typescript function transformArray(arr: string[], transform: (item: string) => string): string[] { return arr.map(transform); } ```