velite icon indicating copy to clipboard operation
velite copied to clipboard

Issue about missing types exported

Open hackardoX opened this issue 8 months ago • 0 comments

Hi @zce, first of all thanks for the work you did for velite. I really like the project, and I am trying to build my blog with it.

Problem

I encountered an issue when defining the velite.config.ts. When I export the default config (excerpt):

const posts = defineCollection({
	name: "Post",
	pattern: "posts/**/*.md",
	schema: s
		.object({
			// ...
		})
});

export default defineConfig({
	root: "content",
	strict: true,
	output: {
		data: ".velite",
		clean: true,
	},
	collections: { posts },
});

I have the following errors related to the defineConfig line:

Default export of the module has or is using private name 'ParseContext'.ts(4082)
Default export of the module has or is using private name 'RefinementCtx'.ts(4082)
Default export of the module has or is using private name 'ZodCustomIssue'.ts(4082)
Default export of the module has or is using private name 'ZodEffectsDef'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidArgumentsIssue'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidDateIssue'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidEnumValueIssue'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidIntersectionTypesIssue'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidLiteralIssue'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidReturnTypeIssue'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidStringIssue'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidTypeIssue'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidUnionDiscriminatorIssue'.ts(4082)
Default export of the module has or is using private name 'ZodInvalidUnionIssue'.ts(4082)
Default export of the module has or is using private name 'ZodNotFiniteIssue'.ts(4082)
Default export of the module has or is using private name 'ZodNotMultipleOfIssue'.ts(4082)
Default export of the module has or is using private name 'ZodOptionalDef'.ts(4082)
Default export of the module has or is using private name 'ZodTooBigIssue'.ts(4082)
Default export of the module has or is using private name 'ZodTooSmallIssue'.ts(4082)
Default export of the module has or is using private name 'ZodTypeDef'.ts(4082)
Default export of the module has or is using private name 'ZodUnrecognizedKeysIssue'.ts(4082)
Property '_cached' of exported anonymous class type may not be private or protected.ts(4094)
The type of this node cannot be serialized because its property '[iterator]' cannot be serialized.ts(4118)
The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.ts(7056)

Temporary Solution

The issue is related to the fact that typescript is generating the declaration. As workaround, I currently disabled the generation of declaration files, in my tsconfig.json:

{
...
  "compilerOptions": {
    "declaration": false,
    "declarationMap": false,
  },
...
}

hackardoX avatar Aug 24 '25 06:08 hackardoX