Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

61
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda