Skip to content

update optimize-locales plugin type #8087

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stefanprobst
Copy link
Contributor

@stefanprobst stefanprobst commented Apr 12, 2025

this updates the optimize-locales plugin type:

the second generic in UnpluginInstance is for nested plugins, see https://github.com/unjs/unplugin/blob/466f4d5be7ba048d81613d853c34d7eea2518507/src/types.ts#L162

setting to false instead of boolean means that the optimize-locales plugin will be typed as just Plugin instead of Array<Plugin> | Plugin>.

avoids type issue when spreading like here: https://react-spectrum.adobe.com/react-aria/internationalization.html#vite

@snowystinger
Copy link
Member

Thanks for the PR, it's interesting, I can't seem to reproduce the error here https://github.com/adobe/react-spectrum/blob/main/examples/remix/vite.config.ts though the change makes sense.
Do you have a reproduction handy?

I copied our remix example out to a different directory so the workspaces wouldn't exist and built it from there. Found a couple updates that needed to be made #8090 and removed the workspaces/resolutions entry in the package.json. But no error in my vite.config.ts like this one.

@stefanprobst
Copy link
Contributor Author

i ran into this trying our tanstack/start - tsc seems to be fine with it but i did get this eslint error:

eslint-rac

here's a repo where you can see the lint error: https://github.com/stefanprobst/issue-rac-optimize-locales-types/blob/main/app.config.ts

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

o, because technically you can do it, just some eslint rule thinks it's better if you don't

haha, ok, approved, for now you can ts-expect-error

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

Successfully merging this pull request may close these issues.

2 participants