T

tRPC

โ“-help

Join Server

Cannot find module '@trpc/react-query/server' or its corresponding type declarations

IIndustrial4/24/2023
import { createServerSideHelpers } from '@trpc/react-query/server'


This should work, right?
Nnlucas4/24/2023
Where did you get that from? Should be @trpc/server
Nnlucas4/24/2023
Ah maybe I'm getting mixed up then ๐Ÿ˜„
Nnlucas4/24/2023
What's in your package.json?
IIndustrial4/24/2023
actually, it's described here: https://trpc.io/docs/nextjs/ssg
IIndustrial4/24/2023
{
  "private": true,
  "name": "@code9/todo-web",
  "version": "0.1.0",
  "description": "",
  "main": "index.js",
  "keywords": [],
  "author": "",
  "license": "ISC",
  "scripts": {
    "build": "next build",
    "dev": "next dev",
    "lint": "pnpm lint:tsc && pnpm lint:eslint",
    "lint:eslint": "eslint --fix --cache .",
    "lint:tsc": "tsc -p . --noEmit",
    "pre-commit": "lint-staged",
    "start": "next start"
  },
  "lint-staged": {
    "*.{js,mjs,cjs,jsx,ts,tsx,json}": "pnpm lint"
  },
  "dependencies": {
    "@emotion/cache": "^11.10.5",
    "@emotion/css": "^11.10.6",
    "@emotion/react": "^11.10.6",
    "@emotion/server": "^11.10.0",
    "@emotion/styled": "^11.10.6",
    "@fontsource/roboto": "^4.5.8",
    "@mui/icons-material": "^5.11.16",
    "@mui/material": "^5.11.16",
    "@tanstack/react-query": "^4.18.0",
    "@trpc/client": "^10.18.0",
    "@trpc/next": "^10.18.0",
    "@trpc/react-query": "^10.18.0",
    "@trpc/server": "^10.18.0",
    "clsx": "^1.1.1",
    "next": "^13.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-query": "^3.39.3",
    "superjson": "^1.7.4",
    "zod": "^3.0.0"
  },
  "devDependencies": {
    "@types/react": "^18.0.33",
    "@types/react-dom": "^18.0.11",
    "lint-staged": "^13.2.1",
    "tsx": "^3.12.3",
    "typescript": "^4.8.3"
  }
}
Nnlucas4/24/2023
You might need to update your tRPC version
Nnlucas4/24/2023
Obviously package.json isn't necessarily the version you have pinned, but here's 10.18:

https://github.com/trpc/trpc/blob/8ec386ff118020356d39c8796b7bb68666abfe4c/packages/react-query/package.json
Nnlucas4/24/2023
server was added recently ๐Ÿ™‚
IIndustrial4/24/2023
Updated the packages and now it works. Thanks!