diff --git a/__tests__/fileListAction.spec.ts b/__tests__/fileListAction.spec.ts index d3b34e55..37c9c08e 100644 --- a/__tests__/fileListAction.spec.ts +++ b/__tests__/fileListAction.spec.ts @@ -103,6 +103,7 @@ describe('Invalid FileListAction creation', () => { test('Invalid iconSvgInline', () => { expect(() => new FileListAction({ id: 'test', + iconSvgInline: null, displayName: () => 'Test', order: 0, exec: async () => {}, diff --git a/lib/fileListAction.ts b/lib/fileListAction.ts index d8b2df19..4bee658e 100644 --- a/lib/fileListAction.ts +++ b/lib/fileListAction.ts @@ -20,7 +20,7 @@ interface FileListActionData { displayName: (view: View) => string /** Raw svg string */ - iconSvgInline: (view: View) => string + iconSvgInline?: (view: View) => string /** Sort order */ order: number @@ -86,7 +86,7 @@ export class FileListAction { throw new Error('Invalid displayName function') } - if (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') { + if ('iconSvgInline' in action && typeof action.iconSvgInline !== 'function') { throw new Error('Invalid iconSvgInline function') }