MCPcopy Index your code
hub / github.com/glideapps/quicktype / removeNullFromUnion

Function removeNullFromUnion

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

Source from the content-addressed store, hash-verified

395}
396
397export function removeNullFromUnion(t: UnionType): [PrimitiveType | null, OrderedSet<Type>] {
398 const nullType = t.findMember("null");
399 if (!nullType) {
400 return [null, t.members];
401 }
402 return [nullType as PrimitiveType, t.members.filterNot(isNull).toOrderedSet()];
403}
404
405export function nullableFromUnion(t: UnionType): Type | null {
406 const [hasNull, nonNulls] = removeNullFromUnion(t);

Callers 10

TypeBuilder.tsFile · 0.90
makeNullableFunction · 0.90
removeNullFunction · 0.90
GoRendererClass · 0.90
JavaRendererClass · 0.90
SwiftRendererClass · 0.90
CSharpRendererClass · 0.90
CPlusPlusRendererClass · 0.90
nullableFromUnionFunction · 0.85
nonNullTypeCasesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…