I have an interface with 2 fields: featureName
, which is a string, and another request
, which is an object {}
.
export interface SocketsRequest {
featureName: string;
request: {};
}
Because I want that request
field to have a required field actionType
, I updated the interface and it became:
export interface SocketsRequest {
featureName: string;
request: {actionType: string}; // how I can let many other fields here?
}
But now, the problem is that request
object must have only one field: actionType
. Else, I'll get an error for incompatible types:
const request: SocketsRequest = {
featureName: 'orders',
request: {
actionType: 'all',
country: 'DE' // country can not be a part of request object
}
}
How can be this solved? thx