a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
101
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(lexicons): add comments regarding why ObjectSchema behaves this way

Mary f0070211 480e58bb

+9
+9
packages/lexicons/lexicons/lib/validations/index.ts
··· 1203 1203 1204 1204 // #region Object schema 1205 1205 1206 + // `ObjectSchema` accepts a `LooseObjectShape` instead of `ObjectShape` to allow 1207 + // for circular references, and this means preventing TypeScript from attempting 1208 + // to eagerly evaluate the shape, unfortunate that this means we can't throw a 1209 + // type issue if you add a non-schema value into the shape though 1210 + 1206 1211 export type LooseObjectShape = Record<string, any>; 1207 1212 export type ObjectShape = Record<string, BaseSchema>; 1208 1213 ··· 1239 1244 readonly type: 'object'; 1240 1245 readonly shape: Readonly<TShape>; 1241 1246 1247 + // passing `InferObjectX` into `extends BaseSchema<...>` eagerly evaluates the 1248 + // shape, however, passing it as a property means that it's only evaluated if 1249 + // you attempt to grab the value. `InferX` is conditioned to grab from 1250 + // `kObjectType` first before going to `kType` 1242 1251 readonly [kObjectType]?: { in: InferObjectInput<TShape>; out: InferObjectOutput<TShape> }; 1243 1252 } 1244 1253