diff options
author | 2021-11-22 21:25:57 -0500 | |
---|---|---|
committer | 2021-11-22 21:25:57 -0500 | |
commit | f747fd9dfa19ac9edc839161d0adaeb962e2ade0 (patch) | |
tree | 07fb2ce5d25f7981f51b9b48cdc31190ec91a4c7 | |
parent | c06e34c687187a528d0da39eddec71323b56e77a (diff) | |
download | bun-f747fd9dfa19ac9edc839161d0adaeb962e2ade0.tar.gz bun-f747fd9dfa19ac9edc839161d0adaeb962e2ade0.tar.zst bun-f747fd9dfa19ac9edc839161d0adaeb962e2ade0.zip |
ts-expect-error the remaining ts-errors
-rw-r--r-- | packages/bun-framework-next/client.development.tsx | 3 | ||||
-rw-r--r-- | packages/bun-framework-next/renderDocument.tsx | 26 | ||||
-rw-r--r-- | packages/bun-framework-next/server.development.tsx | 2 |
3 files changed, 25 insertions, 6 deletions
diff --git a/packages/bun-framework-next/client.development.tsx b/packages/bun-framework-next/client.development.tsx index bf03af289..aad808965 100644 --- a/packages/bun-framework-next/client.development.tsx +++ b/packages/bun-framework-next/client.development.tsx @@ -289,6 +289,9 @@ export async function _boot(EntryPointNamespace, isError) { const appScripts = globalThis.__NEXT_DATA__.pages["/_app"]; + // Type 'typeof App' is not assignable to type 'ComponentClass<AppProps, any>'. + // Construct signature return types 'App<any, any, any>' and 'Component<AppProps, any, any>' are incompatible. + // @ts-expect-error CachedApp = NextApp; if (appScripts && appScripts.length > 0) { diff --git a/packages/bun-framework-next/renderDocument.tsx b/packages/bun-framework-next/renderDocument.tsx index 661bebdc0..417e200ac 100644 --- a/packages/bun-framework-next/renderDocument.tsx +++ b/packages/bun-framework-next/renderDocument.tsx @@ -31,6 +31,9 @@ const dev = process.env.NODE_ENV === "development"; type ParsedUrlQuery = Record<string, string | string[]>; +// @ts-expect-error TS doesn't understand that Bun is a global +const origin: string = Bun.origin; + const isJSFile = (file: string) => file.endsWith(".js") || file.endsWith(".jsx") || @@ -199,7 +202,11 @@ function renderDocument( "<!DOCTYPE html>" + ReactDOMServer.renderToStaticMarkup( <AmpStateContext.Provider value={ampState}> + {/* HTMLContextProvider expects useMainContent */} + {/* @ts-expect-error */} <HtmlContext.Provider value={htmlProps}> + {/* Document doesn't expect useMaybeDeferContent */} + {/* @ts-expect-error */} <Document {...htmlProps} {...docProps}></Document> </HtmlContext.Provider> </AmpStateContext.Provider> @@ -336,7 +343,8 @@ export async function render({ routeNames: string[]; request: Request; }): Promise<Response> { - const { default: Component, getStaticProps = null } = PageNamespace || {}; + const { default: Component } = PageNamespace || {}; + const getStaticProps = (PageNamespace as any).getStaticProps || null; const { default: AppComponent_ } = AppNamespace || {}; var query = Object.assign({}, route.query); @@ -348,7 +356,7 @@ export async function render({ for (let i = 0; i < routeNames.length; i++) { const filePath = routePaths[i]; const name = routeNames[i]; - pages[name] = [Bun.origin + filePath]; + pages[name] = [origin + filePath]; } if (appStylesheets.length > 0) { @@ -490,7 +498,7 @@ export async function render({ isFallback: isFallback, }, true, - Bun.origin, + origin, null, [], // renderOpts.locales, null, //renderOpts.defaultLocale, @@ -529,7 +537,7 @@ export async function render({ }, }; - var props = await loadGetInitialProps(AppComponent, { + var props: any = await loadGetInitialProps(AppComponent, { AppTree: ctx.AppTree, Component, router, @@ -541,6 +549,7 @@ export async function render({ // We don't call getServerSideProps on clients. // This isn't correct. // We don't call getServerSideProps on clients. + // @ts-expect-error const getServerSideProps = PageNamespace.getServerSideProps; var responseHeaders: Headers; @@ -637,6 +646,7 @@ export async function render({ const renderToString = ReactDOMServer.renderToString; const ErrorDebug = null; + props.pageProps = pageProps; const renderPage: RenderPage = ( @@ -659,6 +669,8 @@ export async function render({ } const { App: EnhancedApp, Component: EnhancedComponent } = + // Argument of type 'NextComponentType<any, {}, {}> | typeof App' is not assignable to parameter of type 'AppType'. + // @ts-expect-error enhanceComponents(options, AppComponent, Component); const htmlOrPromise = renderToString( @@ -702,13 +714,15 @@ export async function render({ docComponentsRendered, ...renderOpts, disableOptimizedLoading: false, - canonicalBase: Bun.origin, + canonicalBase: origin, buildManifest: { devFiles: [], allFiles: [], polyfillFiles: [], lowPriorityFiles: [], - pages: pages, + // buildManifest doesn't expect pages, even though its used + // @ts-expect-error + pages, }, // Only enabled in production as development mode has features relying on HMR (style injection for example) // @ts-expect-error diff --git a/packages/bun-framework-next/server.development.tsx b/packages/bun-framework-next/server.development.tsx index 96ba55812..4ac2621e8 100644 --- a/packages/bun-framework-next/server.development.tsx +++ b/packages/bun-framework-next/server.development.tsx @@ -26,6 +26,8 @@ import(Bun.routesDir + "_document").then( DocumentLoaded = true; }, (err) => { + // ResolveError is defined outside of bun-framework-next in ../../src/runtime/errors + // @ts-expect-error if (err instanceof ResolveError) { DocumentLoaded = true; } else { |