vue-chart-3 icon indicating copy to clipboard operation
vue-chart-3 copied to clipboard

Build errors in unrelated tsx files

Open hisuwh opened this issue 2 years ago • 30 comments

I'm unable to upgrade from [email protected] to latest v0.5.11 as I am getting build errors in my Vue TSX files that are not using charts:

TS2322: Type '{ src: string; width: string; height: string; border: string; }' is not assignable to type 'ElementAttrs<IframeHTMLAttributes>'.
 Property 'border' does not exist on type 'ElementAttrs<IframeHTMLAttributes>'.
   42 |                                 width="100%"
   43 |                                 height="800px"
 > 44 |                                 border="none"
      |                                 ^^^^^^
   45 |                             >
   46 |                             </iframe>
   47 |                         )}

I notice you have taken a dependency on @vue/runtime-core and @vue/runtime-dom v3.2.20 (https://github.com/victorgarciaesgi/vue-chart-3/blob/main/package.json#L54) - I wonder if this could be a factor?

hisuwh avatar Nov 03 '21 09:11 hisuwh

Hum that's weird. Do you use the JSX shim? I think a will release a version specifically for Vue 3 and another for Vue 2. It becomes too complicated to manage dependencies and types with only vue-demi. I will keep a branch updated for Vue 2

victorgarciaesgi avatar Nov 03 '21 09:11 victorgarciaesgi

I've been going through the versions and it looks like v0.4.10 is when it started breaking. Which looks like when you introduced the dependency on @vue/runtime-core and @vue/runtime-dom: https://github.com/victorgarciaesgi/vue-chart-3/compare/v0.4.8...v0.4.10

I think a will release a version specifically for Vue 3 and another for Vue 2. It becomes too complicated to manage dependencies and types with only vue-demi

Yes I imagine that would be complicated

hisuwh avatar Nov 03 '21 10:11 hisuwh

I'm having a similar issue, downgrading to v0.4.8 fixes this, thanks @hisuwh for the hint.

maiolica avatar Nov 07 '21 15:11 maiolica

Sorry for the lack of updates, I don't have much time recently to work on it. Will keep you updated

victorgarciaesgi avatar Nov 07 '21 15:11 victorgarciaesgi

@hisuwh @maiolica New version only for Vue 3 is out. With a legacy 2.x for Vue 2! Check out the new docs :)

victorgarciaesgi avatar Nov 23 '21 15:11 victorgarciaesgi

Tell me if that fixes your problem

victorgarciaesgi avatar Nov 23 '21 15:11 victorgarciaesgi

Hi Victor, it seems to be working great, thank you for your work on the docs too!

maiolica avatar Nov 23 '21 16:11 maiolica

I'm getting a new error now:

 Property 'class' does not exist on type 'Readonly<Partial<{ height: number; width: number; plugins: Plugin<keyof ChartTypeRegistry, AnyObject>[]; chartId: string; cssClasses: string; }> & Omit<...>>'.
    25 |         return (
    26 |             <Doughnut
  > 27 |                 class="position-relative h-100"
       |                 ^^^^^
    28 |                 chartData={chartData}
    29 |                 options={chartOptions}
    30 |             />

hisuwh avatar Nov 23 '21 17:11 hisuwh

@hisuwh Volar is returning this error? I'll check if htmlAttrs is declared

victorgarciaesgi avatar Nov 23 '21 17:11 victorgarciaesgi

Oh it's on tsx render function sorry

victorgarciaesgi avatar Nov 23 '21 17:11 victorgarciaesgi

Hmm no error on my side image

victorgarciaesgi avatar Nov 23 '21 17:11 victorgarciaesgi

Oh ok it's the build step that fails. Weird

victorgarciaesgi avatar Nov 23 '21 17:11 victorgarciaesgi

What if you assign the props explicitly rather than spread?

hisuwh avatar Nov 23 '21 19:11 hisuwh

I get the error on build and in Vs code

hisuwh avatar Nov 23 '21 19:11 hisuwh

I know where it comes from. I use the type ExtractPropTypes and it's not made for tsx. I will fix it tonight

victorgarciaesgi avatar Nov 23 '21 19:11 victorgarciaesgi

@hisuwh Should be fixed on 3.0.1

victorgarciaesgi avatar Nov 23 '21 21:11 victorgarciaesgi

3.0.1? I'm using Vue 2. Is that right?

hisuwh avatar Nov 23 '21 22:11 hisuwh

Oh shit I though you were on Vue 3 aha

victorgarciaesgi avatar Nov 23 '21 23:11 victorgarciaesgi

My bad tbf - I never specified

hisuwh avatar Nov 24 '21 09:11 hisuwh

@hisuwh Try 2.0.2 it should work now

victorgarciaesgi avatar Nov 24 '21 15:11 victorgarciaesgi

Mmm same problem. image

hisuwh avatar Nov 25 '21 16:11 hisuwh

I'm having a similar error in Vue3 version it's worked on 0.4.8

ERROR in src/views/transaction-management/withdraw-review/index.vue:382:19
TS2339: Property '$t' does not exist on type 'ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>'.
    380 |       const fileName = `${dayjs(param[`${conditions.dateType}_at_before`]).format(
    381 |         'YYYYMMDD'
  > 382 |       )}-${proxy?.$t('menu.withdraw_review')}.csv`
        |                   ^^
    383 |       downloadFile('/manage/report/withdraw/', fileName, param)
    384 |     }
    385 |

jedy05097952 avatar Dec 09 '21 09:12 jedy05097952

@hisuwh sorry i don't have much time lately i will look into it

victorgarciaesgi avatar Dec 09 '21 09:12 victorgarciaesgi

I'm having a similar error in Vue3 version

it's worked on 0.4.8


ERROR in src/views/transaction-management/withdraw-review/index.vue:382:19

TS2339: Property '$t' does not exist on type 'ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>'.

    380 |       const fileName = `${dayjs(param[`${conditions.dateType}_at_before`]).format(

    381 |         'YYYYMMDD'

  > 382 |       )}-${proxy?.$t('menu.withdraw_review')}.csv`

        |                   ^^

    383 |       downloadFile('/manage/report/withdraw/', fileName, param)

    384 |     }

    385 |

This error is not related to vue-chart-3

victorgarciaesgi avatar Dec 09 '21 09:12 victorgarciaesgi

@hisuwh Still have the problem?

victorgarciaesgi avatar Dec 22 '21 13:12 victorgarciaesgi

@victorgarciaesgi upgraded to 2.0.3 and yes it seems I still have the same problem: image

hisuwh avatar Jan 04 '22 09:01 hisuwh

@victorgarciaesgi any more guidance on this?

hisuwh avatar Feb 03 '22 15:02 hisuwh

I will look at it. It's really strange because the error only shows in the cli on the on the IDE

victorgarciaesgi avatar Feb 03 '22 15:02 victorgarciaesgi

Must be incompatibility issues between Vue 2 proxy and tsx. I it suits you, I can make additional exports like DoughtChartJsx with type any so that the cli don't scream at you. But you will loose auto-completion

victorgarciaesgi avatar Feb 03 '22 15:02 victorgarciaesgi

@victorgarciaesgi this might help - at least I can update for new features?

hisuwh avatar Jun 20 '22 12:06 hisuwh