()
| 35 | return argsTypes |
| 36 | } |
| 37 | public toTS(): string { |
| 38 | const { type } = this |
| 39 | const { name } = type |
| 40 | const outputType = buildOutputType(type) |
| 41 | |
| 42 | return ` |
| 43 | /** |
| 44 | * Count Type ${name} |
| 45 | */ |
| 46 | |
| 47 | ${ts.stringify(outputType)} |
| 48 | |
| 49 | export type ${getSelectName( |
| 50 | name, |
| 51 | )}<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { |
| 52 | ${indent( |
| 53 | type.fields |
| 54 | .map((field) => { |
| 55 | const types = ['boolean'] |
| 56 | if (field.outputType.location === 'outputObjectTypes') { |
| 57 | types.push(getFieldArgName(field, this.type.name)) |
| 58 | } |
| 59 | |
| 60 | // TODO: what should happen if both args and output types are present? |
| 61 | // Right new, they both will be part of the union, but is it correct? |
| 62 | |
| 63 | if (field.args.length > 0) { |
| 64 | types.push(getCountArgsType(name, field.name)) |
| 65 | } |
| 66 | |
| 67 | return `${field.name}?: ${types.join(' | ')}` |
| 68 | }) |
| 69 | .join('\n'), |
| 70 | TAB_SIZE, |
| 71 | )} |
| 72 | } |
| 73 | |
| 74 | ${this.argsTypes.map((typeExport) => ts.stringify(typeExport)).join('\n\n')} |
| 75 | ` |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | function getCountArgsType(typeName: string, fieldName: string) { |
nothing calls this directly
no test coverage detected