#64249·TypeScript

在从 TS6 升级到 TS7 后,出现不正确的 TS4094 错误"导出匿名类型可能不是私有"

作者: jedwards1211创建于 2026年9月12日更新于 2026年9月14日
标签Needs Investigation

tsc src/index.ts:4:14 - error TS4094: Property 'parts' of exported anonymous class type may not be private or protected. 4 export const organization = new ZodRoute( ~~~~~~~~~~~~ src/index.ts:4:14 - Add a type annotation to the variable organization. 4 export const organization = new ZodRoute( ~~~~~~~~~~~~ src/index.ts:4:14 - error TS4094: Property 'typeHints' of exported anonymous class type may not be private or protected. 4 export const organization = new ZodRoute( ~~~~~~~~~~~~ src/index.ts:4:14 - Add a type annotation to the variable organization. 4 export const organization = new ZodRoute( ~~~~~~~~~~~~ I don't see what the problem is here, because as you can see below, the generated .d.ts would have the private field types from the class declaration in zod-route-schemas.

Expected behavior

内容来源: microsoft/TypeScript