File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,8 +37,9 @@ export const getParentId = (parent: unknown): number | undefined => {
3737 * that feed `parent` into a project request or query key need the scalar —
3838 * an object stringifies into URLs as `[object Object]`.
3939 */
40- export const withScalarParent = < T extends { parent ?: unknown } > ( challenge : T ) : T => {
41- if ( typeof challenge . parent !== 'object' || challenge . parent === null ) return challenge
42- const parentId = getParentId ( challenge . parent )
40+ export const withScalarParent = < T extends object > ( challenge : T ) : T => {
41+ const { parent } = challenge as { parent ?: unknown }
42+ if ( typeof parent !== 'object' || parent === null ) return challenge
43+ const parentId = getParentId ( parent )
4344 return parentId === undefined ? challenge : ( { ...challenge , parent : parentId } as T )
4445}
You can’t perform that action at this time.
0 commit comments