From 04ede6331c1ed5be681d6d34bb93da29340ce3b6 Mon Sep 17 00:00:00 2001 From: regchiu Date: Tue, 28 May 2024 15:26:39 +0800 Subject: [PATCH] fix: dotlottiePlayer type --- webview-ui/.eslintrc.cjs | 7 +++++++ webview-ui/src/App.tsx | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/webview-ui/.eslintrc.cjs b/webview-ui/.eslintrc.cjs index ea719ef..5ac88aa 100644 --- a/webview-ui/.eslintrc.cjs +++ b/webview-ui/.eslintrc.cjs @@ -21,5 +21,12 @@ module.exports = { html: true, }, ], + '@typescript-eslint/consistent-type-definitions': ['error', 'type'], + }, + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + project: ['./tsconfig.json', './tsconfig.node.json'], + tsconfigRootDir: __dirname, }, } diff --git a/webview-ui/src/App.tsx b/webview-ui/src/App.tsx index 6806f56..563fec4 100644 --- a/webview-ui/src/App.tsx +++ b/webview-ui/src/App.tsx @@ -1,5 +1,6 @@ import { useEffect, useRef, useState } from 'react' +import { DotLottiePlayer } from '@dotlottie/player-component' import { VSCodeCheckbox, VSCodeDropdown, @@ -43,7 +44,7 @@ const DIRECTION_OPTIONS: Option[] = [ }, ] -let dotlottiePlayer: Element | null = null +let dotlottiePlayer: DotLottiePlayer | null = null function App() { const [background, setBackground] = useState('transparent') @@ -74,7 +75,7 @@ function App() { setSpeed(value) if (dotlottiePlayer) { - ;(dotlottiePlayer as any).setSpeed(value) + dotlottiePlayer.setSpeed(value) } } } @@ -85,7 +86,7 @@ function App() { setDirection(value) if (dotlottiePlayer) { - ;(dotlottiePlayer as any).setDirection(value) + dotlottiePlayer.setDirection(value) } } } @@ -95,7 +96,7 @@ function App() { setIsLoop(checked) if (dotlottiePlayer) { - ;(dotlottiePlayer as any).toggleLooping() + dotlottiePlayer.toggleLooping() } }