question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Try npm install @types/react-scroll-to-bottom

See original GitHub issue

Hi flow!I I have a problem! How to use this component in the application with React and typescript?  I install and create simple chat app when run command npm i react-scroll-to-bottom  result OK, no problem. But when I run command npm start result this problem\error:

Could not find a declaration file for module 'react-scroll-to-bottom'. './node_modules/react-scroll-to-bottom/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/react-scroll-to-bottom` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-scroll-to-bottom';`  TS7016

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
justinbhoppercommented, May 16, 2021

@compulim You can publish typings even without writing your component in TypeScript. The way you do this is simple - add a .d.ts file with the type definitions, and then point to this file in your package.json using the types property. You’ll be helping support a very large percentage of your consumers by doing this.

I’ve created a pull request that should do the trick: https://github.com/compulim/react-scroll-to-bottom/pull/96

0reactions
mrbernnzcommented, Apr 12, 2022

While we are waiting for the PR #96 to be resolved. You can add this to your code to satisfy the great work @justinbhopper did to a .d.ts file.

declare module 'react-scroll-to-bottom' {
  import * as React from 'react';

  interface ReactScrollToBottomProps {
    checkInterval?: number;
    className?: string;
    debounce?: number;
    followButtonClassName?: string;
    mode?: string;
    scrollViewClassName?: string;
    children: React.ReactNode;
    debug?: boolean;
  }

  interface ScrollOptions {
    behavior: ScrollBehavior;
  }

  interface FunctionContextProps {
    scrollTo: (scrollTo: number, options: ScrollOptions) => void;
    scrollToBottom: (options: ScrollOptions) => void;
    scrollToEnd: (options: ScrollOptions) => void;
    scrollToStart: (options: ScrollOptions) => void;
    scrollToTop: (options: ScrollOptions) => void;
  }

  const FunctionContext: React.Context<FunctionContextProps>;

  export default class ScrollToBottom extends React.PureComponent<ReactScrollToBottomProps> {}
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

@types/react-scroll-to-bottom - npm
Start using @types/react-scroll-to-bottom in your project by running `npm i @types/react-scroll-to-bottom`. There are no other projects in ...
Read more >
Could not find a declaration file for module 'react-scroll-to ...
Try npm install @types/react-scroll-to-bottom if it exists or add a new declaration (.d.ts) file containing declare module ...
Read more >
Issues · compulim/react-scroll-to-bottom - GitHub
Contribute to compulim/react-scroll-to-bottom development by creating an account on GitHub. ... Try npm install @types/react-scroll-to-bottom.
Read more >
React Scroll Typescript - Apicella Gomme
Try to use Optional chaining to make typescript only access the property if parent ... The npm package @types/react-scroll-rotate receives a total of...
Read more >
It looks like you're trying to use TypeScript but do not have the
or you turn it off for just one input --> <input type="text" ... npm install --save typescript @types/node @types/react @types/react-dom @types/jest ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found