charting-library-examples icon indicating copy to clipboard operation
charting-library-examples copied to clipboard

[next.js]fix: correct useRef type and container type casting

Open bunniestech opened this issue 10 months ago • 0 comments

Add example checklist

  • [x] Any commit does not contain the charting library's code
  • [x] The example is self-sufficient and contains only necessary files/changes

Bug fix checklist

  • [x] Any commit does not contain the charting library's code
  • [x] Addresses an existing issue: #00000

Description

when run npm run build,the terminal shows:

    Linting and checking validity of types  ...Failed to compile.
    
    ./components/TVChartContainer/index.tsx:7:3
    Type error: Expected 1 arguments, but got 0.
    
       5 | export const TVChartContainer = (props: Partial<ChartingLibraryWidgetOptions>) => {
       6 |  const chartContainerRef =
    >  7 |          useRef<HTMLDivElement>() as React.MutableRefObject<HTMLInputElement>;
         |          ^
       8 |
       9 |  useEffect(() => {
      10 |          const widgetOptions: ChartingLibraryWidgetOptions = {
    Static worker exited with code: 1 and signal: null

New Behavior

npm run build works well,no typescript problem anymore

bunniestech avatar Feb 16 '25 18:02 bunniestech