(builder: TypeBuilder, tref: TypeRef)
| 88 | } |
| 89 | |
| 90 | function removeNull(builder: TypeBuilder, tref: TypeRef): TypeRef { |
| 91 | const t = tref.deref(); |
| 92 | if (!(t instanceof UnionType)) { |
| 93 | return tref; |
| 94 | } |
| 95 | const nonNulls = removeNullFromUnion(t)[1]; |
| 96 | const first = nonNulls.first(); |
| 97 | if (first) { |
| 98 | if (nonNulls.size === 1) return first.typeRef; |
| 99 | return builder.getUnionType( |
| 100 | { names: t.names, alternatives: t.alternativeNames }, |
| 101 | t.areNamesInferred, |
| 102 | nonNulls.map(nn => nn.typeRef) |
| 103 | ); |
| 104 | } |
| 105 | return panic("Trying to remove null results in empty union."); |
| 106 | } |
| 107 | |
| 108 | function makeScalar(builder: TypeBuilder, ft: GQLType): TypeRef { |
| 109 | switch (ft.name) { |
no test coverage detected
searching dependent graphs…