mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-18 23:04:30 +08:00
## Description
Replaces raw JSON parsing with schema-based validation across frontend
TypeScript files to improve type safety and error handling.
### Scope of Changes
- Updated JSON parsing in:
- `account.ts`
- `import-export-settings.ts`
- `analytics-controller.ts`
- `local-storage-with-schema.ts`
- `url-handler.ts`
- `commandline/lists.ts`
- `test/wikipedia.ts`
- Added schema in `test/custom-text.ts`:
```typescript
export const customTextDataSchema = z.object({
text: z.array(z.string()),
mode: CustomTextModeSchema,
limit: z.object({
value: z.number(),
mode: CustomTextLimitModeSchema
}),
pipeDelimiter: z.boolean(),
});
```
### Benefits
- Enhanced runtime type safety
- More robust error handling
- Consistent JSON parsing approach
### Checks
- [x] Follows Conventional Commits
- [x] Includes GitHub username
- [ ] Adding quotes? (N/A)
- [ ] Adding language/theme? (N/A)
---------
Co-authored-by: Miodec <jack@monkeytype.com>
|
||
|---|---|---|
| .. | ||
| contracts | ||
| esbuild-config | ||
| eslint-config | ||
| funbox | ||
| release | ||
| typescript-config | ||
| util | ||