Typescript-transformer
Convert PHP types to TypeScript
This package allows you to convert PHP classes to TypeScript.
This class...
class User
{
public int $id;
public string $name;
public ?string $address;
}
... will be converted to this TypeScript type:
export type User = {
id: number;
name: string;
address: string | null;
}
Here's another example.
class Languages extends Enum
{
const TYPESCRIPT = 'typescript';
const PHP = 'php';
}
The Languages
enum will be converted to:
export type Languages = 'typescript' | 'php';