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 {
declare id: number
declare taskId: number
id!: number
taskId!: number
createdBy: IUser
file: IFile
created: Date

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@ export interface ITeamNamespace extends TeamShareBaseModel {
}
export default class TeamNamespaceModel extends TeamShareBaseModel implements ITeamNamespace {
declare namespaceId: INamespace['id']
namespaceId!: INamespace['id']
defaults() {
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.
*/
export default class TeamShareBaseModel extends AbstractModel implements ITeamShareBase {
declare teamId: ITeam['id']
declare right: Right
teamId!: ITeam['id']
right!: Right
created: Date
updated: Date

View file

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

View file

@ -13,10 +13,10 @@ export interface IUser extends AbstractModel {
}
export default class UserModel extends AbstractModel implements IUser {
declare id: number
declare email: string
declare username: string
declare name: string
id!: number
email!: string
username!: string
name!: string
created: 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
export default class UserListModel extends UserShareBaseModel implements IUserList {
declare listId: IList['id']
listId!: IList['id']
defaults() {
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
export default class UserNamespaceModel extends UserShareBaseModel implements IUserNamespace {
declare namespaceId: INamespace['id']
namespaceId!: INamespace['id']
defaults() {
return {

View file

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

View file

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