jonathanpmartins / v-money3

Vue3 currency input/directive mask
MIT License
103 stars 27 forks source link

Error after updating Vue 3 and Vmoney with TS #56

Closed DiegoMDS closed 1 year ago

DiegoMDS commented 2 years ago

Hi, first congratulations for the excellent work you do. Thank you very much!

After updating Vue to Vue version 3.2.31 and V-money 3 to version 3.21.0

It started displaying the following message:

in ./node_modules/v-money3/dist/v-money3.es.js

Module parse failed: Unexpected token (526:30) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | let lastValue = null; | function change(evt) {

let value2 = evt.target?.value; | debug(props, "component change() -> evt.target.value", value2); | if (!(masked.value && !modelModifiers.value.number)) {

@ ./src/main.ts 3:0-43 15:28-43 @multi (webpack)-dev-server/client?http://192.168.1.6:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts

Could you help me, please?

jonathanpmartins commented 2 years ago

Can you help me out with more information about your problem? Perhaps a working example on codesandbox.io, or a a shared repository.

Does it work with Vue 3.2.30 ?

lmsfelipe commented 2 years ago

Facing the same issue with Vue 3.2.26 and v-money 3.20.1

uhelliton-megawhat commented 2 years ago

Facing the same issue with Vue 3 + TS

jonathanpmartins commented 2 years ago

Could someone test if this issue persists with version 3.22.2 ?

ianoble commented 2 years ago

Yes, still an issue.

"v-money3": "^3.22.2",

jonathanpmartins commented 2 years ago

I cannot replicate this problem. If someone has an example, like @christhofer did in this comment, would be very helpful!

ivancorrea commented 1 year ago

Opa @jonathanpmartins ,

O erro está na linha 359 do arquivo v-money3.mjs do build: let d = g.target?.value;

Testei trocando para: let d = g.target && g.target.value;

E o erro desapareceu.

ivancorrea commented 1 year ago

Baixando o código aqui, encontrei na linha 179 do arquivo component.vue

let value: string | number = (evt.target as HTMLInputElement)?.value;

O uso do operador '?' causa o erro

jonathanpmartins commented 1 year ago

Hey @ivancorrea, thank you to point out the problem. Can you confirm that the fix is valid for version 3.23.0?

ivancorrea commented 1 year ago

Hey @ivancorrea, thank you to point out the problem. Can you confirm that the fix is valid for version 3.23.0?

Yes! Fixed! :)

Tks @jonathanpmartins !