Skip to content

Commit

Permalink
fix: dotlottiePlayer type
Browse files Browse the repository at this point in the history
  • Loading branch information
regchiu committed May 28, 2024
1 parent 96c0ae2 commit 04ede63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions webview-ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
9 changes: 5 additions & 4 deletions webview-ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from 'react'

import { DotLottiePlayer } from '@dotlottie/player-component'
import {
VSCodeCheckbox,
VSCodeDropdown,
Expand Down Expand Up @@ -43,7 +44,7 @@ const DIRECTION_OPTIONS: Option<string, string>[] = [
},
]

let dotlottiePlayer: Element | null = null
let dotlottiePlayer: DotLottiePlayer | null = null

function App() {
const [background, setBackground] = useState('transparent')
Expand Down Expand Up @@ -74,7 +75,7 @@ function App() {
setSpeed(value)

if (dotlottiePlayer) {
;(dotlottiePlayer as any).setSpeed(value)
dotlottiePlayer.setSpeed(value)
}
}
}
Expand All @@ -85,7 +86,7 @@ function App() {
setDirection(value)

if (dotlottiePlayer) {
;(dotlottiePlayer as any).setDirection(value)
dotlottiePlayer.setDirection(value)
}
}
}
Expand All @@ -95,7 +96,7 @@ function App() {
setIsLoop(checked)

if (dotlottiePlayer) {
;(dotlottiePlayer as any).toggleLooping()
dotlottiePlayer.toggleLooping()
}
}

Expand Down

0 comments on commit 04ede63

Please sign in to comment.