@@ -763,7 +763,7 @@ export async function renderToHTML(
763763 throw new Error ( invalidKeysMsg ( 'getServerSideProps' , invalidKeys ) )
764764 }
765765
766- if ( data . unstable_notFound ) {
766+ if ( ' unstable_notFound' in data ) {
767767 if ( pathname === '/404' ) {
768768 throw new Error (
769769 `The /404 page can not return unstable_notFound in "getStaticProps", please remove it to continue!`
@@ -775,13 +775,13 @@ export async function renderToHTML(
775775 }
776776
777777 if (
778- data . unstable_redirect &&
778+ ' unstable_redirect' in data &&
779779 typeof data . unstable_redirect === 'object'
780780 ) {
781781 checkRedirectValues ( data . unstable_redirect , req )
782782
783783 if ( isDataReq ) {
784- data . props = {
784+ ; ( data as any ) . props = {
785785 __N_REDIRECT : data . unstable_redirect . destination ,
786786 }
787787 } else {
@@ -792,15 +792,19 @@ export async function renderToHTML(
792792
793793 if (
794794 ( dev || isBuildTimeSSG ) &&
795- ! isSerializableProps ( pathname , 'getServerSideProps' , data . props )
795+ ! isSerializableProps (
796+ pathname ,
797+ 'getServerSideProps' ,
798+ ( data as any ) . props
799+ )
796800 ) {
797801 // this fn should throw an error instead of ever returning `false`
798802 throw new Error (
799803 'invariant: getServerSideProps did not return valid props. Please report this.'
800804 )
801805 }
802806
803- props . pageProps = Object . assign ( { } , props . pageProps , data . props )
807+ props . pageProps = Object . assign ( { } , props . pageProps , ( data as any ) . props )
804808 ; ( renderOpts as any ) . pageData = props
805809 }
806810 } catch ( dataFetchError ) {
0 commit comments