Skip to content

Commit cff9a59

Browse files
Suggested changes
Co-authored-by: Eric Bailey <[email protected]> Co-authored-by: surfdude29 <[email protected]. github.com>
1 parent 01dbb85 commit cff9a59

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

blog/2025-02-14-typescript-sdk-release.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export interface Main {
147147
}
148148
```
149149

150-
Notice how the `$type` property is defined as optional (`?:`) here. This is due to the fact that lexicons can define schemas that can be referenced from other places than open unions. In those places, there might not be any ambiguity as to how the data should be interpreted. For example, an embed that represents a "Record With Media" has a `record` property that expects an `app.bsky.embed.record` object:
150+
Notice how the `$type` property is defined as optional (`?:`) here. This is due to the fact that lexicons can define schemas that can be referenced in places other than open unions. In those places, there might not be any ambiguity as to how the data should be interpreted. For example, an embed that represents a "Record With Media" has a `record` property that expects an `app.bsky.embed.record` object:
151151

152152
```typescript
153153
export interface Main {
@@ -247,8 +247,8 @@ export function isMain(value: unknown): values is Main {
247247

248248
That implementation of the discriminator is invalid.
249249

250-
- Fist because a `$type` is not allowed to end with `#main` ([as per AT Protocol specification](https://atproto.com/specs/lexicon#lexicon-files)).
251-
- Second because the `isMain` function does not actually check the structure of the object, only its `$type` property.
250+
- First, because a `$type` is not allowed to end with `#main` ([as per AT Protocol specification](https://atproto.com/specs/lexicon#lexicon-files)).
251+
- Second, because the `isMain` function does not actually check the structure of the object, only its `$type` property.
252252

253253
This invalid behavior could yield runtime errors that could otherwise have been avoided during development:
254254

@@ -280,11 +280,11 @@ Because this release introduces other breaking changes, and because adapting our
280280

281281
:::tip
282282

283-
In lots of cases where data needs to be discriminated, this change in the signature of the `is*` function will actually not cause any issue when upgrading the version of the SDK.
283+
In many cases where data needs to be discriminated, this change in the signature of the `is*` function won't actually cause any issues when upgrading the version of the SDK.
284284

285285
:::
286286

287-
For example, this is the case when working with data obtained from the API. Because an API is a "contract" between a server and a client, the data returned by the server is "guaranteed" to be valid. In these cases, the `is*` utility methods provide a convenient way to discriminate between valid values.
287+
For example, this is the case when working with data obtained from the API. Because an API is a "contract" between a server and a client, **the data returned by Bluesky's server APIs is "guaranteed" to be valid.** In these cases, the `is*` utility methods provide a convenient way to discriminate between valid values.
288288

289289
```typescript
290290
import { AppBskyEmbedImages } from '@atproto/api'
@@ -333,7 +333,7 @@ import { AppBskyEmbedImages } from '@atproto/api'
333333
const Images = AppBskyEmbedImages.Main
334334
const validateImages = AppBskyEmbedImages.validateMain
335335

336-
// Get some date somehow
336+
// Get some data somehow
337337
declare const data: unknown
338338

339339
// Validate the data against a particular schema (images here)

0 commit comments

Comments
 (0)