You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/2025-02-14-typescript-sdk-release.md
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -161,15 +161,15 @@ For example, a "Bluesky Like" (`app.bsky.feed.like`) defines the following prope
161
161
162
162
As can be seen, the `subject` property is defined as a reference to a `com.atproto.repo.strongRef` object. In this case, there is no ambiguity as to how the `subject` of a like should be interpreted, and the `$type` property is not needed.
163
163
164
-
```javascript
164
+
```typescript
165
165
const like:AppBskyFeedLike.Record= {
166
166
$type: 'app.bsky.feed.like',
167
167
createdAt: '2021-09-01T12:34:56Z',
168
168
subject: {
169
169
// No `$type` property needed here
170
170
uri: 'at://did:plc:123/app.bsky.feed.post/456',
171
-
cid:'[...]'
172
-
}
171
+
cid: '[...]',
172
+
},
173
173
}
174
174
```
175
175
@@ -196,7 +196,7 @@ export interface Record {
196
196
197
197
In addition to preventing the _creation_ of invalid data as seen before, this change also allows properly discriminating types when _accessing_ the data. For example, one can now do:
198
198
199
-
```tsx
199
+
```typescript
200
200
import { AppBskyFeedPost } from'@atproto/api'
201
201
202
202
// Say we got some random post somehow (typically
@@ -373,9 +373,12 @@ import { AppBskyEmbedVideo } from '@atproto/api'
373
373
374
374
const embed:AppBskyEmbedVideo.Main= {
375
375
$type: 'app.bsky.embed.video',
376
-
video: { /* omitted */ }
376
+
video: {
377
+
/* omitted */
378
+
},
379
+
377
380
// Notice the typo in `alt`, not resulting in a TypeScript error
378
-
atl: 'My video'
381
+
atl: 'My video',
379
382
}
380
383
```
381
384
@@ -386,11 +389,15 @@ import { AppBskyEmbedVideo } from '@atproto/api'
0 commit comments