fix: use definite assignment assertion operator

We used declare which is the wrong use-case for this. See: https://www.typescriptlang.org/docs/handbook/2/classes.html#--strictpropertyinitialization
This commit is contained in:
Dominik Pschenitschni 2022-08-13 15:38:41 +02:00
parent 041a1a4cc0
commit 96f5f00c07
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
33 changed files with 130 additions and 130 deletions

View file

@ -11,8 +11,8 @@ export interface IAttachment extends AbstractModel {
} }
export default class AttachmentModel extends AbstractModel implements IAttachment { export default class AttachmentModel extends AbstractModel implements IAttachment {
declare id: number id!: number
declare taskId: number taskId!: number
createdBy: IUser createdBy: IUser
file: IFile file: IFile
created: Date created: Date

View file

@ -7,7 +7,7 @@ export interface IAvatar extends AbstractModel {
} }
export default class AvatarModel extends AbstractModel implements IAvatar { export default class AvatarModel extends AbstractModel implements IAvatar {
declare avatarProvider: AvatarProvider avatarProvider!: AvatarProvider
defaults() { defaults() {
return { return {

View file

@ -12,14 +12,14 @@ export interface IBackgroundImage extends AbstractModel {
} }
export default class BackgroundImageModel extends AbstractModel implements IBackgroundImage { export default class BackgroundImageModel extends AbstractModel implements IBackgroundImage {
declare id: number id!: number
declare url: string url!: string
declare thumb: string thumb!: string
declare info: { info!: {
author: string author: string
authorName: string authorName: string
} }
declare blurHash: string blurHash!: string
defaults() { defaults() {
return { return {

View file

@ -17,13 +17,13 @@ export interface IBucket extends AbstractModel {
} }
export default class BucketModel extends AbstractModel implements IBucket { export default class BucketModel extends AbstractModel implements IBucket {
declare id: number id!: number
declare title: string title!: string
declare listId: number listId!: number
declare limit: number limit!: number
declare tasks: ITask[] tasks!: ITask[]
declare isDoneBucket: boolean isDoneBucket!: boolean
declare position: number position!: number
createdBy: IUser createdBy: IUser
created: Date created: Date

View file

@ -6,8 +6,8 @@ export interface ICaldavToken extends AbstractModel {
} }
export default class CaldavTokenModel extends AbstractModel implements ICaldavToken { export default class CaldavTokenModel extends AbstractModel implements ICaldavToken {
declare id: number id!: number
declare created: Date created!: Date
constructor(data? : Object) { constructor(data? : Object) {
super(data) super(data)

View file

@ -6,8 +6,8 @@ interface IEmailUpdate extends AbstractModel {
} }
export default class EmailUpdateModel extends AbstractModel implements IEmailUpdate { export default class EmailUpdateModel extends AbstractModel implements IEmailUpdate {
declare newEmail: string newEmail!: string
declare password: string password!: string
defaults() { defaults() {
return { return {

View file

@ -9,10 +9,10 @@ export interface IFile extends AbstractModel {
} }
export default class FileModel extends AbstractModel implements IFile { export default class FileModel extends AbstractModel implements IFile {
declare id: number id!: number
declare mime: string mime!: string
declare name: string name!: string
declare size: number size!: number
created: Date created: Date
constructor(data) { constructor(data) {

View file

@ -18,13 +18,13 @@ export interface ILabel extends AbstractModel {
} }
export default class LabelModel extends AbstractModel implements ILabel { export default class LabelModel extends AbstractModel implements ILabel {
declare id: number id!: number
declare title: string title!: string
declare hexColor: string hexColor!: string
declare description: string description!: string
declare createdBy: IUser createdBy!: IUser
declare listId: number listId!: number
declare textColor: string textColor!: string
created: Date created: Date
updated: Date updated: Date

View file

@ -7,9 +7,9 @@ export interface ILabelTask extends AbstractModel {
} }
export default class LabelTask extends AbstractModel implements ILabelTask { export default class LabelTask extends AbstractModel implements ILabelTask {
declare id: number id!: number
declare taskId: number taskId!: number
declare labelId: number labelId!: number
defaults() { defaults() {
return { return {

View file

@ -16,14 +16,14 @@ export interface ILinkShare extends AbstractModel {
} }
export default class LinkShareModel extends AbstractModel implements ILinkShare { export default class LinkShareModel extends AbstractModel implements ILinkShare {
declare id: number id!: number
declare hash: string hash!: string
declare right: Right right!: Right
sharedBy: IUser sharedBy: IUser
declare sharingType: number // FIXME: use correct numbers sharingType!: number // FIXME: use correct numbers
declare listId: number listId!: number
declare name: string name!: string
declare password: string password!: string
created: Date created: Date
updated: Date updated: Date

View file

@ -27,20 +27,20 @@ export interface IList extends AbstractModel {
} }
export default class ListModel extends AbstractModel implements IList { export default class ListModel extends AbstractModel implements IList {
declare id: number id!: number
declare title: string title!: string
declare description: string description!: string
owner: IUser owner: IUser
tasks: ITask[] tasks: ITask[]
declare namespaceId: INamespace['id'] namespaceId!: INamespace['id']
declare isArchived: boolean isArchived!: boolean
declare hexColor: string hexColor!: string
declare identifier: string identifier!: string
declare backgroundInformation: any backgroundInformation!: any
declare isFavorite: boolean isFavorite!: boolean
declare subscription: ISubscription subscription!: ISubscription
declare position: number position!: number
declare backgroundBlurHash: string backgroundBlurHash!: string
created: Date created: Date
updated: Date updated: Date

View file

@ -9,8 +9,8 @@ export interface IListDuplicate extends AbstractModel {
} }
export default class ListDuplicateModel extends AbstractModel implements IListDuplicate { export default class ListDuplicateModel extends AbstractModel implements IListDuplicate {
declare listId: number listId!: number
declare namespaceId: INamespace['id'] namespaceId!: INamespace['id']
list: IList list: IList
constructor(data) { constructor(data) {

View file

@ -18,14 +18,14 @@ export interface INamespace extends AbstractModel {
} }
export default class NamespaceModel extends AbstractModel implements INamespace { export default class NamespaceModel extends AbstractModel implements INamespace {
declare id: number id!: number
declare title: string title!: string
declare description: string description!: string
owner: IUser owner: IUser
lists: IList[] lists: IList[]
declare isArchived: boolean isArchived!: boolean
declare hexColor: string hexColor!: string
declare subscription: ISubscription subscription!: ISubscription
created: Date created: Date
updated: Date updated: Date

View file

@ -51,10 +51,10 @@ export interface INotification extends AbstractModel {
} }
export default class NotificationModel extends AbstractModel implements INotification { export default class NotificationModel extends AbstractModel implements INotification {
declare id: number id!: number
declare name: string name!: string
declare notification: NotificationTask | NotificationAssigned | NotificationDeleted | NotificationCreated | NotificationMemberAdded notification!: NotificationTask | NotificationAssigned | NotificationDeleted | NotificationCreated | NotificationMemberAdded
declare read: boolean read!: boolean
readAt: Date | null readAt: Date | null
created: Date created: Date

View file

@ -8,8 +8,8 @@ export interface IPasswordReset extends AbstractModel {
export default class PasswordResetModel extends AbstractModel implements IPasswordReset { export default class PasswordResetModel extends AbstractModel implements IPasswordReset {
token: string token: string
declare newPassword: string newPassword!: string
declare email: string email!: string
constructor(data) { constructor(data) {
super(data) super(data)

View file

@ -6,8 +6,8 @@ export interface IPasswordUpdate extends AbstractModel {
} }
export default class PasswordUpdateModel extends AbstractModel implements IPasswordUpdate { export default class PasswordUpdateModel extends AbstractModel implements IPasswordUpdate {
declare newPassword: string newPassword!: string
declare oldPassword: string oldPassword!: string
defaults() { defaults() {
return { return {

View file

@ -21,10 +21,10 @@ export interface ISavedFilter extends AbstractModel {
} }
export default class SavedFilterModel extends AbstractModel implements ISavedFilter { export default class SavedFilterModel extends AbstractModel implements ISavedFilter {
declare id: 0 id!: 0
declare title: string title!: string
declare description: string description!: string
declare filters: { filters!: {
sortBy: ('done' | 'id')[] sortBy: ('done' | 'id')[]
orderBy: ('asc' | 'desc')[] orderBy: ('asc' | 'desc')[]
filterBy: 'done'[] filterBy: 'done'[]

View file

@ -11,9 +11,9 @@ export interface ISubscription extends AbstractModel {
} }
export default class SubscriptionModel extends AbstractModel implements ISubscription { export default class SubscriptionModel extends AbstractModel implements ISubscription {
declare id: number id!: number
declare entity: string // FIXME: correct type? entity!: string // FIXME: correct type?
declare entityId: number // FIXME: correct type? entityId!: number // FIXME: correct type?
user: IUser user: IUser
created: Date created: Date

View file

@ -63,39 +63,39 @@ export interface ITask extends AbstractModel {
export default class TaskModel extends AbstractModel implements ITask { export default class TaskModel extends AbstractModel implements ITask {
id: number id: number
title: string title: string
declare description: string description!: string
declare done: boolean done!: boolean
doneAt: Date | null doneAt: Date | null
declare priority: Priority priority!: Priority
labels: ILabel[] labels: ILabel[]
assignees: IUser[] assignees: IUser[]
dueDate: Date | null dueDate: Date | null
startDate: Date | null startDate: Date | null
endDate: Date | null endDate: Date | null
declare repeatAfter: number | IRepeats repeatAfter!: number | IRepeats
declare repeatFromCurrentDate: boolean repeatFromCurrentDate!: boolean
declare repeatMode: TaskRepeatMode repeatMode!: TaskRepeatMode
reminderDates: Date[] reminderDates: Date[]
declare parentTaskId: ITask['id'] parentTaskId!: ITask['id']
declare hexColor: string hexColor!: string
declare percentDone: number percentDone!: number
declare relatedTasks: { [relationKind: string]: ITask } // FIXME: use relationKinds relatedTasks!: { [relationKind: string]: ITask } // FIXME: use relationKinds
attachments: IAttachment[] attachments: IAttachment[]
declare identifier: string identifier!: string
declare index: number index!: number
declare isFavorite: boolean isFavorite!: boolean
declare subscription: ISubscription subscription!: ISubscription
declare position: number position!: number
declare kanbanPosition: number kanbanPosition!: number
createdBy: IUser createdBy: IUser
created: Date created: Date
updated: Date updated: Date
listId: IList['id'] // Meta, only used when creating a new task listId: IList['id'] // Meta, only used when creating a new task
declare bucketId: IBucket['id'] bucketId!: IBucket['id']
constructor(data: Partial<ITask>) { constructor(data: Partial<ITask>) {
super(data) super(data)

View file

@ -10,8 +10,8 @@ export interface ITaskAssignee extends AbstractModel {
export default class TaskAssigneeModel extends AbstractModel implements ITaskAssignee { export default class TaskAssigneeModel extends AbstractModel implements ITaskAssignee {
created: Date created: Date
declare userId: IUser['id'] userId!: IUser['id']
declare taskId: ITask['id'] taskId!: ITask['id']
constructor(data) { constructor(data) {
super(data) super(data)

View file

@ -13,9 +13,9 @@ export interface ITaskComment extends AbstractModel {
} }
export default class TaskCommentModel extends AbstractModel implements ITaskComment { export default class TaskCommentModel extends AbstractModel implements ITaskComment {
declare id: number id!: number
declare taskId: ITask['id'] taskId!: ITask['id']
declare comment: string comment!: string
author: IUser author: IUser
created: Date created: Date

View file

@ -30,10 +30,10 @@ export interface ITaskRelation extends AbstractModel {
} }
export default class TaskRelationModel extends AbstractModel implements ITaskRelation { export default class TaskRelationModel extends AbstractModel implements ITaskRelation {
declare id: number id!: number
declare otherTaskId: ITask['id'] otherTaskId!: ITask['id']
declare taskId: ITask['id'] taskId!: ITask['id']
declare relationKind: RelationKind relationKind!: RelationKind
createdBy: IUser createdBy: IUser
created: Date created: Date

View file

@ -16,11 +16,11 @@ export interface ITeam extends AbstractModel {
} }
export default class TeamModel extends AbstractModel implements ITeam { export default class TeamModel extends AbstractModel implements ITeam {
declare id: number id!: number
declare name: string name!: string
declare description: string description!: string
members: ITeamMember[] members: ITeamMember[]
declare right: Right right!: Right
createdBy: IUser createdBy: IUser
created: Date created: Date

View file

@ -6,7 +6,7 @@ export interface ITeamList extends TeamShareBaseModel {
} }
export default class TeamListModel extends TeamShareBaseModel implements ITeamList { export default class TeamListModel extends TeamShareBaseModel implements ITeamList {
declare listId: IList['id'] listId!: IList['id']
defaults() { defaults() {
return { return {

View file

@ -7,8 +7,8 @@ export interface ITeamMember extends UserModel {
} }
export default class TeamMemberModel extends UserModel implements ITeamMember { export default class TeamMemberModel extends UserModel implements ITeamMember {
declare admin: boolean admin!: boolean
declare teamId: IList['id'] teamId!: IList['id']
defaults() { defaults() {
return { return {

View file

@ -6,7 +6,7 @@ export interface ITeamNamespace extends TeamShareBaseModel {
} }
export default class TeamNamespaceModel extends TeamShareBaseModel implements ITeamNamespace { export default class TeamNamespaceModel extends TeamShareBaseModel implements ITeamNamespace {
declare namespaceId: INamespace['id'] namespaceId!: INamespace['id']
defaults() { defaults() {
return { return {

View file

@ -15,8 +15,8 @@ export interface ITeamShareBase extends AbstractModel {
* It is extended in a way so it can be used for namespaces as well for lists. * It is extended in a way so it can be used for namespaces as well for lists.
*/ */
export default class TeamShareBaseModel extends AbstractModel implements ITeamShareBase { export default class TeamShareBaseModel extends AbstractModel implements ITeamShareBase {
declare teamId: ITeam['id'] teamId!: ITeam['id']
declare right: Right right!: Right
created: Date created: Date
updated: Date updated: Date

View file

@ -7,9 +7,9 @@ export interface ITotp extends AbstractModel {
} }
export default class TotpModel extends AbstractModel implements ITotp{ export default class TotpModel extends AbstractModel implements ITotp{
declare secret: string secret!: string
declare enabled: boolean enabled!: boolean
declare url: string url!: string
defaults() { defaults() {
return { return {

View file

@ -13,10 +13,10 @@ export interface IUser extends AbstractModel {
} }
export default class UserModel extends AbstractModel implements IUser { export default class UserModel extends AbstractModel implements IUser {
declare id: number id!: number
declare email: string email!: string
declare username: string username!: string
declare name: string name!: string
created: Date created: Date
updated: Date updated: Date

View file

@ -7,7 +7,7 @@ export interface IUserList extends UserShareBaseModel {
// This class extends the user share model with a 'rights' parameter which is used in sharing // This class extends the user share model with a 'rights' parameter which is used in sharing
export default class UserListModel extends UserShareBaseModel implements IUserList { export default class UserListModel extends UserShareBaseModel implements IUserList {
declare listId: IList['id'] listId!: IList['id']
defaults() { defaults() {
return { return {

View file

@ -7,7 +7,7 @@ export interface IUserNamespace extends UserShareBaseModel {
// This class extends the user share model with a 'rights' parameter which is used in sharing // This class extends the user share model with a 'rights' parameter which is used in sharing
export default class UserNamespaceModel extends UserShareBaseModel implements IUserNamespace { export default class UserNamespaceModel extends UserShareBaseModel implements IUserNamespace {
declare namespaceId: INamespace['id'] namespaceId!: INamespace['id']
defaults() { defaults() {
return { return {

View file

@ -14,14 +14,14 @@ export interface IUserSettings extends AbstractModel {
} }
export default class UserSettingsModel extends AbstractModel implements IUserSettings { export default class UserSettingsModel extends AbstractModel implements IUserSettings {
declare name: string name!: string
declare emailRemindersEnabled: boolean emailRemindersEnabled!: boolean
declare discoverableByName: boolean discoverableByName!: boolean
declare discoverableByEmail: boolean discoverableByEmail!: boolean
declare overdueTasksRemindersEnabled: boolean overdueTasksRemindersEnabled!: boolean
declare defaultListId: undefined | IList['id'] defaultListId!: undefined | IList['id']
declare weekStart: 0 | 1 | 2 | 3 | 4 | 5 | 6 weekStart!: 0 | 1 | 2 | 3 | 4 | 5 | 6
declare timezone: string timezone!: string
defaults() { defaults() {
return { return {

View file

@ -11,8 +11,8 @@ export interface IUserShareBase extends AbstractModel {
} }
export default class UserShareBaseModel extends AbstractModel implements IUserShareBase { export default class UserShareBaseModel extends AbstractModel implements IUserShareBase {
declare userId: IUser['id'] userId!: IUser['id']
declare right: Right right!: Right
created: Date created: Date
updated: Date updated: Date