Open metalmatze opened 3 years ago
As a quick fix, you can create a declarations.d.ts
file at the root of the project and write declare module 'react-responsive-masonry';
inside this file
It should silence the error.
Here is a minimalist declaration.d.ts file
declare module 'react-responsive-masonry' {
import * as React from 'react';
const Masonry: React.FC<{
columnsCount?: number
gutter?: string
}>
export const ResponsiveMasonry: React.FC<{
columnsCountBreakPoints?: Record<number, number>
}>
export default Masonry
}
Put it inside the 'src' folder if you're using React
In addition to @popzelife's declaration file, you can add additional props to support styling:
import React, { CSSProperties } from 'react'
const Masonry: React.FC<{
columnsCount?: number
gutter?: string
className?: string
style?: CSSProperties
}>
export const ResponsiveMasonry: React.FC<{
columnsCountBreakPoints?: Record<number, number>
className?: string
style?: CSSProperties
}>
We can leverage @types/react-responsive-masonry
, now.
Using yarn: yarn add -D @types/react-responsive-masonry
Hey,
thanks for the project! :100: Sadly my CI currently fails as it expects the types declared.
Now, I have never done this and would try to do it, however, if it an easy task for you I'd appreciate the help. Let me know!