soul
soul
TTCTheo's Typesafe Cult
Created by soul on 8/29/2023 in #questions
Custom type on express Request doesn't work on execution
I'm trying to set a user type on my req in my express server these are what i tried: req.user = user; req.user = user as User; (req as User).user = user; and for the types file:
import { User } from '@prisma/client';

declare global {
namespace Express {
export interface Request {
user?: User;
}
}
}
import { User } from '@prisma/client';

declare global {
namespace Express {
export interface Request {
user?: User;
}
}
}
i tried putting the above in /global.d.ts in /src/types/express.d.ts and /src/typings/express/index.d.ts my editor doesn't error at all - works in all of these solutions but while running yarn dev it errors
src/clients/web/router.ts:66:8 - error TS2339: Property 'user' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
src/clients/web/router.ts:66:8 - error TS2339: Property 'user' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
this is my tsconfig if that's of any use:
{
"compileOnSave": false,
"compilerOptions": {
"target": "es2022",
"lib": ["es2022", "esnext.asynciterable"],
"typeRoots": ["node_modules/@types"],
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"module": "commonjs",
"pretty": true,
"sourceMap": true,
"declaration": true,
"outDir": "dist",
"allowJs": true,
"noEmit": false,
"esModuleInterop": true,
"resolveJsonModule": true,
"importHelpers": true,
"baseUrl": "src",
"paths": {
"@/*": ["*"],
"@config": ["config"],
"@controllers/*": ["controllers/*"],
"@types/*": ["types/*"],
"@middlewares/*": ["middlewares/*"],
"@routes/*": ["routes/*"],
"@utils/*": ["utils/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.json", ".env", "global.d.ts"],
"exclude": ["node_modules", "src/http", "src/logs", "src/tests"]
}
{
"compileOnSave": false,
"compilerOptions": {
"target": "es2022",
"lib": ["es2022", "esnext.asynciterable"],
"typeRoots": ["node_modules/@types"],
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"module": "commonjs",
"pretty": true,
"sourceMap": true,
"declaration": true,
"outDir": "dist",
"allowJs": true,
"noEmit": false,
"esModuleInterop": true,
"resolveJsonModule": true,
"importHelpers": true,
"baseUrl": "src",
"paths": {
"@/*": ["*"],
"@config": ["config"],
"@controllers/*": ["controllers/*"],
"@types/*": ["types/*"],
"@middlewares/*": ["middlewares/*"],
"@routes/*": ["routes/*"],
"@utils/*": ["utils/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.json", ".env", "global.d.ts"],
"exclude": ["node_modules", "src/http", "src/logs", "src/tests"]
}
11 replies
TTCTheo's Typesafe Cult
Created by soul on 3/22/2023 in #questions
Airtable OAUTH using NextAuth
4 replies
TTCTheo's Typesafe Cult
Created by soul on 1/8/2023 in #questions
create video on nodejs
i have 2 buffers - 1 audio file and 1 image file i want to join both of those into a video, extend the image until the audio ends i tried using ffmpeg, but then it can't take 2 input streams and there was another lib fluent-ffmpeg-multistream which also didnt work what's the best way i can make this video using the 2 buffers
1 replies