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

feat: configurable ComponentCustomProperties['$i18n'] type #2093

Merged

Conversation

BobbieGoede
Copy link
Member

This uses the same pattern as the Locale type narrowing, in this case it narrows the $i18n custom component property to either VueI18n or ExportedGlobalComposer but keeps the original behavior (VueI18n | ExportedGlobalComposer) if left unset.

Usage like so:

declare module '@intlify/vue-i18n-core' {
  interface GeneratedTypeConfig {
    legacy: false
  }
}

I wish I looked into this earlier, since the legacy API is going to be removed soon 😅..

Related

Copy link

Size Report

Bundles

File Size Gzip Brotli
core.esm-browser.prod.js 37.16 kB 11.35 kB 10.12 kB
core.global.prod.js 30.50 kB 10.55 kB 9.52 kB
core.prod.cjs 0.88 kB 0.43 kB 0.34 kB
core.runtime.esm-browser.prod.js 22.87 kB 7.45 kB 6.65 kB
core.runtime.global.prod.js 17.48 kB 6.81 kB 6.12 kB
message-compiler.esm-browser.prod.js 19.28 kB 5.76 kB 5.14 kB
message-compiler.global.prod.js 17.32 kB 5.54 kB 4.97 kB
message-compiler.prod.cjs 57.50 kB 10.06 kB 8.60 kB
petite-vue-i18n-core.esm-browser.prod.js 20.36 kB 6.84 kB 6.15 kB
petite-vue-i18n-core.global.prod.js 15.64 kB 6.05 kB 5.47 kB
petite-vue-i18n-core.prod.cjs 25.99 kB 6.14 kB 5.31 kB
petite-vue-i18n.esm-browser.prod.js 36.86 kB 11.32 kB 10.15 kB
petite-vue-i18n.global.prod.js 29.87 kB 10.18 kB 9.19 kB
petite-vue-i18n.prod.cjs 25.67 kB 6.05 kB 5.25 kB
petite-vue-i18n.runtime.esm-browser.prod.js 22.43 kB 7.32 kB 6.60 kB
petite-vue-i18n.runtime.global.prod.js 16.86 kB 6.41 kB 5.80 kB
vue-i18n.esm-browser.prod.js 56.43 kB 16.42 kB 14.67 kB
vue-i18n.global.prod.js 46.06 kB 14.87 kB 13.37 kB
vue-i18n.prod.cjs 0.72 kB 0.34 kB 0.28 kB
vue-i18n.runtime.esm-browser.prod.js 42.00 kB 12.43 kB 11.15 kB
vue-i18n.runtime.global.prod.js 33.04 kB 11.13 kB 10.07 kB

Usages

Name Size Gzip Brotli
packages/size-check-core (@intlify/core) 9.10 kB 3.76 kB 3.41 kB
packages/size-check-petite-vue-i18n (petite-vue-i18n) 77.82 kB 30.33 kB 27.28 kB
packages/size-check-vue-i18n (vue-i18n) 82.82 kB 31.74 kB 28.53 kB

Copy link

pkg-pr-new bot commented Jan 27, 2025

Open in Stackblitz

@intlify/core

npm i https://pkg.pr.new/@intlify/core@2093

@intlify/core-base

npm i https://pkg.pr.new/@intlify/core-base@2093

@intlify/devtools-types

npm i https://pkg.pr.new/@intlify/devtools-types@2093

@intlify/message-compiler

npm i https://pkg.pr.new/@intlify/message-compiler@2093

petite-vue-i18n

npm i https://pkg.pr.new/petite-vue-i18n@2093

@intlify/shared

npm i https://pkg.pr.new/@intlify/shared@2093

vue-i18n

npm i https://pkg.pr.new/vue-i18n@2093

@intlify/vue-i18n-core

npm i https://pkg.pr.new/@intlify/vue-i18n-core@2093

commit: dee0118

@BobbieGoede
Copy link
Member Author

I'm working on a PR for nuxt-i18n, I can use the preview pkg-pr-new releases to demonstrate if it works

@kazupon
Copy link
Member

kazupon commented Jan 28, 2025

Thank you!
Sorry, I've forgotten to tell to you that master branch is for v12
So, you need to push to v11 branch! 🙏

@kazupon kazupon merged commit 491ecd9 into intlify:master Jan 31, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Includes new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants