laravel-typescript
laravel-typescript copied to clipboard
Duplicate identifier for 'field'
If a field is a db relation, and you defined a getAttribute method for it to modify it's result, it gets added to the interface twice.
export interface User {
id: number;
first_name: string;
last_name: string;
email: string;
last_session_id: string | null;
password: string;
remember_token: string | null;
created_at: string | null;
updated_at: string | null;
active: boolean;
roles?: Array<App.Role> | null;
contact?: App.Contact | null;
employee?: App.Employee | null;
api_keys?: Array<App.OauthClient> | null;
hidden_widgets?: Array<App.Widget> | null;
seen_release_notes?: Array<App.ReleaseNote> | null;
roles_count?: number | null;
api_keys_count?: number | null;
hidden_widgets_count?: number | null;
seen_release_notes_count?: number | null;
readonly roles?: any;
readonly nice_name?: any;
readonly agreed_to?: any;
readonly widgets?: any;
readonly tech_roles?: any;
readonly metas?: any;
}
I use getRolesAttribute and now have two roles keys there.
Made a PR with a fix ;)