bluesky-social / atproto

Social networking technology created by Bluesky
Other
7.2k stars 510 forks source link

Introduce `StrictKeyOmit` #2968

Closed Andarist closed 1 week ago

Andarist commented 2 weeks ago

fixes https://github.com/bluesky-social/atproto/issues/2952

I couldn't run codegen script for some reason so I didn't regenerate the output yet. I end up with:

> @atproto/api@0.13.15 codegen /Code/atproto/packages/api
> node ./scripts/generate-code.mjs && lex gen-api --yes ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/* ../../lexicons/tools/ozone/*/*

flex: can't open gen-api

This improves type safety by omitting only the desired literal keys when index signatures are present (leaving the index signatures in place!). You can see this in action in this TS playground

matthieusieben commented 1 week ago

Thanks. I included something like this in https://github.com/bluesky-social/atproto/pull/2956