ts опиши тип { "status": "success", "data": [ { "id": 131, "name": "Посылка" }, { "id":…
- User
ts опиши тип { "status": "success", "data": [ { "id": 131, "name": "Посылка" }, { "id": 141, "name": "Бандероль" }, { "id": 151, "name": "Мелкий пакет" }, { "id": 161, "name": "Денежный перевод" }, { "id": 171, "name": "Документ" } ], "meta": { "current_page": 1, "last_page": 1, "per_page": 50, "total": 5, "has_more_pages": false, "from": 1, "to": 5 } }
Assistant
TypeScript Type Definition
Based on the provided JSON, here's the TypeScript type definition:
interface Response { status: "success"; data: DataItem[]; meta: Meta; } interface DataItem { id: number; name: string; } interface Meta { current_page: number; last_page: number; per_page: number; total: number; has_more_pages: boolean; from: number; to: number; }You could also use type aliases instead of interfaces if preferred:
type Response = { status: "success"; data: DataItem[]; meta: Meta; } type DataItem = { id: number; name: string; } type Meta = { current_page: number; last_page: number; per_page: number; total: number; has_more_pages: boolean; from: number; to: number; }This type definition completely captures the structure of your JSON object, including the specific string literal "success" for the status field.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.