bluesky-social / atproto

Social networking technology created by Bluesky
Other
7.41k stars 527 forks source link

Optional properties in @atproto/api are missing `| undefined` for use with `exactOptionalPropertyTypes` #3102

Open WesSouza opened 4 days ago

WesSouza commented 4 days ago

Describe the bug

When enabling TypeScript's exactOptionalPropertyTypes, optional types marked with ? must also accept undefined as a value.

No @atproto optional allow this.

To Reproduce

https://codesandbox.io/p/sandbox/xlcg3k?file=%2Fsrc%2Findex.ts%3A10%2C16

Expected behavior

Optional properties should be expressed as:

type Example = {
  optional?: string | undefined
}

Details