Open kantar0 opened 1 year ago
I'll keep it in mind for a future update, thank you!
Have you tried this?:
First, create a type definitions file for the package. This file should be placed in the @types directory of your project, or any other directory that TypeScript can recognize. Usually, it's placed in a folder named @types in the root of the project.
For example, you can create the file @types/react-infinite-logo-slider/index.d.ts
@types/ └── react-infinite-logo-slider/ └── index.d.ts
Inside the index.d.ts file, add the type definitions for the Slider component. Here's a basic example:
` // @types/react-infinite-logo-slider/index.d.ts
declare module 'react-infinite-logo-slider' { import * as React from 'react';
interface SliderProps { // Define the props that the component accepts width?: string; duration: number; }
const Slider: React.FC
export default Slider; } `
Ensure that your tsconfig.json includes the @types directory so that TypeScript can find your custom definitions. Your configuration should include something like this:
{ "compilerOptions": { "typeRoots": ["./node_modules/@types", "./@types"], // Other configuration options } }
Now you can import and use the Slider component in your TypeScript files (.tsx). TypeScript will use the type definitions you created.
For example:
` // App.tsx import React from 'react'; import Slider from 'react-infinite-logo-slider';
const App: React.FC = () => { return (
); }
export default App; `
Why not directly add it to the package instead of providing a half-working code? If you are not longer working on this, it's fine, it is not your obligation, however I would recommend you close/archive this, or update it to a latest version for others. Just my 2 cents.
The "react-infinite-logo-slider" package does not include TypeScript type definitions, which makes it difficult to use in TypeScript projects without encountering type errors. As a result, developers who want to use this package in a TypeScript project must either write their own type definitions or rely on the package without type checking, which can lead to bugs and errors.![image](https://github.com/kreudev/react-infinite-logo-slider/assets/8251828/2ab34b68-d7a9-4aff-8d3b-623d0ddb29bc)