Typescript Import does "not import types"

2 weeks ago 14
ARTICLE AD BOX

tsconfig.json

{ "compilerOptions": { "target": "ESNext", "module": "NodeNext", "moduleResolution": "NodeNext", "lib": [ "esnext", "dom" ], "declaration": true, "declarationMap": true, "sourceMap": true, "strict": true, "esModuleInterop": true, "skipLibCheck": true, "baseUrl": ".", "paths": { "@/bms/frontend/*": [ "./apps/web/src/*" ], "@/bms/backend/*": [ "./apps/api/src/*" ], "@/bms/shared/*": [ "./packages/shared/*" ], "@/bms/database": [ "./packages/database/src/index.ts" ] } }, "references": [ { "path": "./apps/api" }, { "path": "./packages/database" }, { "path": "./packages/shared" } ], "include": [ "apps/**/*", "packages/**/*" ] }

packages/database/src/index.ts

export { PrismaPg } from '@prisma/adapter-pg'; export * from '@prisma/adapter-pg';

packages/database/tsconfig.json

{ "extends": "../../tsconfig.json", "compilerOptions": { "target": "ESNext", "module": "NodeNext", "moduleResolution": "NodeNext", "composite": true, "declaration": true, "declarationMap": true, "sourceMap": true, "outDir": "./dist", "rootDir": "./", "baseUrl": "./", "incremental": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noImplicitAny": false, "noFallthroughCasesInSwitch": false, "paths": { "@/bms/prisma/*": [ "./src/generated/*" ] } }, "include": [ "src/index.ts", "prisma.config.ts", "src/**/*.ts" ] }

apps/api/tsconfig.json

{ "extends": "../../tsconfig.json", "compilerOptions": { "target": "esnext", "module": "NodeNext", "moduleResolution": "NodeNext", "composite": true, "declaration": true, "declarationMap": true, "resolvePackageJsonExports": true, "esModuleInterop": true, "isolatedModules": true, "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "sourceMap": true, "outDir": "./dist", "rootDir": "./src", "baseUrl": "../../", "incremental": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noImplicitAny": false, "noFallthroughCasesInSwitch": false }, "include": [ "src/**/*" ], "references": [ { "path": "../../packages/database" } ] }

apps/api/src/prisma/prisma.service.ts

import { PrismaClient, PrismaPg } from '@/bms/database'; const x = new PrismaPg({}); // Unsafe construction of a(n) `error` type typed value.

the problem is Unsafe construction of a(n) `error` type typed value.
from what i understood is because the typescript linter can't import the types.
I'd like to understand an elegant way to fix this issue

Read Entire Article