Skip to content

Commit e7a69ad

Browse files
committed
Fix compiler type (resolve #1689)
1 parent e503d10 commit e7a69ad

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

packages/knip/src/schema/configuration.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { z } from 'zod/mini';
2+
import type { CompilerAsync, CompilerSync } from '../compilers/types.ts';
23
import { SYMBOL_TYPE } from '../constants.ts';
34
import { globSchema, pluginsSchema } from './plugins.ts';
45

56
const pathsSchema = z.record(z.string(), z.array(z.string()));
67

7-
type SyncCompiler = (filename: string, contents: string) => string;
8-
type AsyncCompiler = (filename: string, contents: string) => Promise<string>;
9-
10-
const syncCompilerSchema = z.union([z.literal(true), z.custom<SyncCompiler>()]);
11-
const asyncCompilerSchema = z.custom<AsyncCompiler>();
8+
const syncCompilerSchema = z.union([z.literal(true), z.custom<CompilerSync>()]);
9+
const asyncCompilerSchema = z.custom<CompilerAsync>();
1210
const compilerSchema = z.union([syncCompilerSchema, asyncCompilerSchema]);
1311
const compilersSchema = z.record(z.string(), compilerSchema);
1412

0 commit comments

Comments
 (0)