Skip to content

Commit 35ef8e8

Browse files
authored
Check delivering undefined props (#39)
1 parent 609625b commit 35ef8e8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/tools.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ type SuperJSONProps<P> = P & {
1010
};
1111

1212
export function withSuperJSONProps<P>(
13-
gssp: GetServerSideProps<P>,
13+
gssp: GetServerSideProps<P> | undefined,
1414
exclude: string[] = []
15-
): GetServerSideProps<SuperJSONProps<P>> {
15+
): GetServerSideProps<SuperJSONProps<P>> | undefined {
16+
if (gssp === undefined)
17+
return undefined;
1618
return async function withSuperJSON(...args) {
1719
const result = await gssp(...args);
1820

@@ -55,6 +57,8 @@ export function withSuperJSONInitProps(
5557
gip: any,
5658
exclude: string[] = []
5759
): any {
60+
if (gip === undefined)
61+
return undefined;
5862
return async function withSuperJSON(...args: any[]) {
5963
const result = await gip(...args);
6064

0 commit comments

Comments
 (0)