MCPcopy Create free account
hub / github.com/glideapps/quicktype / nullableFromUnion

Function nullableFromUnion

src/Type.ts:405–410  ·  view source on GitHub ↗
(t: UnionType)

Source from the content-addressed store, hash-verified

403}
404
405export function nullableFromUnion(t: UnionType): Type | null {
406 const [hasNull, nonNulls] = removeNullFromUnion(t);
407 if (!hasNull) return null;
408 if (nonNulls.size !== 1) return null;
409 return defined(nonNulls.first());
410}
411
412export function nonNullTypeCases(t: Type): OrderedSet<Type> {
413 if (t.kind === "null") {

Callers 14

unionNeedsNameFunction · 0.90
SimpleTypesRendererClass · 0.90
GoRendererClass · 0.90
requiredOrOptionalFunction · 0.90
ElmRendererClass · 0.90
unionNeedsNameMethod · 0.90
JavaRendererClass · 0.90
TypeScriptRendererClass · 0.90
SwiftRendererClass · 0.90
unionNeedsNameMethod · 0.90

Calls 2

definedFunction · 0.90
removeNullFromUnionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…