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

123
Views
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
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!