Skip to content

Add type-level inference for query, procedure, and subscription#100

Merged
tylersayshi merged 1 commit into
tylersayshi:mainfrom
jphastings:infer-queries
Apr 15, 2026
Merged

Add type-level inference for query, procedure, and subscription#100
tylersayshi merged 1 commit into
tylersayshi:mainfrom
jphastings:infer-queries

Conversation

@jphastings

Copy link
Copy Markdown
Contributor

Hey @tylersayshi, I needed inference for query, procedure, and subscription types, so thought I'd give it a crack.

I'd appreciate feedback!

const getUser = lx.lexicon("com.example.getUser", {
	main: lx.query({
		parameters: lx.params({
			did: lx.string({ required: true, format: "did" }),
		}),
		output: {
			encoding: "application/json",
			schema: lx.object({
				name: lx.string({ required: true }),
				bio: lx.string(),
			}),
		},
	}),
});

type GetUser = (typeof getUser)["~infer"];
// {
//   $type: "com.example.getUser"
//   parameters: { did: string }
//   output: { name: string; bio?: string | undefined }
// }

@tylersayshi tylersayshi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! huge thanks for continuing to share improvements here!! 🎉

@tylersayshi tylersayshi merged commit 7a0cfd8 into tylersayshi:main Apr 15, 2026
7 checks passed
@jphastings jphastings deleted the infer-queries branch April 18, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants