'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
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alan Ka?u?a |
