Skip to content

Commit 9c5dbd6

Browse files
committed
lint: lib/services/note.ts
- add typing annotate in checkAllNotesRevision and saveAllNotesRevision - passing string in error constructor in app.ts
1 parent 49a17e0 commit 9c5dbd6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ sequelize.sync().then(function () {
290290
// check if realtime is ready
291291
if (realtime.isReady()) {
292292
checkAllNotesRevision(function (err, notes) {
293-
if (err) throw new Error(err)
293+
if (err) throw new Error(err.toString())
294294
if (!notes || notes.length <= 0) return startListen()
295295
})
296296
} else {

lib/services/note.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import {Note, Revision, NoteAttributes} from "../models";
66

77
const dmp = new DiffMatchPatch()
88

9-
export function checkAllNotesRevision(callback) {
9+
interface Callback {
10+
(err: Error | string | null, notes?: Note[] | null): void
11+
}
12+
13+
export function checkAllNotesRevision(callback: Callback): void {
1014
saveAllNotesRevision(function (err, notes) {
1115
if (err) return callback(err, null)
1216
if (!notes || notes.length <= 0) {
@@ -17,7 +21,7 @@ export function checkAllNotesRevision(callback) {
1721
})
1822
}
1923

20-
export function saveAllNotesRevision(callback: any): void {
24+
export function saveAllNotesRevision(callback: Callback): void {
2125
Note.findAll({
2226
// query all notes that need to save for revision
2327
where: {
@@ -43,7 +47,7 @@ export function saveAllNotesRevision(callback: any): void {
4347
}
4448
]
4549
}
46-
}).then(function (notes) {
50+
}).then(function (notes: Note[]) {
4751
if (notes.length <= 0) return callback(null, notes)
4852
const savedNotes = []
4953
async.each(notes, function (note, _callback) {
@@ -77,7 +81,7 @@ export function saveAllNotesRevision(callback: any): void {
7781
})
7882
}
7983

80-
export async function syncNote(noteInFS, note): Promise<string> {
84+
export async function syncNote(noteInFS: Partial<Note>, note: Note): Promise<string> {
8185
const contentLength = noteInFS.content.length
8286

8387
let note2 = await note.update({

0 commit comments

Comments
 (0)