Created
December 14, 2021 14:12
-
-
Save ruheni/9df3cca7c0f73f7f4c9002cf8657a38c to your computer and use it in GitHub Desktop.
Using JsDoc to annotate types to your JavaScript Code when working with Prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const prisma = require('@prisma/client') | |
/** | |
* | |
* @typedef { import("@prisma/client").PrismaClient } PrismaClient | |
* @typedef {{prisma: PrismaClient}} Context | |
*/ | |
/** | |
* | |
* @param {*} req | |
* @param {*} res | |
* @returns {Promise<Context>} context | |
*/ | |
export async function createContext(req, res) { | |
return { | |
prisma | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment