When composing multiple plugins, the type of nextConfig is lost.
A typecheck error will be throw for user setting // @ts-check in strict mode in the next.config.[js|mjs].
Found the cause in the withTMInitializer typings
Changed
After a npm run typings, the src/next-transpile-modules.d.ts will be
Before
declare function withTmInitializer(modules?: string[], options?: {
resolveSymlinks?: boolean;
debug?: boolean;
__unstable_matcher?: (path: string) => boolean;
// THE OLD ONE
}): (nextConfig?: {}) => {};
After
declare function withTmInitializer(modules?: string[], options?: {
resolveSymlinks?: boolean;
debug?: boolean;
__unstable_matcher?: (path: string) => boolean;
// THE NEW ONE, T IS INFERRED FROM ARGUMENT (nextConfig). Return is the same
}): <T>(nextConfig?: T) => T;
A patch
Used a patch to see if all works and it seems to be okay
When composing multiple plugins, the type of nextConfig is lost.
A typecheck error will be throw for user setting
// @ts-check
in strict mode in the next.config.[js|mjs].Found the cause in the withTMInitializer typings
Changed
After a
npm run typings
, thesrc/next-transpile-modules.d.ts
will beBefore
After
A patch
Used a patch to see if all works and it seems to be okay
Discovered in that P/R https://github.com/belgattitude/perso/pull/1015