aaron9000 / react-image-timeline

:calendar: An image-centric timeline component for React.js
http://aaron9000.github.io/react-image-timeline/
MIT License
86 stars 17 forks source link

Typescript definition error #20

Closed DerekLiang closed 4 years ago

DerekLiang commented 4 years ago

The error

Here is the error message when I used the react typescript template:

TypeScript error in <root>/src/index.tsx(7,22):
File '<root>/node_modules/react-image-timeline/index.d.ts' is not a module.  TS2306

     5 | import * as serviceWorker from './serviceWorker';
     6 | 
  >  7 | import Timeline from 'react-image-timeline';

To reproduce it:

npx create-react-app my-app --template typescript
# add the following line to index.tsx file as shown in the error message
# import Timeline from 'react-image-timeline';

The workaround

If I replaced the <root>/node_modules/react-image-timeline/index.d.ts with <root>/node_modules/react-image-timeline/dist/timline.d.ts, it worked as expected.

DerekLiang commented 4 years ago

It seems that the following seems to be working

export * from './dist/timeline';
import { default as d } from './dist/timeline';

export default d;
aaron9000 commented 4 years ago

@DerekLiang thank you. I will look into this.

aaron9000 commented 4 years ago

@DerekLiang - I just updated the library. It should be fixed in 3.2.6