在从 TS6 升级到 TS7 后,出现不正确的 TS4094 错误"导出匿名类型可能不是私有"
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.tswould have the private field types from the class declaration inzod-route-schemas.
Expected behavior
内容来源: microsoft/TypeScript