Skip to content
ts
const 
product
: (Book | Care | Computer)[] = [];
const
result
=
Object
.
groupBy
(
product
,
(
product
) =>
product
.
type
=== "book"
?
product
.
type
: "other", ); void
result
;

Released under the MIT License.