Open haydentech opened 2 years ago
Adding the specified line to index.d.ts seems to fix all the issues:
declare global {
interface JQuery {
masonry(options?: Masonry.Options): JQuery;
masonry(selector: string | Element, options?: Masonry.Options | JQuery): JQuery; // add this line
}
}
I'm attempting to convert a working JavaScript project using Masonry, ImagesLoaded, and InfiniteScroll over to TypeScript. The types for Masonry are available using "npm install --save @types/masonry-layout". After loading the types, many errors went away, but I'm still getting type errors for several places that appear to be working, correct code taken right from your sample code. Here are some examples:
$grid.masonry("destroy"); // https://masonry.desandro.com/methods.html#destroy
$grid.masonry( 'remove', this ); // https://masonry.desandro.com/methods.html#remove
Basically any construct with .masonry(string) is not accepted. Is there a shortcoming in the types files, or am I doing something wrong?