+
diff --git a/src/lib/locales/de.ts b/src/lib/locales/de.ts
index 99df4e4..5f920f1 100644
--- a/src/lib/locales/de.ts
+++ b/src/lib/locales/de.ts
@@ -394,6 +394,7 @@ const de = {
'calendar.delete.confirm.ok': 'Löschen',
'calendar.delete.success': 'Erfolgreich gelöscht',
'calendar.update.success': 'Erfolgreich aktualisiert',
+ 'calendar.update.update': 'Aktualisieren',
'settings.noneSelected': 'Wähle eine Kategorie aus',
'settings.profile': 'Profil',
@@ -432,6 +433,8 @@ const de = {
'settings.save': 'Speichern',
+ 'filter.filter': 'Filter',
+
literal: '$literal'
} as const satisfies I18nDict;
diff --git a/src/lib/locales/en.ts b/src/lib/locales/en.ts
index 0ac2181..cc2a9ad 100644
--- a/src/lib/locales/en.ts
+++ b/src/lib/locales/en.ts
@@ -384,6 +384,7 @@ const en = {
'calendar.delete.confirm.ok': 'Delete',
'calendar.delete.success': 'Successfully deleted',
'calendar.update.success': 'Successfully updated',
+ 'calendar.update.update': 'Update',
'settings.noneSelected': 'Select a category',
'settings.profile': 'Account',
@@ -420,6 +421,8 @@ const en = {
'settings.save': 'Save',
+ 'filter.filter': 'Filters',
+
literal: '$literal'
} as const satisfies I18nDict;
diff --git a/src/lib/types/math.ts b/src/lib/types/math.ts
index 9be0215..dab3981 100644
--- a/src/lib/types/math.ts
+++ b/src/lib/types/math.ts
@@ -41,7 +41,7 @@ export type SubtractOne = LastItem, 0>;
*/
export type Multiply = N extends 1
? T
- : // @ts-ignore
+ : // @ts-expect-error Isn't a number for ts (but in reality it is)
Add>>;
type PrivatePowerOf<
diff --git a/src/lib/types/strToNum.ts b/src/lib/types/strToNum.ts
index 622b4b0..1bdd3ed 100644
--- a/src/lib/types/strToNum.ts
+++ b/src/lib/types/strToNum.ts
@@ -1,3 +1,4 @@
+import type { Add, Multiply, PowerOf, SubtractOne } from '$lib/types/math';
import type { Length } from './strings';
type DigitMap = {
@@ -21,19 +22,18 @@ type FirstDigitToNum<
> = S extends `${infer First}${infer _}`
? Length extends 1
? DigitToNum
- : // @ts-ignore
- Multiply, PowerOf<10, SubtractOne>>>
+ : Multiply, PowerOf<10, SubtractOne>>>
: Result;
type PrivateNumberToString<
S extends string,
Result extends number = 0
> = S extends `${infer _}${infer Right}`
- ? // @ts-ignore
+ ? // @ts-expect-error Too deep
Add, PrivateNumberToString>
: Result;
export type NumberToString = S extends number
? S
- : //@ts-ignore
+ : //@ts-expect-error S isn't identified as a string
PrivateNumberToString;
diff --git a/src/lib/types/strings.ts b/src/lib/types/strings.ts
index 0d4cb29..2bfa9b8 100644
--- a/src/lib/types/strings.ts
+++ b/src/lib/types/strings.ts
@@ -1,3 +1,5 @@
+import type { Add } from '$lib/types/math';
+
type AddSpaces = ` ${T} `;
type Trimmed = T extends `${' ' | '\t' | '\n'}${infer R}`
? Trimmed
@@ -38,6 +40,6 @@ export type Length<
S extends string,
Result extends number = 0
> = S extends `${infer _}${infer Right}`
- ? // @ts-ignore
+ ? // @ts-expect-error Add<> isn't a number
Length>
: Result;
diff --git a/src/lib/utils/url/query.test.ts b/src/lib/utils/url/query.test.ts
new file mode 100644
index 0000000..877db08
--- /dev/null
+++ b/src/lib/utils/url/query.test.ts
@@ -0,0 +1,23 @@
+import { objToQueryParams } from '$lib/utils/url/query';
+import { describe, it, expect } from 'vitest';
+
+describe('object to query params', () => {
+ it('converts a Record', () => {
+ expect(objToQueryParams({})).toBe('');
+ expect(objToQueryParams({ key: 'value' })).toBe('key=value');
+ expect(objToQueryParams({ key: 'value', key2: 'value2' })).toBe('key=value&key2=value2');
+ expect(objToQueryParams({ key: 'value', key2: 42 })).toBe('key=value&key2=42');
+ });
+ it('converts a handles null', () => {
+ expect(objToQueryParams({ key: null })).toBe('');
+ expect(objToQueryParams({ key: 'value', key2: 'value2' })).toBe('key=value&key2=value2');
+ expect(objToQueryParams({ key: 'value', key2: null })).toBe('key=value');
+ });
+ it('converrts a Record>', () => {
+ const obj = { key: { key: { key: { key: [4, 2.42, { key: { value: 'hi' } }] } } } };
+
+ expect(objToQueryParams({ key: obj, key2: 'value2' })).toBe(
+ `key=${encodeURIComponent(JSON.stringify(obj))}&key2=value2`
+ );
+ });
+});
diff --git a/src/lib/utils/url/query.ts b/src/lib/utils/url/query.ts
index 0454e65..fa1aaa9 100644
--- a/src/lib/utils/url/query.ts
+++ b/src/lib/utils/url/query.ts
@@ -1,5 +1,3 @@
-// TODO: Write unit test
-
type Convertable = string | number | null | Record;
export const objToQueryParams = (obj: Record) => {