Skip to content

Commit

Permalink
Fix Typescript error when importing elements
Browse files Browse the repository at this point in the history
This is a fix for the issue useAnimations#39 that i opened recently. The changes made only change 'import type' to 'import'.
  • Loading branch information
davidjentjens committed Feb 17, 2021
1 parent 1380dda commit 2baa613
Show file tree
Hide file tree
Showing 74 changed files with 76 additions and 76 deletions.
4 changes: 2 additions & 2 deletions src/bin/addAnimationFiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ for file in *; do
mkdir "${file%.*}"
mv "$file" "${file%.*}"
touch "index.ts"
echo "import type { Animation } from '../../utils/constants';" >> "index.ts"
echo "import { Animation } from '../../utils/constants';" >> "index.ts"
echo "import ${file%.*} from './$file';" >> "index.ts"
echo "" >> "index.ts"
echo "export default { animationData: ${file%.*}, animationKey: '${file%.*}' } as Animation;" >> "index.ts"
Expand All @@ -25,4 +25,4 @@ done
truncate -s -3 "../temp.ts"
echo ";" >> "../temp.ts"
cat "../temp.ts" >> "../utils/constants.ts"
rm "../temp.ts"
rm "../temp.ts"
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React, { useState, useEffect, useRef, ReactElement } from 'react';
// UNFORTUNATELY WHEN LIGHT VERSION IS USED, SOME ANIMATIONS ARE NOT WORKING AS EXPECTED
// import lottie from 'lottie-web/build/player/lottie_light';
import lottie from 'lottie-web';
import type { AnimationItem, AnimationConfigWithData, AnimationConfig } from 'lottie-web';
import { AnimationItem, AnimationConfigWithData, AnimationConfig } from 'lottie-web';

import { getEffect, getEvents } from './utils';
import type { Animation, AnimationEffect } from './utils';
import { Animation, AnimationEffect } from './utils';

const getRandomId = (key: Animation['animationKey']) =>
`${key}_i${Math.floor(Math.random() * 10000 + 1)}`;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/activity/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import activity from './activity.json';

export default { animationData: activity, animationKey: 'activity' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/airplay/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import airplay from './airplay.json';

export default { animationData: airplay, animationKey: 'airplay' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/alertCircle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import alertCircle from './alertCircle.json';

export default { animationData: alertCircle, animationKey: 'alertCircle' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/alertOctagon/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import alertOctagon from './alertOctagon.json';

export default { animationData: alertOctagon, animationKey: 'alertOctagon' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/alertTriangle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import alertTriangle from './alertTriangle.json';

export default { animationData: alertTriangle, animationKey: 'alertTriangle' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/archive/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import archive from './archive.json';

export default { animationData: archive, animationKey: 'archive' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/arrowDown/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import arrowDown from './arrowDown.json';

export default { animationData: arrowDown, animationKey: 'arrowDown' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/arrowDownCircle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import arrowDownCircle from './arrowDownCircle.json';

export default { animationData: arrowDownCircle, animationKey: 'arrowDownCircle' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/arrowLeftCircle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import arrowLeftCircle from './arrowLeftCircle.json';

export default { animationData: arrowLeftCircle, animationKey: 'arrowLeftCircle' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/arrowRightCircle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import arrowRightCircle from './arrowRightCircle.json';

export default { animationData: arrowRightCircle, animationKey: 'arrowRightCircle' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/arrowUp/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import arrowUp from './arrowUp.json';

export default { animationData: arrowUp, animationKey: 'arrowUp' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/arrowUpCircle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import arrowUpCircle from './arrowUpCircle.json';

export default { animationData: arrowUpCircle, animationKey: 'arrowUpCircle' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/bookmark/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import bookmark from './bookmark.json';

export default { animationData: bookmark, animationKey: 'bookmark' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/calendar/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import calendar from './calendar.json';

export default { animationData: calendar, animationKey: 'calendar' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/checkBox/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import checkBox from './checkBox.json';

export default { animationData: checkBox, animationKey: 'checkBox' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/codepen/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import codepen from './codepen.json';

export default { animationData: codepen, animationKey: 'codepen' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/copy/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import copy from './copy.json';

export default { animationData: copy, animationKey: 'copy' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/download/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import download from './download.json';

export default { animationData: download, animationKey: 'download' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/edit/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import edit from './edit.json';

export default { animationData: edit, animationKey: 'edit' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/explore/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import explore from './explore.json';

export default { animationData: explore, animationKey: 'explore' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/facebook/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import facebook from './facebook.json';

export default { animationData: facebook, animationKey: 'facebook' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/github/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import github from './github.json';

export default { animationData: github, animationKey: 'github' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/heart/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import heart from './heart.json';

export default { animationData: heart, animationKey: 'heart' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/infinity/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import infinity from './infinity.json';

export default { animationData: infinity, animationKey: 'infinity' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/info/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import info from './info.json';

export default { animationData: info, animationKey: 'info' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/instagram/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import instagram from './instagram.json';

export default { animationData: instagram, animationKey: 'instagram' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/linkedin/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import linkedin from './linkedin.json';

export default { animationData: linkedin, animationKey: 'linkedin' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/loading/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import loading from './loading.json';

export default { animationData: loading, animationKey: 'loading' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/loading2/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import loading2 from './loading2.json';

export default { animationData: loading2, animationKey: 'loading2' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/loading3/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import loading3 from './loading3.json';

export default { animationData: loading3, animationKey: 'loading3' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/lock/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import lock from './lock.json';

export default { animationData: lock, animationKey: 'lock' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/mail/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import mail from './mail.json';

export default { animationData: mail, animationKey: 'mail' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/maximizeMinimize/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import maximizeMinimize from './maximizeMinimize.json';

export default { animationData: maximizeMinimize, animationKey: 'maximizeMinimize' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/maximizeMinimize2/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import maximizeMinimize2 from './maximizeMinimize2.json';

export default { animationData: maximizeMinimize2, animationKey: 'maximizeMinimize2' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/menu/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import menu from './menu.json';

export default { animationData: menu, animationKey: 'menu' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/menu2/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import menu2 from './menu2.json';

export default { animationData: menu2, animationKey: 'menu2' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/menu3/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import menu3 from './menu3.json';

export default { animationData: menu3, animationKey: 'menu3' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/menu4/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import menu4 from './menu4.json';

export default { animationData: menu4, animationKey: 'menu4' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/microphone/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import microphone from './microphone.json';

export default { animationData: microphone, animationKey: 'microphone' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/microphone2/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import microphone2 from './microphone2.json';

export default { animationData: microphone2, animationKey: 'microphone2' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/notification/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import notification from './notification.json';

export default { animationData: notification, animationKey: 'notification' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/notification2/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import notification2 from './notification2.json';

export default { animationData: notification2, animationKey: 'notification2' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/playPause/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import playPause from './playPause.json';

export default { animationData: playPause, animationKey: 'playPause' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/playPauseCircle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import playPauseCircle from './playPauseCircle.json';

export default { animationData: playPauseCircle, animationKey: 'playPauseCircle' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/plusToX/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import plusToX from './plusToX.json';

export default { animationData: plusToX, animationKey: 'plusToX' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/pocket/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import pocket from './pocket.json';

export default { animationData: pocket, animationKey: 'pocket' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/radioButton/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import radioButton from './radioButton.json';

export default { animationData: radioButton, animationKey: 'radioButton' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/scrollDown/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import scrollDown from './scrollDown.json';

export default { animationData: scrollDown, animationKey: 'scrollDown' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/searchToX/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import searchToX from './searchToX.json';

export default { animationData: searchToX, animationKey: 'searchToX' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/settings/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import settings from './settings.json';

export default { animationData: settings, animationKey: 'settings' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/settings2/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import settings2 from './settings2.json';

export default { animationData: settings2, animationKey: 'settings2' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/share/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import share from './share.json';

export default { animationData: share, animationKey: 'share' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/skipBack/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import skipBack from './skipBack.json';

export default { animationData: skipBack, animationKey: 'skipBack' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/skipForward/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import skipForward from './skipForward.json';

export default { animationData: skipForward, animationKey: 'skipForward' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/star/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import star from './star.json';

export default { animationData: star, animationKey: 'star' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/thumbUp/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import thumbUp from './thumbUp.json';

export default { animationData: thumbUp, animationKey: 'thumbUp' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/toggle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import toggle from './toggle.json';

export default { animationData: toggle, animationKey: 'toggle' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/trash/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import trash from './trash.json';

export default { animationData: trash, animationKey: 'trash' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/trash2/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import trash2 from './trash2.json';

export default { animationData: trash2, animationKey: 'trash2' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/twitter/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import twitter from './twitter.json';

export default { animationData: twitter, animationKey: 'twitter' } as Animation;
2 changes: 1 addition & 1 deletion src/lib/userMinus/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Animation } from '../../utils/constants';
import { Animation } from '../../utils/constants';
import userMinus from './userMinus.json';

export default { animationData: userMinus, animationKey: 'userMinus' } as Animation;

0 comments on commit 2baa613

Please sign in to comment.