-
Notifications
You must be signed in to change notification settings - Fork 8
Description
What happened?
When generating TypeScript interfaces from Laravel models using typescriptable-laravel, the resulting interface name includes a backslash () from the PHP namespace. For example, the model App\Models\Product\CloudPackage gets converted to the following TypeScript interface:
export interface Product\CloudPackage {
id: number
name: string
description?: string
price: number
cpu: number
ram: number
disk: number
backups: number
rds_users: number
ras_users: number
created_at?: string
updated_at?: string
deleted_at?: string
}However, this is invalid TypeScript syntax. The backslash is not allowed in interface names and causes a syntax error.
How to reproduce the bug
Create a Laravel model in a sub-namespace, for example:
App\Models\Product\CloudPackage.
Run the typescriptable:generate command to generate TypeScript interfaces.
Check the output .d.ts file — the resulting interface name includes the namespace backslash (Product\CloudPackage) instead of a valid TypeScript name (e.g. ProductCloudPackage or CloudPackage).
Package Version
3.1
PHP Version
8.2.4
Which operating systems does with happen with?
Windows
Notes
No response