`error TS2300: Duplicate identifier` when referencing the same enum twice in a model
See original GitHub issueWe get a TS error due to duplicated named imports.
This schema:
enum MyEnum {
A
B
}
enum MyOtherEnum {
A
B
}
model MyModel {
id String @id
a MyEnum[]
b MyOtherEnum?
c MyEnum[]
d MyOtherEnum?
}
Generates the following which results in the TS error
import {MyEnum, MyOtherEnum, MyEnum, MyOtherEnum} from '@prisma/client'
% npm ls zod-prisma
@gaia-family/monorepo@0.1.0 /Users/chrispearce/Projects/monorepo
└── zod-prisma@0.5.4
Desired:
Imported identifier should only be written once.
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:6
Top Results From Across the Web
Confusing "duplicate identifier" Typescript error message
When I ran npm start , I got a bunch of duplicate identifier errors. ... Using webpack I came across same error, just...
Read more >Enum-based constants can be used as computed property ...
Enum values are known in compile-time, so it's possible to reject duplicate values. Actual behavior: The Duplicate identifier '80'.ts(2300) ...
Read more >How to fix the "duplicate identifier" error in TypeScript
Duplicate identifier. You are defining, with other words referencing, the same identifier (class, method, property) twice in your code. The ...
Read more >Fix TS2300 Duplicate identifier error in TypeScript with React
Have you updated your "react" and "@types/react" dependencies and now see error TS2300 and TS2717? Let me help you understand and fix these ......
Read more >TypeScript errors and how to fix them
error TS2300 : Duplicate identifier 'name'. Broken Code ❌. Objects don't support multiple properties with the same name: 1
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@CarterGrimmeisen any chance you can release this fix to npm? Looks like https://github.com/CarterGrimmeisen/zod-prisma/commit/f3c27fb2a056763a4e11dbe6371505ebbdf9d69e fixes the issue but the most recent version on npm is from 6 months ago. Appreciate your work on this project, this is awesome!
I made a pull request for this. Had the same issue.
https://github.com/CarterGrimmeisen/zod-prisma/pull/122