Skip to content

Commit 1965914

Browse files
committed
fix: remove optional declaration for args
1 parent 6abf9f9 commit 1965914

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
SpotifyProviderArgsSchema,
1010
NoopProviderArgsSchema,
1111
SpotifyStreamerArgs,
12+
storageKindSchema,
1213
} from './schema'
1314
import { InMemoryStorage, type IStorer } from './storage'
1415
import { SpotifyStreamer, NoopStreamer, type IStreamer, Song } from './streamers'
@@ -35,8 +36,8 @@ export class NowPlaying {
3536
this.provider = provider
3637

3738
this.parseArgs(args)
38-
this.storageKind = args.storageKind
39-
this.useCache = args.useCache
39+
this.storageKind = args.storageKind || StorageKinds.INMEMORY
40+
this.useCache = args.useCache || true
4041
this.cacheDuration = args.cacheDuration || 60000;
4142

4243
// this is whatever storage mechanic the user selects

src/schema.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ export const storageKindSchema = z.nativeEnum(StorageKinds);
1818
export type StorageKind = z.infer<typeof storageKindSchema>;
1919

2020
export const BaseNowPlayingArgsSchema = z.object({
21-
storageKind: storageKindSchema.optional().default(StorageKinds.INMEMORY),
22-
useCache: z.boolean().optional().default(true),
21+
storageKind: storageKindSchema.optional(),
22+
useCache: z.boolean().optional(),
2323
cacheDuration: z
2424
.number()
2525
.optional()
26-
.default(60 * 60 * 24),
2726
});
2827
export type BaseNowPlayingArgs = z.infer<typeof BaseNowPlayingArgsSchema>;
2928

0 commit comments

Comments
 (0)