lepikhinb / laravel-typescript

MIT License
391 stars 46 forks source link

Duplicate identifier for 'field' #27

Open Josje92 opened 1 year ago

Josje92 commented 1 year ago

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.

Josje92 commented 1 year ago

Made a PR with a fix ;)