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

JSX element type 'Translation' does not have any construct or call signatures. #1178

Closed
5 tasks done
littleboarx opened this issue Sep 22, 2022 · 3 comments · Fixed by #1310
Closed
5 tasks done

JSX element type 'Translation' does not have any construct or call signatures. #1178

littleboarx opened this issue Sep 22, 2022 · 3 comments · Fixed by #1310
Labels
good first issue Good for newcomers help wanted Extra attention is needed ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf Status: PR Welcome Welcome to Pull Request Type: Improvement Includes backwards-compatible fixes typescript

Comments

@littleboarx
Copy link
Contributor

Reporting a bug?

using the Translation component in the JSX pure funtion component, there's an error in typescript.
image

Expected behavior

there should be no error there

Reproduction

app.tsx

const I18nComp = ({ keypath, replacer }:{keypath:string, replacer:string[]}) => {
    console.log(keypath, replacer)
    const slots = Object.fromEntries(replacer.map((u, i) => [i, () => <p>{u}</p>]))
    console.log(slots)
    return <Translation keypath={keypath}>
        {slots}
    </Translation>
}
const Apps 

System Info

System:                                                 
    OS: Windows 10 10.0.18362                             
    CPU: (12) x64 Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
    Memory: 2.96 GB / 31.84 GB                            
  Binaries:                                               
    Node: 16.16.0 - C:\Program Files\nodejs\node.EXE      
    Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.18362.1.0)
    Internet Explorer: 11.0.18362.1
  npmPackages:
    @vitejs/plugin-vue: ^1.9.3 => 1.9.4
    @vitejs/plugin-vue-jsx: ^1.3.0 => 1.3.0
    vite: ^2.6.4 => 2.6.14
    vue: ^3.2.37 => 3.2.37
    vue-i18n: ^9.2.0-beta.40 => 9.2.2
    vue-router: ^4 => 4.0.12
    vue-tsc: ^0.3.0 => 0.3.0

Screenshot

No response

Additional context

I noticed that the defineCompoment wrapper is Annotated, is there any possibility to make it back?

Validations

@littleboarx littleboarx added the Status: Review Needed Request for review comments label Sep 22, 2022
Copy link
Member

kazupon commented Sep 22, 2022

Thank you for your reporting!

I noticed that the defineCompoment wrapper is Annotated, is there any possibility to make it back?

Yeah, It's at the following URL and is currently being commented on. I think it can be reverted here.
https://github.com/intlify/vue-i18n-next/blob/1cbb16f2672468bce6432f2c16581ecac2cc0e83/packages/vue-i18n-core/src/components/Translation.ts#L81

However, I remember commenting it out because tree-shaking did not work well and increased vue-i18n code size 😅

If the tree-shaking issue can be resolved, I belive that defineComponent should be able to be commented out. :)

@kazupon kazupon added Status: PR Welcome Welcome to Pull Request Type: Improvement Includes backwards-compatible fixes help wanted Extra attention is needed good first issue Good for newcomers labels Sep 22, 2022 — with Volta.net
@kazupon kazupon added the 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing label Nov 15, 2022 — with Volta.net
@kazupon kazupon added ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf typescript and removed Status: Review Needed Request for review comments 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Jan 11, 2023 — with Volta.net
Copy link
Member

kazupon commented Jan 11, 2023

related #1244

Copy link
Member

kazupon commented Jan 12, 2023

I've just supported.
image.png

This fixed version will be released in v9.3.0-beta.15
If you would to use right now, we can use edge-version with npm i --save-dev vue-i18n@npm:vue-i18n-edge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf Status: PR Welcome Welcome to Pull Request Type: Improvement Includes backwards-compatible fixes typescript
Projects
None yet
2 participants