core: fix type errors

This commit is contained in:
Abdullah Atta
2025-10-04 10:21:38 +05:00
parent f67f4138c3
commit 30a02a4977
4 changed files with 12 additions and 7 deletions

View File

@@ -389,9 +389,8 @@ export class Notes implements ICollection {
const tags = (await this.db.relations.to(note, "tag").resolve()).map(
(tag) => tag.title
);
const color = (await this.db.relations.to(note, "color").resolve(1)).at(
0
)?.title;
const color = (await this.db.relations.to(note, "color").resolve(1))[0]
?.title;
return options?.disableTemplate
? contentString

View File

@@ -73,8 +73,8 @@ export class Vaults implements ICollection {
* This is temporary until we add proper support for multiple vaults
* @deprecated
*/
async default() {
return (await this.all.items()).at(0);
async default(): Promise<Vault | undefined> {
return (await this.all.items())[0];
}
get all() {

View File

@@ -674,7 +674,10 @@ export default class Backup {
}
}
const collectionKey: CollectionName = itemTypeToCollectionKey[itemType];
const collectionKey: CollectionName =
itemTypeToCollectionKey[
itemType as keyof typeof itemTypeToCollectionKey
];
if (!collectionKey) continue;
if (itemType === "color") {

View File

@@ -555,7 +555,8 @@ export type SubscriptionPlanId =
| "essential"
| "pro"
| "believer"
| "education";
| "education"
| "legacyPro";
export enum SubscriptionPlan {
FREE = 0,
@@ -678,5 +679,7 @@ export function planToId(plan: SubscriptionPlan): SubscriptionPlanId {
return "essential";
case SubscriptionPlan.PRO:
return "pro";
case SubscriptionPlan.LEGACY_PRO:
return "legacyPro";
}
}