Skip to content

Add TypeScript type definitions for API data models#13

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/create-typescript-types
Draft

Add TypeScript type definitions for API data models#13
Copilot wants to merge 2 commits intomainfrom
copilot/create-typescript-types

Conversation

Copy link

Copilot AI commented Feb 24, 2026

Define TypeScript interfaces mirroring backend API response shapes for compile-time safety across frontend code.

Files Added

  • src/frontend/src/types/god.ts: Alias, God, and GodInput interfaces
  • src/frontend/src/types/mythology.ts: Mythology interface
  • src/frontend/src/types/index.ts: Barrel export for convenient imports

Type Definitions

export interface God {
  id: number;
  name: string;
  description: string;
  mythologyId: number;
  aliases: Alias[];
}

export interface GodInput {
  id?: number;  // Optional to support create (no id) and update (with id) flows
  name: string;
  description: string;
  mythologyId: number;
}

Types importable via import { God, Mythology } from '@/types' or relative paths.

Original prompt

This section details on the original issue you should resolve

<issue_title>Create TypeScript Types</issue_title>
<issue_description># Step 4: Create TypeScript Types

Description

Define TypeScript interfaces that mirror the backend API response shapes. These types provide compile-time safety across all frontend code that handles API data.

Implementation Steps

  1. Create src/frontend/src/types/god.ts:
    export interface Alias {
      id: number;
      godId: number;
      name: string;
    }
    
    export interface God {
      id: number;
      name: string;
      description: string;
      mythologyId: number;
      aliases: Alias[];
    }
    
    export interface GodInput {
      id?: number;
      name: string;
      description: string;
      mythologyId: number;
    }
  2. Create src/frontend/src/types/mythology.ts:
    export interface Mythology {
      id: number;
      name: string;
    }
  3. Optionally create src/frontend/src/types/index.ts that re-exports everything for convenient imports:
    export * from "./god";
    export * from "./mythology";

Files Created

  • src/frontend/src/types/god.ts
  • src/frontend/src/types/mythology.ts
  • src/frontend/src/types/index.ts

Acceptance Criteria

  • All interfaces match the backend API response shapes documented in Swagger.
  • GodInput.id is optional (number | undefined) to support both create (no id) and update (with id) flows.
  • Types are importable from @/types or ../types across the project.
    </issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: aatmmr <15815012+aatmmr@users.noreply.github.com>
Copilot AI changed the title [WIP] Create TypeScript types for backend API responses Add TypeScript type definitions for API data models Feb 24, 2026
Copilot AI requested a review from aatmmr February 24, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create TypeScript Types

2 participants