File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
packages/react-sortly/src Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -675,7 +675,7 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">null</spa
675
675
< a name ="flatten " class ="tsd-anchor "> </ a >
676
676
< h3 > < span class ="tsd-flag ts-flagConst "> Const</ span > flatten</ h3 >
677
677
< ul class ="tsd-signatures tsd-kind-function tsd-has-type-parameter tsd-is-not-exported ">
678
- < li class ="tsd-signature tsd-kind-icon "> flatten<T>< span class ="tsd-signature-symbol "> (</ span > items< span class ="tsd-signature-symbol "> : </ span > < span class ="tsd-signature-type "> T</ span > < span class ="tsd-signature-symbol "> []</ span > < span class ="tsd-signature-symbol "> )</ span > < span class ="tsd-signature-symbol "> : </ span > < span class ="tsd-signature-symbol "> (</ span > < span class ="tsd-signature-type "> T </ span > < span class ="tsd-signature-symbol "> & </ span > < span class ="tsd-signature-type "> object</ span > < span class ="tsd-signature-symbol "> )</ span > < span class ="tsd-signature-symbol "> []</ span > </ li >
678
+ < li class ="tsd-signature tsd-kind-icon "> flatten<T>< span class ="tsd-signature-symbol "> (</ span > items< span class ="tsd-signature-symbol "> : </ span > < span class ="tsd-signature-type "> T</ span > < span class ="tsd-signature-symbol "> []</ span > < span class ="tsd-signature-symbol "> )</ span > < span class ="tsd-signature-symbol "> : </ span > < span class ="tsd-signature-symbol "> (</ span > < span class ="tsd-signature-type "> object </ span > < span class ="tsd-signature-symbol "> & </ span > < span class ="tsd-signature-type "> object</ span > < span class ="tsd-signature-symbol "> )</ span > < span class ="tsd-signature-symbol "> []</ span > </ li >
679
679
</ ul >
680
680
< ul class ="tsd-descriptions ">
681
681
< li class ="tsd-description ">
@@ -696,7 +696,7 @@ <h4 class="tsd-parameters-title">Parameters</h4>
696
696
< h5 > items: < span class ="tsd-signature-type "> T</ span > < span class ="tsd-signature-symbol "> []</ span > </ h5 >
697
697
</ li >
698
698
</ ul >
699
- < h4 class ="tsd-returns-title "> Returns < span class ="tsd-signature-symbol "> (</ span > < span class ="tsd-signature-type "> T </ span > < span class ="tsd-signature-symbol "> & </ span > < span class ="tsd-signature-type "> object</ span > < span class ="tsd-signature-symbol "> )</ span > < span class ="tsd-signature-symbol "> []</ span > </ h4 >
699
+ < h4 class ="tsd-returns-title "> Returns < span class ="tsd-signature-symbol "> (</ span > < span class ="tsd-signature-type "> object </ span > < span class ="tsd-signature-symbol "> & </ span > < span class ="tsd-signature-type "> object</ span > < span class ="tsd-signature-symbol "> )</ span > < span class ="tsd-signature-symbol "> []</ span > </ h4 >
700
700
</ li >
701
701
</ ul >
702
702
</ section >
Original file line number Diff line number Diff line change @@ -246,7 +246,7 @@ const remove = <T extends ItemData>(items: T[], index: number) => {
246
246
} ) ;
247
247
} ;
248
248
249
- const convert = < T extends ObjectLiteral & { id : ID ; parentId : null | ID ; index : number } > (
249
+ const convert = < T extends ObjectLiteral & { id : ID ; parentId ? : null | ID ; index : number } > (
250
250
items : T [ ] ,
251
251
parentId ?: null | ID ,
252
252
depth ?: number ,
@@ -292,7 +292,7 @@ const buildTree = <T extends ObjectLiteral>(
292
292
return tree ;
293
293
} ;
294
294
295
- const flatten = < T extends ItemData > ( items : T [ ] ) : ( T & { parentId : ID ; index : number } ) [ ] => (
295
+ const flatten = < T extends ItemData > ( items : T [ ] ) => (
296
296
items . map ( ( item , index ) => {
297
297
const { depth, ...data } = item ;
298
298
const parent = findParent ( items , index ) ;
@@ -302,7 +302,7 @@ const flatten = <T extends ItemData>(items: T[]): (T & { parentId: ID; index: nu
302
302
...data ,
303
303
index : siblings . indexOf ( item ) ,
304
304
parentId : parent ? parent . id : 0
305
- } as ( T & { parentId : ID ; index : number } ) ;
305
+ } ;
306
306
} )
307
307
) ;
308
308
You can’t perform that action at this time.
0 commit comments