Not assignable to type OptionType in Next 12.2.0
mastepanoski opened this issue · comments
Mauro Stepanoski commented
I upgraded to next 12.2.0, and then started getting this error:
Type 'IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }' is not assignable to type '(IncomingMessage & { cookies?: { [key: string]: string; } | undefined; }) | undefined'.
Type 'IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }' is not assignable to type 'IncomingMessage & { cookies?: { [key: string]: string; } | undefined; }'.
Type 'IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }' is not assignable to type '{ cookies?: { [key: string]: string; } | undefined; }'.
Types of property 'cookies' are incompatible.
Type 'Partial<{ [key: string]: string; }>' is not assignable to type '{ [key: string]: string; }'.
'string' index signatures are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
20 req: ctx.req,
So if I change OptionType declaration like this, it works:
export interface OptionsType extends CookieSerializeOptions {
res?: ServerResponse
req?: IncomingMessage & {
cookies?: Partial<{ [key: string]: string }>
}
}
Andrei Zanouski commented
Thanks!
I know about this problem and there is an open pull request #19
There will be a new version of the package with a fix for this problem in the near future
Andrei Zanouski commented
Please update package version to 2.1.0