Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18nMiddleware TS error #34

Closed
MarvinXu opened this issue Nov 18, 2023 · 4 comments
Closed

i18nMiddleware TS error #34

MarvinXu opened this issue Nov 18, 2023 · 4 comments

Comments

@MarvinXu
Copy link

In new projects, middleware.ts shows an typescript error:

Argument of type 'MiddlewareResponseHandler' is not assignable to parameter of type 'MiddlewareEndpointHandler'.

image

I think it's because Astro updated types in the new release of i18n feature. Speaking of that, what's your opinion on the new i18n feature?

@jlarmstrongiv
Copy link
Owner

Thanks @MarvinXu! I’ve been planning to use the new integration middleware feature so that you don’t have to configure the middleware at all—just haven’t gotten around to it quite yet. I decided to try it first by making cors and helmet middleware for Astro, and bringing back what I’ve learned to astro-i18n-aut. Certainly makes me miss express haha

As for the new i18n feature, I’m disappointed that it doesn’t support what this library can—rendering all locales, including an unprefixed default locale, using a single page.astro file. I don’t want to generate or keep an Astro page file up to date for every locale I have. I was actually hoping to retire this library, but it seems like I’ll need it for quite a while longer.

I’ll keep this issue open until I make a PR for the built-in integration middleware.

@MarvinXu
Copy link
Author

I don’t want to generate or keep an Astro page file up to date for every locale I have.

ha, exactly the reason I chose this integration :)

I’ve been planning to use the new integration middleware feature so that you don’t have to configure the middleware at all

This looks great! Looking forward to it~

@jlarmstrongiv
Copy link
Owner

Fixed in 0.5.0 🎉

Just remove the old astro-i18n-aut middleware (the integration handles it now)…

…and everything will work the same!

@jlarmstrongiv
Copy link
Owner

I don’t want to generate or keep an Astro page file up to date for every locale I have.

ha, exactly the reason I chose this integration :)

I encourage you to leave a comment and feedback in the i18n routing RFC 😄 I’d love to see Astro support it in core, or at least fix withastro/astro#8241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants