···11+import "../dist/decorators.js";
22+33+/**
44+ * Specifies the lexicon format of a string field (e.g., "at-uri", "cid", "did", "datetime")
55+ */
66+extern dec lexFormat(target: unknown, format: valueof string);
77+88+/**
99+ * Specifies a reference to another type
1010+ */
1111+extern dec ref(target: unknown, ref: valueof string);
1212+1313+/**
1414+ * Specifies a union of referenced types (comma-separated string)
1515+ */
1616+extern dec unionRefs(target: unknown, refs: valueof string);
1717+1818+/**
1919+ * Specifies the ref for array items
2020+ */
2121+extern dec arrayItems(target: unknown, itemRef: valueof string);
···77}
8899export async function $onEmit(context: EmitContext<TypeLexEmitterOptions>) {
1010- // If user specified output-dir in options, use that directly
1111- // Otherwise use TypeSpec's default emitterOutputDir
1212- const outputDir = context.options["output-dir"]
1313- ? resolvePath(context.options["output-dir"])
1414- : context.emitterOutputDir;
1515-1610 const emitter = new TypeLexEmitter(context.program, {
1717- outputDir: outputDir,
1111+ outputDir: context.emitterOutputDir,
1812 });
19132014 await emitter.emit();
+2-3
typelex-emitter/test/fixtures.test.ts
···7171 throw new Error(`Compilation failed with errors:\n${errorMessages}`);
7272 }
73737474- // The emitter should use the program that was used during decorator execution
7575- // because that's where the decorator state is stored
7676- const emitter = new TypeLexEmitter(decoratorProgram || program, {
7474+ // Use program - but need to figure out why types are different instances
7575+ const emitter = new TypeLexEmitter(program, {
7776 outputDir: "output",
7877 });
7978
···11+import "../../../../../../lib/main.tsp";
22+33+using ATProto;
44+15namespace com.atproto.identity;
2637model IdentityInfo {
88+ @lexFormat("did")
49 did: string;
55-1010+611 @doc("The validated handle of the account; or 'handle.invalid' if the handle did not bi-directionally match the DID document.")
1212+ @lexFormat("handle")
713 handle: string;
88-1414+915 @doc("The complete DID document for the identity.")
1016 didDoc: unknown;
1117}
···11+import "@typelex/emitter";
22+33+namespace com.atproto.identity;
44+55+model IdentityInfo {
66+ @lexFormat("did")
77+ did: string;
88+99+ @doc("The validated handle of the account; or 'handle.invalid' if the handle did not bi-directionally match the DID document.")
1010+ @lexFormat("handle")
1111+ handle: string;
1212+1313+ @doc("The complete DID document for the identity.")
1414+ didDoc: unknown;
1515+}