@@ -14,8 +14,6 @@ import { clientTypeGeneration, serverTypeGeneration } from './utils/type-generat
1414
1515export type * from './types'
1616
17- export type GraphQLFramework = 'graphql-yoga'
18-
1917export default defineNitroModule ( {
2018 name : 'nitro-graphql' ,
2119 async setup ( nitro : Nitro ) {
@@ -229,16 +227,6 @@ export default defineNitroModule({
229227 }
230228 } )
231229
232- const graphqlDtsContent = `// Auto-generated by nitro-graphql
233-
234- import type { SchemaType } from './nitro-graphql-server.d.ts'
235-
236- declare module 'nitro-graphql' {
237- type GraphQLFramework = '${ nitro . options . graphql ?. framework || 'graphql-yoga' } '
238- }
239- `
240-
241- writeFileSync ( join ( typesDir , 'graphql.d.ts' ) , graphqlDtsContent )
242230 nitro . options . typescript . strict = true
243231
244232 nitro . hooks . hook ( 'types:extend' , ( types ) => {
@@ -316,13 +304,15 @@ export default defineGraphQLConfig({
316304
317305 if ( ! existsSync ( join ( nitro . graphql . serverDir , 'context.d.ts' ) ) ) {
318306 writeFileSync ( join ( nitro . graphql . serverDir , 'context.d.ts' ) , `// Example context definition please change it to your needs
319- // import type { Database } from '../utils/useDb'
307+ import type { H3EventContext as OriginalH3EventContext } from 'h3'
308+
309+ export interface ExtendedH3EventContext extends OriginalH3EventContext {
310+ // useDatabase: () => Database
311+ // tables: typeof import('~~/server/drizzle/schema/index')
312+ }
320313
321314declare module 'h3' {
322- interface H3EventContext {
323- // useDatabase: () => Database
324- // tables: typeof import('~~/server/drizzle/schema/index')
325- }
315+ interface H3EventContext extends ExtendedH3EventContext {}
326316}` , 'utf-8' )
327317 }
328318 } ,
0 commit comments