Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 689 Bytes

property-does-not-exist.md

File metadata and controls

30 lines (23 loc) · 689 Bytes

How to fix Property 'X' does not exist on type

Let's say you have the following code:

$('.owl-carousel').owlCarousel({
    items: 1,
    loop:true,
    margin:10,
    nav:true
});

If the owlCarousel method is not defined, you'll get an error message: Property 'owlCarousel' does not exist on type 'JQuery<HTMLElement>'.

In order to fix it, you can use a variable of type any:

const carousel = $('.owl-carousel') as any;

$('.owl-carousel').owlCarousel({
    items: 1,
    loop:true,
    margin:10,
    nav:true
});

References: