Skip to content

Commit

Permalink
fix: update clearStorage method
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedorrychkov committed Jan 23, 2024
1 parent f8b7d3a commit a395c97
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/telegram/scenarios/scenarios.storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StorageEntity } from './scenarios.types'

@Injectable()
export class ScenariosStorage {
private store: Record<StorageEntity, Record<string, unknown> | null | undefined>
private store: Record<StorageEntity, Record<string, unknown> | null | undefined> | undefined
private lastUsedEntity: StorageEntity | undefined

constructor() {
Expand Down Expand Up @@ -44,8 +44,8 @@ export class ScenariosStorage {

private _clearEntities(entity: StorageEntity) {
Object.values(StorageEntity).forEach((key: StorageEntity) => {
if (key !== entity) {
this.store[key as StorageEntity] = null
if (key !== entity && this.store?.[key]) {
this.store[key] = null
}
})
}
Expand Down

0 comments on commit a395c97

Please sign in to comment.