Tuple to Union
introduction#
Implement a generic TupleToUnion<T> which covers the values of a tuple to its values union.
For example
ts
View on GitHubts
start point#
tsTry/* _____________ Your Code Here _____________ */ÂtypeTupleToUnion <T > = anyÂ/* _____________ Test Cases _____________ */typecases = [Type 'false' does not satisfy the constraint 'true'.2344Type 'false' does not satisfy the constraint 'true'.Expect <Equal <TupleToUnion <[123, '456', true]>, 123 | '456' | true>>,Type 'false' does not satisfy the constraint 'true'.2344Type 'false' does not satisfy the constraint 'true'.Expect <Equal <TupleToUnion <[123]>, 123>>,]
take the challengetsTry/* _____________ Your Code Here _____________ */ÂtypeTupleToUnion <T > = anyÂ/* _____________ Test Cases _____________ */typecases = [Type 'false' does not satisfy the constraint 'true'.2344Type 'false' does not satisfy the constraint 'true'.Expect <Equal <TupleToUnion <[123, '456', true]>, 123 | '456' | true>>,Type 'false' does not satisfy the constraint 'true'.2344Type 'false' does not satisfy the constraint 'true'.Expect <Equal <TupleToUnion <[123]>, 123>>,]