[SOLVED] Can you change from `type` to `interface`?


I have types/interfaces that describe my API:

export type AddFileRequestApi = FormData

export interface AddMessageRequestApi {
  text: string;
  date: string;

Can I change export type AddFileRequestApi = FormData to use interface? E.g. something like this:

export interface AddFileRequestApi extends FormData



Yes, just add an empty body at the end ({}), since the body part of an interface isn’t optional; example (more here). But why? And why have a type that’s just an alias for FormData? –
T.J. Crowder
23 mins ago

Answered By – Alan Kałuża

Answer Checked By – Gilberto Lyons (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *