diff --git a/lib/css-modules.d.ts b/lib/css-modules.d.ts index 07acc0feb..6aa5b2184 100644 --- a/lib/css-modules.d.ts +++ b/lib/css-modules.d.ts @@ -12,3 +12,6 @@ declare module '*.module.scss' { const content: Record export default content } + +declare module '*.scss' { +} diff --git a/lib/dialogs.ts b/lib/dialogs.ts index c0632c447..b3a48cf25 100644 --- a/lib/dialogs.ts +++ b/lib/dialogs.ts @@ -38,7 +38,7 @@ export class Dialog { * * @return Promise that resolves when the dialog is answered successfully and rejects on close */ - async show() { + async show(): Promise { const result = await spawnDialog( GenericDialog, { @@ -89,7 +89,7 @@ export class DialogBuilder { * * @param name The name or headline of the dialog */ - setName(name: string) { + setName(name: string): this { this.#name = name return this } @@ -99,7 +99,7 @@ export class DialogBuilder { * * @param text Main text of the dialog */ - setText(text: string) { + setText(text: string): this { this.#text = text return this } @@ -109,7 +109,7 @@ export class DialogBuilder { * * @param severity Severity of the dialog */ - setSeverity(severity: IDialogSeverity) { + setSeverity(severity: IDialogSeverity): this { this.#severity = severity return this } @@ -119,7 +119,7 @@ export class DialogBuilder { * * @param buttons Either an array of dialog buttons */ - setButtons(buttons: IDialogButton[]) { + setButtons(buttons: IDialogButton[]): this { if (this.#buttons.length > 0) { logger.warn('[@nextcloud/dialogs] Dialog buttons are already set - this overrides previous buttons.') } @@ -132,12 +132,12 @@ export class DialogBuilder { * * @param button Button to add */ - addButton(button: IDialogButton) { + addButton(button: IDialogButton): this { this.#buttons.push(button) return this } - build() { + build(): Dialog { return new Dialog(this.#name, this.#text, this.#buttons, this.#severity) } } @@ -156,7 +156,7 @@ export class DialogBuilder { * .build() * ``` */ -export function getDialogBuilder(name: string) { +export function getDialogBuilder(name: string): DialogBuilder { return new DialogBuilder(name) } diff --git a/lib/filepicker-builder.ts b/lib/filepicker-builder.ts index 124957867..f311191e7 100644 --- a/lib/filepicker-builder.ts +++ b/lib/filepicker-builder.ts @@ -141,7 +141,7 @@ export class FilePickerBuilder { * * @param container The dialog container */ - public setContainer(container: string) { + public setContainer(container: string): this { this.container = container return this } @@ -161,7 +161,7 @@ export class FilePickerBuilder { * * @param filter MIME type to allow */ - public addMimeTypeFilter(filter: string) { + public addMimeTypeFilter(filter: string): this { this.mimeTypeFilter.push(filter) return this } @@ -171,7 +171,7 @@ export class FilePickerBuilder { * * @param filter Array of allowed MIME types */ - public setMimeTypeFilter(filter: string[]) { + public setMimeTypeFilter(filter: string[]): this { this.mimeTypeFilter = filter return this } @@ -182,7 +182,7 @@ export class FilePickerBuilder { * * @param button The button */ - public addButton(button: IFilePickerButton) { + public addButton(button: IFilePickerButton): this { if (typeof this.buttons === 'function') { logger.warn('FilePicker buttons were set to factory, now overwritten with button object.') this.buttons = [] @@ -197,7 +197,7 @@ export class FilePickerBuilder { * * @param factory The button factory */ - public setButtonFactory(factory: IFilePickerButtonFactory) { + public setButtonFactory(factory: IFilePickerButtonFactory): this { this.buttons = factory return this } @@ -208,7 +208,7 @@ export class FilePickerBuilder { * @param type The legacy filepicker type to emulate * @deprecated Use `addButton` or `setButtonFactory` instead as with setType you do not know which button was pressed */ - public setType(type: FilePickerType) { + public setType(type: FilePickerType): this { this.buttons = (nodes, path) => { const buttons: IFilePickerButton[] = [] const node = nodes[0] @@ -254,7 +254,7 @@ export class FilePickerBuilder { * * @param allow True to allow picking directories */ - public allowDirectories(allow = true) { + public allowDirectories(allow = true): this { this.directoriesAllowed = allow return this } @@ -264,7 +264,7 @@ export class FilePickerBuilder { * * @param noMenu True to hide menu */ - public setNoMenu(noMenu = true) { + public setNoMenu(noMenu = true): this { this.noMenu = noMenu return this } @@ -274,7 +274,7 @@ export class FilePickerBuilder { * * @param path Path to start from picking */ - public startAt(path: string) { + public startAt(path: string): this { this.path = path return this } @@ -284,7 +284,7 @@ export class FilePickerBuilder { * * @param filter Filter function to apply */ - public setFilter(filter: IFilePickerFilter) { + public setFilter(filter: IFilePickerFilter): this { this.filter = filter return this } @@ -294,7 +294,7 @@ export class FilePickerBuilder { * * @param canPick Function to decide if a node can be picked */ - public setCanPick(canPick: IFilePickerCanPick) { + public setCanPick(canPick: IFilePickerCanPick): this { this.canPick = canPick return this } @@ -302,7 +302,7 @@ export class FilePickerBuilder { /** * Disable navigation (view selection) */ - public disableNavigation() { + public disableNavigation(): this { this.disabledNavigation = true return this } @@ -310,7 +310,7 @@ export class FilePickerBuilder { /** * Construct the configured FilePicker */ - public build() { + public build(): FilePicker { return new FilePicker( this.title, this.multiSelect as IsMultiSelect,