Skip to content

Commit

Permalink
fix: removed symbol to preserve sideEffect free status (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed May 4, 2022
1 parent 2571138 commit b6302ef
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/storage/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import type {
StorageValue
} from './types';

const storage = Symbol();

/** Returns true if the provided object was created from {@link buildStorage} function. */
export const isStorage = (obj: unknown): obj is AxiosStorage =>
!!obj && !!(obj as Record<symbol, number>)[storage];
!!obj && !!(obj as Record<string, boolean>)['is-storage'];

/** Returns true if this storage is expired, but it has sufficient properties to stale. */
export function canStale(value: CachedStorageValue): boolean {
Expand Down Expand Up @@ -64,8 +62,8 @@ export type BuildStorage = Omit<AxiosStorage, 'get'> & {
*/
export function buildStorage({ set, find, remove }: BuildStorage): AxiosStorage {
return {
//@ts-expect-error - we don't want to expose this
[storage]: 1,
//@ts-expect-error - we don't want to expose thi
['is-storage']: 1,
set,
remove,
get: async (key, config) => {
Expand Down

0 comments on commit b6302ef

Please sign in to comment.