Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
Jest typescript - The 'AsymmetricMatcher' is not assignable to type string

I am new to jest and testing with typescript. I am having the above error in one of my test files. I searched a lot but couldn't find either the reason or the problem. I have other test files with the same value object id:expect.any(String) but they have no error.

Here are the sample files:

branchDetail.ts

    export interface BranchDetailsModel {
        id: string;
        brandId: string;
        name?: string;
        address?: string;
        employeeName?: string;
        position?: string;
        mobileNumber?: string;
    }

brand.spec.ts

...
const testBranchDetail: BranchDetailsModel = {
    id: expect.any(String), //Type 'AsymmetricMatcher' is not assignable to type 'string'.
    brandId: '',
    address: 'address',
    employeeName: 'sample',
    mobileNumber: 'sample',
    position: 'sample',
};
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda