@@ -18,7 +18,7 @@ interface UpdatedAppointmentKey {
1818export class AppointmentDataSource {
1919 protected updatedAppointmentKeys : UpdatedAppointmentKey [ ] = [ ] ;
2020
21- protected dataSource ! : DataSource ;
21+ protected dataSource ? : DataSource ;
2222
2323 protected updatedAppointment : SafeAppointment | null = null ;
2424
@@ -28,7 +28,7 @@ export class AppointmentDataSource {
2828 }
2929
3030 get keyName ( ) : string {
31- const store = this . dataSource . store ( ) ;
31+ const store = this . dataSource ? .store ( ) ;
3232 return store ?. key ( ) as string ;
3333 }
3434
@@ -37,7 +37,7 @@ export class AppointmentDataSource {
3737 }
3838
3939 private getStoreKey ( target : SafeAppointment ) : unknown {
40- const store = this . dataSource . store ( ) ;
40+ const store = this . dataSource ? .store ( ) ;
4141
4242 return store ?. keyOf ( target ) ;
4343 }
@@ -51,9 +51,9 @@ export class AppointmentDataSource {
5151
5252 private initStoreChangeHandlers ( ) : void {
5353 const { dataSource } = this ;
54- const store = dataSource . store ( ) ;
54+ const store = dataSource ? .store ( ) ;
5555
56- if ( store ) {
56+ if ( dataSource && store ) {
5757 store . on ( STORE_EVENTS . updating , ( key ) => {
5858 const keyName = store . key ( ) as string ;
5959 if ( keyName ) {
@@ -107,7 +107,7 @@ export class AppointmentDataSource {
107107
108108 add ( rawAppointment : SafeAppointment ) : DeferredObj < SafeAppointment > {
109109 // @eslint -disable-next-line
110- return this . dataSource . store ( ) . insert ( rawAppointment )
110+ return this . dataSource ! . store ( ) . insert ( rawAppointment )
111111 // @ts -expect-error
112112 . done ( ( ) => this . dataSource . load ( ) ) ;
113113 }
@@ -117,7 +117,7 @@ export class AppointmentDataSource {
117117 // @ts -expect-error
118118 const d = new Deferred ( ) ;
119119
120- this . dataSource . store ( ) . update ( key , data )
120+ this . dataSource ! . store ( ) . update ( key , data )
121121 // @ts -expect-error
122122 . done ( ( result ) => this . dataSource . load ( )
123123 // @ts -expect-error
@@ -130,13 +130,13 @@ export class AppointmentDataSource {
130130
131131 remove ( rawAppointment : SafeAppointment ) : DeferredObj < SafeAppointment | undefined > {
132132 const key = this . getStoreKey ( rawAppointment ) ;
133- return this . dataSource . store ( ) . remove ( key )
133+ return this . dataSource ! . store ( ) . remove ( key )
134134 // @ts -expect-error
135135 . done ( ( ) => this . dataSource . load ( ) ) ;
136136 }
137137
138138 destroy ( ) : void {
139- const store = this . dataSource . store ( ) ;
139+ const store = this . dataSource ? .store ( ) ;
140140
141141 if ( store ) {
142142 store . off ( STORE_EVENTS . updating ) ;
0 commit comments