This file contains hidden or 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
// file: utils.ts | |
import { GraphQLResolveInfo } from 'graphql'; | |
import { Mutation as ApiMutation, Query as ApiQuery } from './generated/api'; | |
import { Prisma } from './generated/prisma'; | |
import * as Types from './types; // you can omit this | |
export type FirstArgument<T> = T extends (arg1: infer U, …args: any[]) => any ? U : any; | |
export type Remapped<T> = { | |
[P in keyof T]: ( | |
parent: null | undefined, | |
args: FirstArgument<T[P]>, |
This file contains hidden or 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
import { Query } from './utils'; | |
export const query: Query = { | |
// hit cmd+space here and hear "who let the dogs out!" | |
} |
This file contains hidden or 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
import * as Types from './types'; | |
export type Resolver<T> = { | |
[U in keyof Partial<typeof Types>]: { | |
[P in keyof Partial<T>]: (parent: T, args: any, ctx: Context, info: GraphQLResolveInfo) => any | |
} | |
}; |
This file contains hidden or 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
export type Resolver<T, U = any> = { | |
[index: string]: { // this is a problem | |
[P in keyof Partial<T>]: (parent: T, args: U, ctx: Context, info: GraphQLResolveInfo) => any | |
} | |
}; |
This file contains hidden or 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
import { GraphQLResolveInfo } from 'graphql'; | |
import { Mutation as ApiMutation, Query as ApiQuery } from './generated/api'; | |
import { Prisma } from './generated/prisma'; | |
export interface Context { | |
db: Prisma; | |
request: any; | |
} | |
export type FirstArgument<T> = T extends (arg1: infer U, …args: any[]) => any ? U : any; | |
export type Remapped<T> = { | |
[P in keyof T]: ( |
This file contains hidden or 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
export type Remapped<T> = { | |
[P in keyof T]: ( | |
parent: null | undefined, | |
args: FirstArgument<T[P]>, | |
ctx: Context, | |
info?: GraphQLResolveInfo | |
) => any | |
}; |
This file contains hidden or 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
export type FirstArgument<T> = T extends (arg1: infer U, …args: any[]) => any ? U : any; |
This file contains hidden or 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
export interface Query { | |
notifications: <T = Notification[]>(args: { start?: Int, end?: Int }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T> | |
} |
This file contains hidden or 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
// the types below do all the heavy lifting of making everything type safe | |
import { Mutation, Notification, Query, Resolver } from './utils'; | |
export const query: Query = { | |
// hit cmd+space and feel the magic | |
// params and ctx are type safe, parent and info are 'any' | |
notifications(_parent, params, ctx, info) { | |
} | |
}; |
This file contains hidden or 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
using Emgu.CV.Structure; | |
using sl; | |
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Diagnostics; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; |