prototypey.org - atproto lexicon typescript toolkit - mirror https://github.com/tylersayshi/prototypey

generated shouldn't be in there

Tyler 525f8dca 9f6e6d82

-75
-26
generated/inferred/app/bsky/actor/defs.ts
··· 1 - // Generated by prototypey - DO NOT EDIT 2 - // Source: app.bsky.actor.defs 3 - import type { Infer } from "prototypey"; 4 - import schema from "../../../../../samples/actor-namespace.json" with { type: "json" }; 5 - 6 - /** 7 - * Type-inferred from lexicon schema: app.bsky.actor.defs 8 - */ 9 - export type Defs = Infer<typeof schema>; 10 - 11 - /** 12 - * The lexicon schema object 13 - */ 14 - export const DefsSchema = schema; 15 - 16 - /** 17 - * Type guard to check if a value is a Defs 18 - */ 19 - export function isDefs(v: unknown): v is Defs { 20 - return ( 21 - typeof v === "object" && 22 - v !== null && 23 - "$type" in v && 24 - v.$type === "app.bsky.actor.defs" 25 - ); 26 - }
-26
generated/inferred/app/bsky/actor/profile.ts
··· 1 - // Generated by prototypey - DO NOT EDIT 2 - // Source: app.bsky.actor.profile 3 - import type { Infer } from "prototypey"; 4 - import schema from "../../../../../samples/profile-namespace.json" with { type: "json" }; 5 - 6 - /** 7 - * Type-inferred from lexicon schema: app.bsky.actor.profile 8 - */ 9 - export type Profile = Infer<typeof schema>; 10 - 11 - /** 12 - * The lexicon schema object 13 - */ 14 - export const ProfileSchema = schema; 15 - 16 - /** 17 - * Type guard to check if a value is a Profile 18 - */ 19 - export function isProfile(v: unknown): v is Profile { 20 - return ( 21 - typeof v === "object" && 22 - v !== null && 23 - "$type" in v && 24 - v.$type === "app.bsky.actor.profile" 25 - ); 26 - }
-23
generated/test-generated-types.ts
··· 1 - // Test file to verify generated types work correctly 2 - import type { Profile } from "./inferred/app/bsky/actor/profile.js"; 3 - import type { Defs } from "./inferred/app/bsky/actor/defs.js"; 4 - import { isProfile } from "./inferred/app/bsky/actor/profile.js"; 5 - import { isDefs } from "./inferred/app/bsky/actor/defs.js"; 6 - 7 - // Test that the types are inferred correctly 8 - const profile: Profile = { 9 - $type: "app.bsky.actor.profile", 10 - displayName: "Tyler", 11 - description: "Building cool stuff", 12 - }; 13 - 14 - // Test type guard 15 - const unknownValue: unknown = { $type: "app.bsky.actor.defs" }; 16 - if (isDefs(unknownValue)) { 17 - // Type should be narrowed to Defs 18 - const defs: Defs = unknownValue; 19 - console.log("Is Defs:", defs.$type); 20 - } 21 - 22 - console.log("Types work! ✓"); 23 - console.log("Profile:", profile);