Skip to content

Commit 1392d57

Browse files
committed
Passing saved attributes is optional
1 parent 6aa6080 commit 1392d57

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/attachment.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ export default class Attachment {
5151
this.percent = percent
5252
}
5353

54-
saved(attributes: {id?: string | null; href?: string | null; name?: string | null}) {
54+
saved(attributes?: {id?: string | null; href?: string | null; name?: string | null}) {
5555
if (this.state !== 'pending' && this.state !== 'saving') {
5656
throw new Error(`Unexpected transition from ${this.state} to saved`)
5757
}
5858
this.state = 'saved'
59-
this.id = attributes.id
60-
this.href = attributes.href
61-
this.name = attributes.name
59+
this.id = attributes?.id
60+
this.href = attributes?.href
61+
this.name = attributes?.name
6262
}
6363

6464
isPending(): boolean {

0 commit comments

Comments
 (0)