Jquery не прослушивает события в Typescript

Я пытаюсь зафиксировать событие открытия и закрытия загрузочного аккордеона, но с машинописью события не "прослушиваются", а с JS работает нормально!

ОШИБКА:

 module "c:/Users/THIAGOSAAD/Documents/DEVELOPMENT/NEORIS/ALIANSCE/appcomercial/build/typescript/types/jquery"
    This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.ts(2497)

ТИПЫ JQUERY

export = jquery;
declare function jquery(w: any): any;

СОРТ

import * as $ from '../types/jquery';

export class BootstrapAccordionController {
    private readonly _iconStateContainer: HTMLElement;

    public constructor(private readonly _accordionID: string, public readonly iconStateContainerID: string) {
        this._iconStateContainer = document.getElementById(iconStateContainerID);
    }

    public init(): void {
        try {
            this.changeIconState();
        } catch (error) {
            console.error(error); 
        }
    }

    private changeIconState(): void {
        $(`#${this._accordionID}`).on('shown.bs.collapse',  () => this.createIconState('shown.bs.collapse'));
        $(`#${this._accordionID}`).on('hidden.bs.collapse', () => this.createIconState('hidden.bs.collapse'));
    }

    private createIconState(_stateType: string): void {
        switch(_stateType) {
            case 'shown.bs.collapse':
                this._iconStateContainer.innerHTML = `<h3 data-name = "accordion-collapse-icon"><i class = "fas fa-angle-up align-middle"></i></h3>`
                break;
            case 'hidden.bs.collapse':
                this._iconStateContainer.innerHTML = `<h3 data-name = "accordion-collapse-icon"><i class = "fas fa-angle-down align-middle"></i></h3>`
                break;
        }
    }
}
Как конвертировать HTML в PDF с помощью jsPDF
Как конвертировать HTML в PDF с помощью jsPDF
В этой статье мы рассмотрим, как конвертировать HTML в PDF с помощью jsPDF. Здесь мы узнаем, как конвертировать HTML в PDF с помощью javascript.
0
0
220
1

Ответы 1

This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.ts(2497)

Установите esModuleInterop на true. Это, в свою очередь, также включит синтетический импорт по умолчанию.

Другие вопросы по теме