With Next.js 14.1.0 I got the following build error (similar to this SO post):
Type error: Type 'OmitWithTag<typeof
import("{omitted}/src/app/{omitted}/page"), "default" | "metadata" |
"config" | "generateStaticParams" | "revalidate" | "dynamic" | ... 7
more ... | "generateViewport", "">' does not satisfy the constraint '{
[x: string]: never; }'. **Property 'SingleDatePicker' is
incompatible with index signature**.
**Type** '({ name, value, label, minDate, maxDate, className, state, disabled, onChange }: { name: keyof InsertBidFormData; value?:
DateType | undefined; label: string; minDate?: Date | undefined;
maxDate?: Date | undefined; className?: { input?: string | undefined;
} | undefined; state?: BidFormState | undefined; disabled?: ...' **is
not assignable to type 'never'**.
This was the definition of the page in page.tsx
'use client'
//... imports
export default function Page() {
//hooks and props
return (
<form>
<SingleDatePicker name={'date'} ...props />
</form>
)
}
export const SingleDatePicker = (props: Props) => {
//whatever
}
It turned out that the extra 'export' to the
SingleDatePickercomponent definition was the issue. Simply removing it:from inside the page solved my particular case.