jonluca / vite-typescript-ssr-react

🚀 A Vite Typescript SSR React boilerplate!
https://blog.jonlu.ca/posts/vite
342 stars 48 forks source link

Could not find a declaration file for module 'serve-static'. #23

Closed theronic closed 1 year ago

theronic commented 1 year ago

> vite-typescript-ssr-react@1.0.1 build /Users/petrus/Code/my-project
> rimraf dist && tsc -p tsconfig.prod.json && yarn build:client && yarn build:server && yarn copy-files

server.ts:6:25 - error TS7016: Could not find a declaration file for module 'serve-static'. '/Users/petrus/Code/olarm/olarm-directory/node_modules/.pnpm/serve-static@1.15.0/node_modules/serve-static/index.js' implicitly has an 'any' type.
  If the 'serve-static' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serve-static'

6 import serveStatic from "serve-static";
                          ~~~~~~~~~~~~~~

src/__tests__/demo.test.tsx:12:31 - error TS2339: Property 'toBeInTheDocument' does not exist on type 'Assertion<HTMLElement>'.

12     expect(getByText("Repo")).toBeInTheDocument();
                                 ~~~~~~~~~~~~~~~~~

Found 2 errors in 2 files.

Errors  Files
     1  server.ts:6
     1  src/__tests__/demo.test.tsx:12
 ELIFECYCLE  Command failed with exit code 2.
jonluca commented 1 year ago

make sure that when you run yarn install your NODE_ENV isn't production - it doesn't install dev dependencies in that case.