Skip to content

[Feature Proposal] Migrate dict return types to TypedDict #103

@Apricot-S

Description

@Apricot-S

Summary

Several functions currently return plain dict objects.
Migrating these return types to TypedDict will improve type safety, clarify return structures, and enhance the overall developer experience.

Motivation

Returning untyped dictionaries makes it difficult for static analysis tools and IDEs to guarantee key existence or value types.
Introducing TypedDict provides explicit structure and improves maintainability.

Pros

  • Smaller impact on existing code compared to migrating to dataclass
  • Clearer and more explicit return value structures
  • Improved type safety and better IDE auto‑completion
  • Enhanced static analysis accuracy (e.g., mypy)

Cons

  • TypedDict is not a subclass of dict, so some existing code may raise type errors
  • This migration introduces breaking changes

Target Functions

  • ScoresCalculator.calculate_scores()
  • Aotenjou.calculate_scores()
  • FuCalculator.calculate_fu()
  • count_tiles_by_suits()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions