Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

60
Views
object with only a required field

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!