Strongly typed config (and ts strict mode)
This commit is contained in:
parent
36c05556e5
commit
4585f60af7
7 changed files with 31 additions and 16 deletions
11
src/config.ts
Normal file
11
src/config.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import rawconfig from "../config.json" with {type: "json"};
|
||||
import {z} from 'zod';
|
||||
const configT = z.object({
|
||||
token: z.string(),
|
||||
listenbrainzAccount: z.string(),
|
||||
gitapi: z.string(),
|
||||
});
|
||||
export type Config = z.infer<typeof configT>;
|
||||
export const config: Config = configT.parse(rawconfig);
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue