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

204
Views
Zod & React: 'Key' only refers to a type, but is being used as a value here

I have the following code set up for a Zod contract, and I'm getting this error message when trying to use Key and ReactElement. I'm not clear on what the solution is in this instance, and other examples of this error message aren't related to a Zod-based error so I'm not sure if they apply. The error I'm getting, I'm getting on both Key and ReactElement.

'Key' only refers to a type, but is being used as a value here

import { z } from "zod";
import { Key, ReactElement } from "react";


export const Foo= z.object({
    key: Key.optional(),
    children: ReactElement.array(),
    catId: z.string().optional(),
    identifier: z.string().optional(),
})

export type FooProps= z.infer<typeof Foo>
about 4 years ago · Santiago Gelvez
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!