Using Zodios in a Monorepo #212
Replies: 4 comments 3 replies
-
the setup repository seems wrong : {
"name": "expresspkg",
"version": "0.0.0",
"description": "",
"main": "index.ts",
"module": "dist/index.mjs",
"scripts": {
"dev": "tsm index.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/express": "^4.17.14",
"@types/node": "^18.11.7",
"eslint-config-custom": "workspace:*",
"tsconfig": "workspace:*",
"tsm": "^2.2.2",
"typescript": "^4.7.4"
},
"dependencies": {
"@zodios/core": "^10.4.3",
"@zodios/express": "^10.4.0",
"@zodios/openapi": "^10.4.2",
"axios": "^1.1.3",
"express": "^4.18.2",
"zod": "^3.19.1"
}
} tsconfig is not setup in packages |
Beta Was this translation helpful? Give feedback.
-
@ecyrbe I think my problem doesn't have anything to do with monorepos at all, so I removed it from the example. In the updated example, you can see that with the empty tsconfig (which should just load defaults), |
Beta Was this translation helpful? Give feedback.
-
@epotter2297 so with here the web project package dependendencies: {
"name": "web",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@tanstack/react-query": "^4.13.0",
"@zodios/core": "^10.4.3",
"@zodios/express": "^10.4.2",
"@zodios/react": "^10.3.3",
"axios": "^1.1.3",
"express": "^4.18.2",
"next": "12.3.2-canary.40",
"react": "18.2.0",
"react-dom": "18.2.0",
"ui": "workspace:0.0.0",
"zod": "^3.19.1"
},
"devDependencies": {
"@babel/core": "^7.19.6",
"@types/express": "^4.17.14",
"@types/node": "^17.0.45",
"@types/react": "^18.0.24",
"@types/react-dom": "^18.0.8",
"eslint": "7.32.0",
"eslint-config-custom": "workspace:0.0.0",
"tsconfig": "workspace:0.0.0",
"typescript": "^4.8.4"
}
} |
Beta Was this translation helpful? Give feedback.
-
@epotter2297 fully working example here: https://github.com/ecyrbe/zodios-express/tree/main/examples/next-turbo |
Beta Was this translation helpful? Give feedback.
-
I'm having some difficulties getting zodios to work in a monorepo correctly, so I set up a simple example here based on the turborepo starter project to demonstrate the problem. When I look at the router, I see that the type is
_zodios_core_lib_utils_types.IfEquals<Api, any, Omit<Router, "use"> & ZodiosUse<Context> & ContextRequestHandler<Context>, Omit<Router, any> & ZodiosHandlers<...> & ContextRequestHandler<...>>
I'm not 100% sure if this is a bug, or something configured incorrectly in my tsconfig, so I wanted to check here before making an issue for it.
Beta Was this translation helpful? Give feedback.
All reactions