-
Notifications
You must be signed in to change notification settings - Fork 27
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
error TS2742: The inferred type of 'default' cannot be named without a reference #141
Comments
@danielroe It seems to be related to this ticket egoist/tsup#624 |
Running |
Facing the same issue with custom interfaces |
I think there is a way we can solve this within Something like this would likely work... + import type {} from 'myPackage'
import { defineNuxtPlugin, useAppConfig } from "#imports";
export default defineNuxtPlugin(() => {
return {
provide: {
backend: useAppConfig().endpoints,
},
};
}); See microsoft/TypeScript#58176 (comment) for more about why this is happening. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm having the same issue with a custom useFetch import { useFetch, useNuxtApp, type UseFetchOptions } from '#app'
import type {} from 'ofetch'
import type {} from 'nuxt/app' // doesn't work
type Wrapper<T> = { data: T }
export function useApiFetch<T>(url: string | (() => string), options: UseFetchOptions<T> = {}) {
return useFetch<Wrapper<T>>(url, {
$fetch: useNuxtApp().$fetch as typeof $fetch,
transform: res => res.data as T,
lazy: true,
...options,
})
} When i run prepack i get the following error:
By adding
I don't understand what kind of type should import |
@dnldsht you can probably get away with the approach in this comment here, that uses I am facing a similar issue tho trying to make a composable that extends opts and returns. |
I am facing the same issue on https://github.com/Tresjs/nuxt after bumping the deps.
|
@alvarosabu The issue you are facing is superficially similar but in fact vuejs/language-tools#5018. You can downgrade/pin your typescript version to ~5.6 to resolve. |
Thanks, @danielroe, I confirm downgrading to |
* Support Nuxt 3.15, @vitejs/plugin-legacy 6.0 * Add changeset * Downgrade typescript, fix module build See nuxt/module-builder#141 --------- Co-authored-by: Ilya Semenov <[email protected]>
Do we know if this was fixed? do we need to bump the deps in this repo to close this? |
This should be resolved in most cases with v1 of module-builder - there are still a few pending PRs in |
Im trying to
pnpm prepack
a nuxt3 module with a package which exports a simple object and its types file.1 - In the
playground/node_modules/myPackage/dist
index.d.ts :
index.js :
2 - In the
playground/app.config.ts
3 - In the module,
src/runtime/plugin.ts
:Then, i run
pnpm prepack
and i always have this error :And the error disappears if i replace the code in the
playground/node_modules/myPackage/dist
by this one :The text was updated successfully, but these errors were encountered: