-
Notifications
You must be signed in to change notification settings - Fork 764
Getting error then importing type InputProps after update to v3.1 #3973
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
Comments
Same thing, but for |
Same for every components I think ? |
Same here with FormField type:
|
I had the same problem for ButtonProps, this worked for me :
I still believe this should be fixed as nuxi/ui docs seems to indicate it should work. |
Ignoring the error is a temporary solution but yeah, it's need to be fixed. I'll try to find what's going on between v3.0.2 and v3.1.0 |
Looks like it might have something to do with the switch of |
This could be fixed by #4023. You can try this version: |
@benjamincanac thanks for your PR but don't work on my side. Same error
|
I'm having a hard-time reproducing this, when downloading the sandbox @Artemiy111 it seems the lockfile is broken but besides that everything works fine 😬 |
Do you all have |
I just installed "@nuxt/ui": "https://pkg.pr.new/@nuxt/ui@df83ab3",
"typescript": "5.8.3",
"vue-tsc": "2.0.10" I'm getting the same error
|
@benjamincanac can you observe the error in this code sandbox when running This is the I've installed The same project works with |
I see the error when running (Currently on mobile, otherwise I'd share a screenshot as well) |
It's just a test, I don't have high hopes for this but can you try |
I got the same issue trying The issue occurs when you execute
|
I create a minimal reproduction here too: https://stackblitz.com/~/github.com/albertcito/ui-3-error?file=app/pages/index.vue&file=app/components/form/group/index.vue ![]() |
I've updated the Code Sandbox to have a running This is the output, which is same as I'm observing locally when running the dev server. Additionally here is a blank |
For resolving this issue, it maybe necessary to extract types (ButtonProps, XxxProps, XxxEmits, etc...) to external TS files. defineProps, defineEmits, etc, are typescript macros, theses macro CANNOT resolve types directly defined in (another) For testing, I have made a fork with extracting Button and Link Props / Emit. (because LinkProps are nested imported by Button). I beleave that all elements defined in <script lang="ts">...</script> must be in ts file, and imported in <script setup lang="ts">...</script> After this, importing (and using it) XxxProps / XxxEmits are OK import type { ButtonProps } from '@nuxt/ui';
const props = defineProps<ButtonProps>(); // OK ! It's just for testing, I haven't optimized imports, exports, theme, etc... |
@Dodobibi Did you check how the package is built? There are already |
yes, it work with import type { ModalProps } from '@nuxt/ui/runtime/components/Modal.vue.d.ts'; // <-- full path here
const props = defineProps<ModalProps >(); // OK ! But fail with import type { LinkProps } from './Link.vue'; // <-- vue, NOT .vue.d.ts (line 3 of your screenshot) import type { ButtonProps} from '@nuxt/ui/runtime/components/Button.vue.d.ts'; // <-- full path here
const props = defineProps<ButtonProps>(); // NOT OK ! It work if we force .d.ts in source code import type { LinkProps } from './Link.vue.d.ts'; // <-- .d.ts Then import type { ButtonProps} from '@nuxt/ui/runtime/components/Button.vue.d.ts'; // <-- full path here
const props = defineProps<ButtonProps>(); // NOW OK ! But |
Same problem after update from 3.0.1 to 3.1.1. |
I'm still studying this but this might be an upstream issue based on the new module-builder, which we are using since it is an issue about how declaration types are exported from the module, tho I'm also failing to use proper typescript syntax (a bit more info here) will update as I discover things |
Environment
Is this bug related to Nuxt or Vue?
Nuxt
Version
v3.1
Reproduction
https://codesandbox.io/p/devbox/stoic-mopsa-t44pzq
Description
It was working as intended before update.
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: