I’d like to define a typescript interface to map answers from a web service to a type (similar to what is shown here). Here is an example answer.
{
"type": "Seen",
"creation": 33,
"fileId": 6
}
Hence the following interface would be suitable.
interface Event {
type: 'Accepted' | 'Judgment' | 'Seen';
creation: number;
fileId: number;
}
Unfortunately, the compiler does not like it: type is a reserved keyword.
How can I use a reserved keyword as a property inside an interface?
I guess it is possible to define the property using another term and then define an alias to it somehow, as suggested here, or use var instead as suggested here, but I can’t find out how to do it in my case.