-
Notifications
You must be signed in to change notification settings - Fork 31
Module build results in "error TS2307: Cannot find module or its corresponding type declarations." #519
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
Stackblitz link for the reproduction: Stackblitz |
The issue here is likely caused by you exporting those types from your module entrypoint. (However they should be treated as externals and not resolved further, so I regard it as a bug.) |
@danielroe Yes, I want to use those types in the application that uses that module. Isn't it correct to export those types in the module entrypoint? |
Funnily enough, I'm having this exact problem in nuxt/ui#3479 only windows side. EDIT: import type { StandardSchemaV1 } from '@standard-schema/spec'
// ... unrelated vue imports
import type { ZodSchema } from 'zod'
import type { Schema as JoiSchema } from 'joi'
import type { ObjectSchema as YupObjectSchema } from 'yup'
import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot'
// ... unrelated util imports
import type { Struct as SuperstructSchema } from 'superstruct'
// ...
export type FormSchema<T extends object> =
| ZodSchema
| YupObjectSchema<T>
| ValibotSchema
| ValibotSchemaAsync
| ValibotSafeParser<any, any>
| ValibotSafeParserAsync<any, any>
| JoiSchema<T>
| SuperstructSchema<any, any>
| StandardSchemaV1
// ... Each package will trigger its own one (taking in example ERROR Expected ';', '}' or <eof> in A:\github\nuxt\ui\node_modules\.pnpm\@[email protected]\node_modules\@standard-schema\spec\dist\index.d.ts |
Environment
Reproduction
https://github.com/prof-schnitzel/nuxt-ts-bug-module/tree/main
Describe the bug
In my
module.ts
I have added the lineexport type * from './runtime/types'
so that my nuxt module exports types that can be used in a consumer app. In the types file I only have this line:export * from '../components/MyDiv.vue'
. But when runningnpm run prepack
I get the errorsrc/runtime/types/index.ts(1,15): error TS2307: Cannot find module '../components/MyDiv.vue' or its corresponding type declarations.
Why? This seems to be a bug to me.Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: