@@ -6,7 +6,11 @@ import {Note, Revision, NoteAttributes} from "../models";
6
6
7
7
const dmp = new DiffMatchPatch ( )
8
8
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 {
10
14
saveAllNotesRevision ( function ( err , notes ) {
11
15
if ( err ) return callback ( err , null )
12
16
if ( ! notes || notes . length <= 0 ) {
@@ -17,7 +21,7 @@ export function checkAllNotesRevision(callback) {
17
21
} )
18
22
}
19
23
20
- export function saveAllNotesRevision ( callback : any ) : void {
24
+ export function saveAllNotesRevision ( callback : Callback ) : void {
21
25
Note . findAll ( {
22
26
// query all notes that need to save for revision
23
27
where : {
@@ -43,7 +47,7 @@ export function saveAllNotesRevision(callback: any): void {
43
47
}
44
48
]
45
49
}
46
- } ) . then ( function ( notes ) {
50
+ } ) . then ( function ( notes : Note [ ] ) {
47
51
if ( notes . length <= 0 ) return callback ( null , notes )
48
52
const savedNotes = [ ]
49
53
async . each ( notes , function ( note , _callback ) {
@@ -77,7 +81,7 @@ export function saveAllNotesRevision(callback: any): void {
77
81
} )
78
82
}
79
83
80
- export async function syncNote ( noteInFS , note ) : Promise < string > {
84
+ export async function syncNote ( noteInFS : Partial < Note > , note : Note ) : Promise < string > {
81
85
const contentLength = noteInFS . content . length
82
86
83
87
let note2 = await note . update ( {
0 commit comments