Skip to content

Instantly share code, notes, and snippets.

@ruheni
Created December 14, 2021 14:12
Show Gist options
  • Save ruheni/9df3cca7c0f73f7f4c9002cf8657a38c to your computer and use it in GitHub Desktop.
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
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