Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript import on v5.0.0 #179

Closed
MikeSquall opened this issue Jan 27, 2020 · 3 comments · Fixed by #180
Closed

Typescript import on v5.0.0 #179

MikeSquall opened this issue Jan 27, 2020 · 3 comments · Fixed by #180
Labels

Comments

@MikeSquall
Copy link

What did you do?

I was trying to use the last release (v.5.0.0) to add a loader.
I am using "react": "^16.8.0" and "typescript": "^3.7.4".
In my component, I did

import React from "react";
import ContentLoader from "react-content-loader";

interface IProps {}

const Loader: React.FC<IProps> = () => {
  return (
    <ContentLoader>
      <rect x="0" y="0" rx="5" ry="5" width="70" height="70" />
      <rect x="80" y="17" rx="4" ry="4" width="300" height="13" />
      <rect x="80" y="40" rx="3" ry="3" width="250" height="10" />
    </ContentLoader>
  );
};

export default Loader;

as seen in this CodeSandbox,
but changing the version to 5.0.0 instead of 4.2.0.

What did you expect to happen?

I expected my build to work as demonstrated.

What happened actually?

Actually, i get a TypeScript error when building :

src/components/ImgLoader.tsx:2:27 - error TS7016:   
Could not find a declaration file for module 'react-content-loader'.   
'/home/node_modules/react-content-loader/dist/react-content-loader.cjs.js'   
implicitly has an 'any' type.
Try `npm install @types/react-content-loader` if it exists or add a new   
declaration (.d.ts) file containing `declare module 'react-content-loader';`

import ContentLoader from 'react-content-loader'

It seems related to the fact there is no more index.ts file in src folder.

Which versions of react-content-loader, and which browser are affected by this issue?

package version
react 16.8.0
typescript 3.7.4
react-content-loader 5.0.0
@danilowoz
Copy link
Owner

🎉 This issue has been resolved in version 5.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@danilowoz
Copy link
Owner

Sorry about that :)

@MikeSquall
Copy link
Author

No problem, thank for the quick fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants