Closed winner106 closed 2 years ago
Hi @winner106, I tried reproducing it but it works fine for me — I don't see a TypeScript error and the types are correct:
Is it only in VS Code or do you see it in terminal logs as well? If it's the former, you can try restarting the TS Server in VS Code. Otherwise, if that's still a problem could you provide a repo with reproduction?
I am also having this issue. I was able to get past this by editing my tsconfig.json file
I set this to false "strictNullChecks": false,
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"baseUrl": "src",
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"strictNullChecks": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"noUncheckedIndexedAccess": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"tsBuildInfoFile": ".tsbuildinfo"
},
"exclude": ["node_modules", "**/*.e2e.ts", "cypress"],
"include": ["blitz-env.d.ts", "**/*.ts", "**/*.tsx", "types"],
}
What is the problem?
Type Error in
app\admin\products\mutations\createProduct.ts
, I modified theCreateProduct
, but the paramdata
Type ErrorPaste all your error logs here:
What are detailed steps to reproduce this?
1.modified then
\db\schema.prisma
, add model Product as follows:blitz prisma db push
blitz generate crud product
CreateProduct.ts
, as follows:const CreateProduct = z.object({ name: z.string(), secretKey: z.string(), description: z.string().optional(), status: z.boolean().optional(), })
export default resolver.pipe(resolver.zod(CreateProduct), resolver.authorize(), async (input) => { // TODO: in multi-tenant app, you must add validation to ensure correct tenant const product = await db.product.create({ data: input })
return product })
Please include below any other applicable logs and screenshots that show your problem:
\db\schema.prisma
app\admin\products\mutations\createProduct.ts
node_modules\.prisma\client\index.d.ts