Issue
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
Solution
1
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)