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