kutt icon indicating copy to clipboard operation
kutt copied to clipboard

Manual setup error: TS2698: Spread types may only be created from object types

Open fosple opened this issue 3 years ago • 1 comments

When I'm trying to run the manual setup server (https://github.com/thedevs-network/kutt#manual) I get the following error: "TS2698: Spread types may only be created from object types."

Full log:

npm run dev

> [email protected] dev
> npm run migrate && cross-env NODE_ENV=development nodemon server/server.ts


> [email protected] migrate
> knex migrate:latest --env production

Requiring external module ts-node/register
Using environment: production
Already up to date
[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): server/**/*.ts
[nodemon] watching extensions: ts,json
[nodemon] starting `rimraf production-server && tsc --project tsconfig.json && copyfiles -f "server/mail/*.html" production-server/mail && node production-server/server.js server/server.ts`
server/queues/queues.ts:9:3 - error TS2698: Spread types may only be created from object types.

9   ...(env.REDIS_PASSWORD && { password: env.REDIS_PASSWORD })
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

server/redis.ts:9:3 - error TS2698: Spread types may only be created from object types.

9   ...(env.REDIS_PASSWORD && { password: env.REDIS_PASSWORD })
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 2 errors.

[nodemon] app crashed - waiting for file changes before starting...

NPM & Node versions

npm -v
8.6.0
node -v
v16.14.2

fosple avatar Apr 01 '22 18:04 fosple

Fixed it by changing server/queues.ts and server/redis.ts

from ...(env.REDIS_PASSWORD && { password: env.REDIS_PASSWORD }) to ...(env.REDIS_PASSWORD as {} && { password: env.REDIS_PASSWORD })

fosple avatar Apr 01 '22 18:04 fosple