zenstackhq / zenstack

Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
https://zenstack.dev
MIT License
2.07k stars 88 forks source link

@zenstackhq/trpc : Module has not default export #1177

Closed jbruxelle closed 6 months ago

jbruxelle commented 6 months ago

Hi !

Issue with @zenstackhq/trpc : ^1.11.1


Module ... has no default export. import $Schema from ...

FYI: Yes, I do have allowSyntheticDefaultImports and esModuleInterop to true in tsconfig !

ymc9 commented 6 months ago

Hi @jbruxelle , do you mind sharing your full tsconfig? Also what's your framework that you're trpc with?

jbruxelle commented 6 months ago

I am using nestjs@10.3.4 and here is my tsconfig :

{
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "./dist",
    "module": "commonjs",
    "moduleResolution": "node",
    "target": "ES6",
    "skipLibCheck": true,
    "declaration": true,
    "emitDeclarationOnly": false,
    "removeComments": true,
    "noUnusedParameters": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "typeRoots": ["node_modules/@types", "types"],
    "paths": {
      "@modules/*": ["./src/modules/*"],
      "@shared/*": ["./src/shared/*"],
      "@gen/*": ["./src/_gen/*"]
    }
  }
}
ymc9 commented 6 months ago

Yes, I think changing it to import * as $Schema will improve compatibility. Will make a fix soon. Also please let me know if you're interested in making a PR. It'll be greatly appreciated! @jbruxelle