vikejs / vike

🔨 Flexible, lean, community-driven, dependable, fast Vite-based frontend framework.
https://vike.dev
MIT License
4.39k stars 352 forks source link

use moduleResolution Bundler and remove .js extesion #1955

Open rtritto opened 2 weeks ago

rtritto commented 2 weeks ago

Related #1953

rtritto commented 2 weeks ago

https://github.com/vikejs/vike/actions/runs/11722525913/job/32652265503?pr=1955

Error: client/client-routing-runtime/getPageContextFromHooks.ts(20,23): error TS2307: Cannot find module '@brillout/json-serializer/parse' or its corresponding type declarations.
Error: client/shared/getPageContextSerializedInHtml.ts(1,23): error TS2307: Cannot find module '@brillout/json-serializer/parse' or its corresponding type declarations.
Error: node/runtime/html/serializePageContextClientSide.ts(5,50): error TS2307: Cannot find module '@brillout/json-serializer/stringify' or its corresponding type declarations.
Error: node/runtime/html/serializePageContextClientSide.ts(73,26): error TS18046: 'err' is of type 'unknown'.
Error: node/runtime/html/serializePageContextClientSide.ts(89,48): error TS18046: 'err' is of type 'unknown'.
Error: node/runtime/renderPage/handleErrorWithoutErrorPage.ts(3,27): error TS2307: Cannot find module '@brillout/json-serializer/stringify' or its corresponding type declarations.
Error: shared/page-configs/serialize/parsePageConfigs.ts(19,32): error TS2307: Cannot find module '@brillout/json-serializer/parse' or its corresponding type declarations.
Error: shared/page-configs/serialize/serializeConfigValues.ts(18,27): error TS2307: Cannot find module '@brillout/json-serializer/stringify' or its corresponding type declarations.
Error: shared/page-configs/serialize/serializeConfigValues.ts(219,16): error TS7006: Parameter '_' implicitly has an 'any' type.
Error: shared/page-configs/serialize/serializeConfigValues.ts(219,19): error TS7006: Parameter 'value' implicitly has an 'any' type.
rtritto commented 2 weeks ago

https://github.com/vikejs/vike/actions/runs/11724341831/job/32658063618?pr=1955

With strct=false:

Spoiler Error: client/client-routing-runtime/getPageContextFromHooks.ts(20,23): error TS2307: Cannot find module '@brillout/json-serializer/parse' or its corresponding type declarations. Error: client/client-routing-runtime/getPageContextFromHooks.ts(186,41): error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'object'. Error: client/client-routing-runtime/history.ts(131,13): error TS2698: Spread types may only be created from object types. Error: client/client-routing-runtime/prefetch.ts(81,46): error TS2339: Property 'pageContextFromServerHooks' does not exist on type '{ is404ServerSideRouted: true; } | { is404ServerSideRouted?: undefined; pageContextFromServerHooks: PageContextFromServerHooks; }'. Property 'pageContextFromServerHooks' does not exist on type '{ is404ServerSideRouted: true; }'. Error: client/client-routing-runtime/renderPageClientSide.ts(261,47): error TS2339: Property 'pageContextFromServerHooks' does not exist on type '{ is404ServerSideRouted: true; } | { is404ServerSideRouted?: undefined; pageContextFromServerHooks: PageContextFromServerHooks; }'. Property 'pageContextFromServerHooks' does not exist on type '{ is404ServerSideRouted: true; }'. Error: client/client-routing-runtime/renderPageClientSide.ts(353,39): error TS2322: Type 'PageContextAbort | PageContextFromRewrite' is not assignable to type 'PageContextFromRewrite'. Type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' is not assignable to type 'PageContextFromRewrite'. Type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' is not assignable to type '{ _urlRewrite: string; }'. Property '_urlRewrite' is optional in type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' but required in type '{ _urlRewrite: string; }'. Error: client/client-routing-runtime/renderPageClientSide.ts(353,67): error TS2322: Type 'PageContextAbort' is not assignable to type 'PageContextFromRewrite'. Type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' is not assignable to type 'PageContextFromRewrite'. Type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' is not assignable to type '{ _urlRewrite: string; }'. Property '_urlRewrite' is optional in type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' but required in type '{ _urlRewrite: string; }'. Error: client/client-routing-runtime/renderPageClientSide.ts(424,43): error TS2339: Property 'pageContextFromServerHooks' does not exist on type '{ is404ServerSideRouted: true; } | { is404ServerSideRouted?: undefined; pageContextFromServerHooks: PageContextFromServerHooks; }'. Property 'pageContextFromServerHooks' does not exist on type '{ is404ServerSideRouted: true; }'. Error: client/client-routing-runtime/setScrollPosition.ts(14,21): error TS2339: Property 'preserveScroll' does not exist on type 'ScrollTarget'. Property 'preserveScroll' does not exist on type 'ScrollPosition'. Error: client/shared/getPageContextSerializedInHtml.ts(1,23): error TS2307: Cannot find module '@brillout/json-serializer/parse' or its corresponding type declarations. Error: node/plugin/plugins/config/resolveBase.ts(21,18): error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'string'. Error: node/plugin/plugins/importUserCode/v1-design/getVikeConfig.ts(863,53): error TS2345: Argument of type 'PointerImportResolved' is not assignable to parameter of type 'FilePathResolved & { fileExportName: string; }'. Type 'DefinedAtFile & FilePathCommon & { filePathAbsoluteFilesystem: null; } & ImportPathAbsolute & { fileExportName?: string; } & { ...; }' is not assignable to type 'FilePathResolved & { fileExportName: string; }'. Type 'DefinedAtFile & FilePathCommon & { filePathAbsoluteFilesystem: null; } & ImportPathAbsolute & { fileExportName?: string; } & { ...; }' is not assignable to type 'FilePathCommon & { filePathAbsoluteFilesystem: string; filePathToShowToUserResolved: string; fileName: string; } & ImportPathAbsolute & { ...; }'. Type 'DefinedAtFile & FilePathCommon & { filePathAbsoluteFilesystem: null; } & ImportPathAbsolute & { fileExportName?: string; } & { ...; }' is missing the following properties from type '{ filePathAbsoluteFilesystem: string; filePathToShowToUserResolved: string; fileName: string; }': filePathToShowToUserResolved, fileName Error: node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.ts(98,29): error TS2345: Argument of type 'FilePath' is not assignable to parameter of type 'FilePathResolved'. Type 'FilePathUnresolved' is not assignable to type 'FilePathResolved'. Type 'FilePathUnresolved' is not assignable to type 'FilePathCommon & { filePathAbsoluteFilesystem: string; filePathToShowToUserResolved: string; fileName: string; } & ImportPathAbsolute'. Type 'FilePathUnresolved' is missing the following properties from type '{ filePathAbsoluteFilesystem: string; filePathToShowToUserResolved: string; fileName: string; }': filePathToShowToUserResolved, fileName Error: node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.ts(82,48): error TS2345: Argument of type 'boolean | "" | "all"' is not assignable to parameter of type 'boolean | "all"'. Type '""' is not assignable to type 'boolean | "all"'. Error: node/plugin/shared/isViteCliCall.ts(58,9): error TS2322: Type 'unknown' is not assignable to type 'string'. Error: node/plugin/shared/isViteCliCall.ts(61,9): error TS2322: Type 'unknown' is not assignable to type 'string'. Error: node/plugin/shared/loggerNotProd/log.ts(68,34): error TS2352: Conversion of type 'Record<"stack", Record>' to type 'Error' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Type 'Record<"stack", Record>' is missing the following properties from type 'Error': name, message Error: node/prerender/runPrerender.ts(330,9): error TS2367: This comparison appears to be unintentional because the types 'Record' and 'boolean' have no overlap. Error: node/prerender/runPrerender.ts(330,36): error TS2367: This comparison appears to be unintentional because the types 'Record' and 'boolean' have no overlap. Error: node/prerender/runPrerender.ts(442,37): error TS2339: Property 'urlOriginal' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(445,39): error TS2339: Property '_providedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(447,51): error TS2339: Property '_providedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(449,116): error TS2339: Property '_providedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(449,168): error TS2339: Property '_providedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(463,46): error TS2345: Argument of type '{ _urlHandler: any; _urlRewrite: any; _noExtraDir: boolean; _prerenderContext: PrerenderContext; } & { urlOriginal: string; headersOriginal?: unknown; headers?: unknown; } & { _objectCreatedByVike: boolean; ... 12 more ...; isClientSideNavigation: boolean; } & PageContextUrlComputed & { ...; } & { ...; }' is not assignable to parameter of type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(508,87): error TS2339: Property 'urlOriginal' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(529,44): error TS2345: Argument of type '{ _urlHandler: any; _urlRewrite: any; _noExtraDir: boolean; _prerenderContext: PrerenderContext; } & { urlOriginal: string; headersOriginal?: unknown; headers?: unknown; } & { _objectCreatedByVike: boolean; ... 12 more ...; isClientSideNavigation: boolean; } & ... 5 more ... & { ...; }' is not assignable to parameter of type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(651,28): error TS2339: Property 'urlOriginal' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(657,24): error TS2339: Property 'urlOriginal' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(658,17): error TS2339: Property '_urlOriginalBeforeHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(658,54): error TS2339: Property 'urlOriginal' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(741,21): error TS2339: Property 'urlOriginal' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(741,49): error TS2339: Property '_urlOriginalBeforeHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(742,19): error TS2339: Property '_urlOriginalModifiedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(771,27): error TS2339: Property '_providedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(772,36): error TS2339: Property '_providedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(773,40): error TS2339: Property '_providedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(774,34): error TS2339: Property '_urlOriginalModifiedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(775,36): error TS2339: Property '_urlOriginalModifiedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(776,40): error TS2339: Property '_urlOriginalModifiedByHook' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(802,27): error TS2339: Property '_pageConfigs' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(803,44): error TS2339: Property '_pageConfigs' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/prerender/runPrerender.ts(821,53): error TS2339: Property 'urlOriginal' does not exist on type 'never'. The intersection 'PageContext' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/runtime/html/injectAssets/getHtmlTags.ts(288,7): error TS2367: This comparison appears to be unintentional because the types 'Record | (unknown[] & Record)' and 'string' have no overlap. Error: node/runtime/html/injectAssets/getHtmlTags.ts(289,7): error TS2367: This comparison appears to be unintentional because the types 'Record | (unknown[] & Record)' and 'string' have no overlap. Error: node/runtime/html/injectAssets/getHtmlTags.ts(290,7): error TS2367: This comparison appears to be unintentional because the types 'Record | (unknown[] & Record)' and 'string' have no overlap. Error: node/runtime/html/injectAssets/getHtmlTags.ts(293,3): error TS2322: Type 'Record | (unknown[] & Record)' is not assignable to type 'Position'. Type 'Record' is not assignable to type 'Position'. Error: node/runtime/html/serializePageContextClientSide.ts(5,50): error TS2307: Cannot find module '@brillout/json-serializer/stringify' or its corresponding type declarations. Error: node/runtime/renderPage.ts(637,7): error TS2322: Type 'PageContextAbort | PageContextFromRewrite' is not assignable to type 'PageContextFromRewrite'. Type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' is not assignable to type 'PageContextFromRewrite'. Type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' is not assignable to type '{ _urlRewrite: string; }'. Property '_urlRewrite' is optional in type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' but required in type '{ _urlRewrite: string; }'. Error: node/runtime/renderPage.ts(638,7): error TS2322: Type 'PageContextAbort' is not assignable to type 'PageContextFromRewrite'. Type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' is not assignable to type 'PageContextFromRewrite'. Type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' is not assignable to type '{ _urlRewrite: string; }'. Property '_urlRewrite' is optional in type '{ _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...>' but required in type '{ _urlRewrite: string; }'. Error: node/runtime/renderPage.ts(661,14): error TS2322: Type '({ _isPageContextObject: boolean; } & PageContextAbort) & { httpResponse: HttpResponse; }' is not assignable to type 'PageContextAfterRender'. Type '{ _isPageContextObject: boolean; } & { _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...> & { ...; }' is not assignable to type 'PageContextAfterRender'. Type '{ _isPageContextObject: boolean; } & { _abortCall: AbortCall; _abortCaller: AbortCaller; } & { _abortCall: `redirect(${string})`; _abortCaller: "throw redirect()"; _urlRedirect: UrlRedirect; } & Omit<...> & { ...; }' is not assignable to type 'Partial'. Types of property 'abortStatusCode' are incompatible. Type 'undefined' is not assignable to type 'never'. Error: node/runtime/renderPage/assertArguments.ts(55,17): error TS2339: Property 'startsWith' does not exist on type 'never'. Error: node/runtime/renderPage/assertArguments.ts(55,48): error TS2339: Property 'startsWith' does not exist on type 'never'. Error: node/runtime/renderPage/assertArguments.ts(55,86): error TS2339: Property 'startsWith' does not exist on type 'never'. Error: node/runtime/renderPage/assertArguments.ts(65,48): error TS2339: Property 'startsWith' does not exist on type 'never'. Error: node/runtime/renderPage/handleErrorWithoutErrorPage.ts(3,27): error TS2307: Cannot find module '@brillout/json-serializer/stringify' or its corresponding type declarations. Error: node/runtime/renderPage/loggerRuntime.ts(12,3): error TS2578: Unused '@ts-expect-error' directive. Error: node/runtime/renderPage/renderPageAlreadyRouted.ts(121,46): error TS2339: Property 'urlOriginal' does not exist on type 'never'. The intersection '{ urlOriginal: string; headersOriginal?: unknown; headers?: unknown; } & { _objectCreatedByVike: boolean; _baseServer: string; _baseAssets: string; _includeAssetsImportedByServer: boolean; _pageFilesAll: PageFile[]; ... 8 more ...; isClientSideNavigation: boolean; } & ... 5 more ... & { ...; }' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/runtime/renderPage/renderPageAlreadyRouted.ts(125,22): error TS2339: Property 'isClientSideNavigation' does not exist on type 'never'. The intersection '{ urlOriginal: string; headersOriginal?: unknown; headers?: unknown; } & { _objectCreatedByVike: boolean; _baseServer: string; _baseAssets: string; _includeAssetsImportedByServer: boolean; _pageFilesAll: PageFile[]; ... 8 more ...; isClientSideNavigation: boolean; } & ... 5 more ... & { ...; }' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/runtime/renderPage/renderPageAlreadyRouted.ts(128,20): error TS2339: Property '_usesClientRouter' does not exist on type 'never'. The intersection '{ urlOriginal: string; headersOriginal?: unknown; headers?: unknown; } & { _objectCreatedByVike: boolean; _baseServer: string; _baseAssets: string; _includeAssetsImportedByServer: boolean; _pageFilesAll: PageFile[]; ... 8 more ...; isClientSideNavigation: boolean; } & ... 5 more ... & { ...; }' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: node/runtime/renderPage/renderPageAlreadyRouted.ts(164,24): error TS2345: Argument of type '{ pageId: string; _httpRequestId: any; _urlRewrite: any; is404: boolean; routeParams: {}; _usesClientRouter: boolean; _debugRouteMatches: any[]; } & { urlOriginal: string; headersOriginal?: unknown; headers?: unknown; } & ... 5 more ... & { ...; }' is not assignable to parameter of type 'never'. The intersection '{ urlOriginal: string; headersOriginal?: unknown; headers?: unknown; } & { _objectCreatedByVike: boolean; _baseServer: string; _baseAssets: string; _includeAssetsImportedByServer: boolean; _pageFilesAll: PageFile[]; ... 8 more ...; isClientSideNavigation: boolean; } & ... 5 more ... & { ...; }' was reduced to 'never' because property '_urlRewrite' has conflicting types in some constituents. Error: shared/hooks/getHook.ts(148,68): error TS2322: Type 'unknown' is not assignable to type 'number | false'. Error: shared/hooks/getHook.ts(148,75): error TS2322: Type 'unknown' is not assignable to type 'number | false'. Error: shared/page-configs/serialize/parsePageConfigs.ts(19,32): error TS2307: Cannot find module '@brillout/json-serializer/parse' or its corresponding type declarations. Error: shared/page-configs/serialize/serializeConfigValues.ts(18,27): error TS2307: Cannot find module '@brillout/json-serializer/stringify' or its corresponding type declarations. Error: shared/route/executeOnBeforeRouteHook.ts(131,7): error TS2352: Conversion of type 'Record' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
rtritto commented 5 days ago
Error: node/runtime/html/serializePageContextClientSide.ts(73,26): error TS18046: 'err' is of type 'unknown'.
Error: node/runtime/html/serializePageContextClientSide.ts(89,48): error TS18046: 'err' is of type 'unknown'.

err type needs to be equal to ErrAddendum of @brillout/json-serializer.

Related: https://github.com/brillout/json-serializer/blob/749ad35f83a0b227d3c33309911c4d4b96fead25/src/stringify.ts#L113-L121


error TS2307: Cannot find module '@brillout/json-serializer/parse' or its corresponding type declarations.

error TS2307: Cannot find module '@brillout/json-serializer/stringify' or its corresponding type declarations.

Both will be fixed after https://github.com/brillout/json-serializer/issues/13