diff --git a/sheet.ts b/sheet.ts index a12058c..ca0519e 100644 --- a/sheet.ts +++ b/sheet.ts @@ -9,7 +9,7 @@ export default class ShimoSheetCabinet extends CabinetBase { private token: string private file: ShimoSDK.File private editorOptions: ShimoSDK.Sheet.EditorOptions - private fetchCollaborators: string + private fetchCollaborators: string | ShimoSDK.Sheet.FetchCollaboratorsCallback private plugins: string[] private collaboration: ShimoSDK.Common.Collaboration @@ -212,7 +212,7 @@ export default class ShimoSheetCabinet extends CabinetBase { currentUser: { id: this.user.id }, - permission: this.user.permission, + permission: this.user.permission!, fetchCollaborators: this.fetchCollaborators } const _ = new this.sdkSheet.plugins.Lock(options) diff --git a/typings/global.d.ts b/typings/global.d.ts index 7989181..07722a8 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -73,6 +73,7 @@ declare global { export type ToolbarOptions = IToolbar.ToolbarOptions export type Lock = ILock.default export type LockOptions = ILock.LockOptions + export type FetchCollaboratorsCallback = ILock.FetchCollaboratorsCallback } namespace Document { diff --git a/typings/sheet/plugins/lock/index.d.ts b/typings/sheet/plugins/lock/index.d.ts index cc38774..9b543bd 100644 --- a/typings/sheet/plugins/lock/index.d.ts +++ b/typings/sheet/plugins/lock/index.d.ts @@ -18,13 +18,15 @@ interface Collaborator { displayRole?: string | undefined } +export type FetchCollaboratorsCallback = () => Promise + export interface LockOptions { editor: Editor currentUser: { id: number } permission: PermissionConfig - fetchCollaborators: string + fetchCollaborators: string | FetchCollaboratorsCallback } export default class Lock { constructor (opts: LockOptions);