Type error: Page "..." has an invalid "default" export: Type "..." is not valid in Next.js
Answered
Thai posted this in #help-forum
ThaiOP
when i use npm run build in app-router nextjs 13.5 , i found error Linting and checking validity of types .Failed to compile. How can i fix?? thank you
src/app/auth/signIn/page.tsx
Type error: Page "src/app/auth/signIn/page.tsx" has an invalid "default" export:
Type "ISignInProps" is not valid.
import React from 'react';
import LoginSection from '@/components/login/LoginSection';
type Props = {
error: any;
searchParams?: Record<'callbackUrl' | 'error', string>;
};
const SignInPage = (props: Props) => {
return (
<div className=''>
<LoginSection
error={props.searchParams?.error}
callbackUrl={props.searchParams?.callbackUrl}
/>
</div>
);
};
export default SignInPage;
src/app/auth/signIn/page.tsx
Type error: Page "src/app/auth/signIn/page.tsx" has an invalid "default" export:
Type "ISignInProps" is not valid.
import React from 'react';
import LoginSection from '@/components/login/LoginSection';
type Props = {
error: any;
searchParams?: Record<'callbackUrl' | 'error', string>;
};
const SignInPage = (props: Props) => {
return (
<div className=''>
<LoginSection
error={props.searchParams?.error}
callbackUrl={props.searchParams?.callbackUrl}
/>
</div>
);
};
export default SignInPage;
Answered by Ray
remove error from the
Propstype Props = {
searchParams?: Record<'callbackUrl' | 'error', string>;
};3 Replies
@Thai when i use npm run build in app-router nextjs 13.5 , i found error Linting and checking validity of types .Failed to compile. How can i fix?? thank you
src/app/auth/signIn/page.tsx
Type error: Page "src/app/auth/signIn/page.tsx" has an invalid "default" export:
Type "ISignInProps" is not valid.
import React from 'react';
import LoginSection from '@/components/login/LoginSection';
type Props = {
error: any;
searchParams?: Record<'callbackUrl' | 'error', string>;
};
const SignInPage = (props: Props) => {
return (
<div className=''>
<LoginSection
error={props.searchParams?.error}
callbackUrl={props.searchParams?.callbackUrl}
/>
</div>
);
};
export default SignInPage;
remove error from the
Propstype Props = {
searchParams?: Record<'callbackUrl' | 'error', string>;
};Answer