'DEFAULT_EXTENSIONS' is referenced directly or indirectly in its own type annotation. #476
-
Hi 👋 https://stackblitz.com/edit/vitejs-vite-xz8eex?file=src%2Fcounter.ts I don't understand why this is happening. This isn't an issue with Valibot because the same thing happens with Zod too. I found this #98 but I don't know what to do. |
Beta Was this translation helpful? Give feedback.
Answered by
fabian-hiller
Mar 10, 2024
Replies: 1 comment
-
The problem is that you are defining a type with itself. The interdependency cannot be resolved by the TypeScript language server. Here is a simple fix: import * as v from 'valibot';
const abc: string[] = ['.svelte.md'];
const ConfigSchema = v.optional(
v.object({
extensions: v.optional(
v.array(v.string([v.regex(/^\.[a-z]+(\.[a-z]+)?$/)]), [v.minLength(1)]),
abc
),
}),
{}
);
type Config = v.Output<typeof ConfigSchema>; |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
fabian-hiller
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is that you are defining a type with itself. The interdependency cannot be resolved by the TypeScript language server. Here is a simple fix: