Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Enum types are not being generated by the Typescript Generator

オープン
#366 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php, typescript
領域
tooling

調査の方向性

ドキュメントに記載されている npm init @api-platform/client コマンドを、TypeScript ジェネレーターと、示されている Gender enum を持つ Person のようなエンティティで実行するところから始めます。生成された Person interface を調べ、gender プロパティがどのように any になるかを追跡します。生成された出力が enum の値を表し、interface で any の代わりにその enum を使用していれば完了です。

索引モデルが issue の本文から書いたものです。

説明

API Platform version(s) affected: 3.0

Description
I'm using the Typescript Generator to generate some interfaces and I have some enum types in the Entity, for example:

<?php
//Enum
namespace App\Enum;

enum Gender: string
{
    case FEMALE = 'female';
    case MALE = 'male';
}
<?php
// Entity
class Person
{
    ...
    #[ORM\Column(type: "string", length: 6, nullable: true, enumType: Gender::class)]
    private $gender;
    ...

but when I generate the interfaces, they are generated as type any.

How to reproduce
Create an entity with an enum type. Use the Typescript generator to generate the corresponding interface:

npm init @api-platform/client http://localhost/api src/ -- --generator typescript

The interface generated will be of type any instead of having the proper enum type:

export interface Person {
 ...
 gender?: any;
 ...
}

Possible Solution

The generator should generate the corresponding enum and implement it in the interface:

export interface Person {
 ...
 gender?: gender;
 ...
}

export enum gender {
    FEMALE = 'female',
    MALE = 'male',
}

Additional Context

主要言語
TypeScript
スター
376
フォーク
132
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

api-platform/create-client のほかの issue

api-platform/create-client の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。