-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
- P2: has workaroundBug, but has workaround (priority)Bug, but has workaround (priority)feat: typescriptRelated to TypeScript (scope)Related to TypeScript (scope)regression
Description
Astro Info
Astro v5.7.6
Node v22.14.0
System Windows (x64)
Package Manager pnpm
Output static
Adapter none
Integrations @astrojs/mdx
@astrojs/react
@astrojs/sitemap
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
#13663 // a19a185#diff-ba61f66c23d3acf1a091d002e9c3e9b206bab065742b39149717d21926c13651R43
This change makes the type of reactRenderer incompatible with the signature of addServerRenderer. E.g. This code:
container.addServerRenderer({
renderer: reactRenderer,
name: "@astrojs/react",
});now fails with:
src/pages/rss.xml.ts:26:5 - error TS2322: Type '{ name: string; check: (this: RendererContext, Component: any, props: Record<string, any>, children: any) => Promise<any>; renderToStaticMarkup: (this: RendererContext, Component: any, props: Record<...>, { default: children, ...slotted }: Record<...>, metadata: AstroComponentMetadata) => Promise<...>; supportsAstro...' is not assignable to type 'NamedSSRLoadedRendererValue | SSRLoadedRendererValue'.
Type '{ name: string; check: (this: RendererContext, Component: any, props: Record<string, any>, children: any) => Promise<any>; renderToStaticMarkup: (this: RendererContext, Component: any, props: Record<...>, { default: children, ...slotted }: Record<...>, metadata: AstroComponentMetadata) => Promise<...>; supportsAstro...' is not assignable to type 'SSRLoadedRendererValue'.
Types of property 'renderToStaticMarkup' are incompatible.
Type '(this: RendererContext, Component: any, props: Record<string, any>, { default: children, ...slotted }: Record<string, any>, metadata: AstroComponentMetadata) => Promise<...>' is not assignable to type 'AsyncRendererComponentFn<{ html: string; attrs?: Record<string, string>; }>'.
Types of parameters 'metadata' and 'metadata' are incompatible.
Type 'AstroComponentMetadata | undefined' is not assignable to type 'AstroComponentMetadata'.
Type 'undefined' is not assignable to type 'AstroComponentMetadata'.
26 renderer: reactRenderer,
~~~~~~~~
node_modules/.pnpm/[email protected]_@types+node@22._8ac90e0a515cf726370157c604a2e39c/node_modules/astro/dist/container/index.d.ts:84:5
84 renderer: NamedSSRLoadedRendererValue;
~~~~~~~~
The expected type comes from property 'renderer' which is declared here on type 'AddServerRenderer'
Found 1 error in src/pages/rss.xml.ts:26
Had to revert back to react 4.2.4 for now.
What's the expected result?
Type signatures should match
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-jabewpbi?file=src%2Fpages%2Frss.xml.ts
Participation
- I am willing to submit a pull request for this issue.
Metadata
Metadata
Assignees
Labels
- P2: has workaroundBug, but has workaround (priority)Bug, but has workaround (priority)feat: typescriptRelated to TypeScript (scope)Related to TypeScript (scope)regression