Skip to content

Conversation

@florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Apr 21, 2025

Changes

Testing

Should still pass

Docs

Changeset

@florian-lefebvre florian-lefebvre self-assigned this Apr 21, 2025
@changeset-bot
Copy link

changeset-bot bot commented Apr 21, 2025

🦋 Changeset detected

Latest commit: 77d5f9b

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: react Related to React (scope) pkg: integration Related to any renderer integration (scope) labels Apr 21, 2025
@github-actions github-actions bot added the pkg: svelte Related to Svelte (scope) label Apr 21, 2025
@github-actions github-actions bot added the pkg: vue Related to Vue (scope) label Apr 21, 2025
'@astrojs/vue': patch
---

Improves type-safety of renderers
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically a changeset is not required since it's a refactor but I prefer to add one here to play it safe

@florian-lefebvre florian-lefebvre marked this pull request as ready for review April 21, 2025 14:57
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e2e tests are failing

@ematipico ematipico merged commit a19a185 into main Apr 22, 2025
14 checks passed
@ematipico ematipico deleted the feat/integrations-ts branch April 22, 2025 11:05
@astrobot-houston astrobot-houston mentioned this pull request Apr 22, 2025
@eikowagenknecht
Copy link

eikowagenknecht commented Apr 28, 2025

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.

@ematipico
Copy link
Member

@eikowagenknecht can you please create an issue?

@eikowagenknecht
Copy link

Done, #13712

openscript pushed a commit to openscript/astro that referenced this pull request Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope) pkg: react Related to React (scope) pkg: svelte Related to Svelte (scope) pkg: vue Related to Vue (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants