vite-plugin-vue2 icon indicating copy to clipboard operation
vite-plugin-vue2 copied to clipboard

Problem with using typescript decorator

Open hatedMe opened this issue 2 years ago • 4 comments

import { Vue, Component, Prop } from "vue-property-decorator";
import Layout from "../Layout.vue";
@Component({
    components: {
        Layout,
    }
})
export default class extends Vue {
 // someing code 
}

Is there a feasible solution for the above code?

hatedMe avatar Jul 06 '23 02:07 hatedMe

Hi @hatedMe I might have the same problem but I'm getting

Uncaught SyntaxError: Invalid or unexpected token (at SomePage.vue:39:1)

when I try to use vue-class-component. Is that the same error you are referring to?

drikusroor avatar Jul 21 '23 09:07 drikusroor

Hade the same problem and found out that I had enabled typescript decorators the wrong place, namely in tsconfig.app.json. It needs to go into your top level tsconfig.json - like this:

{
  "files": [],
  "compilerOptions": {
    "experimentalDecorators": true,
  },
  "references": [
    {
      "path": "./tsconfig.node.json"
    },
    {
      "path": "./tsconfig.app.json"
    }
  ]
}

chessydk-vertica avatar Apr 22 '24 08:04 chessydk-vertica

Hade the same problem and found out that I had enabled typescript decorators the wrong place, namely in tsconfig.app.json. It needs to go into your top level tsconfig.json - like this:

{
  "files": [],
  "compilerOptions": {
    "experimentalDecorators": true,
  },
  "references": [
    {
      "path": "./tsconfig.node.json"
    },
    {
      "path": "./tsconfig.app.json"
    }
  ]
}

it works, you saved my day! thanks! @chessydk-vertica

Fonigle avatar Apr 22 '24 08:04 Fonigle

Glad to hear!

Med venlig hilsen

Carsten Hess Extern frontender E-mail: @.@.> Direct: +4551300250


Fra: HuangYu @.> Sendt: 22. april 2024 10:45 Til: vitejs/vite-plugin-vue2 @.> Cc: Carsten Hess @.>; Comment @.> Emne: Re: [vitejs/vite-plugin-vue2] Problem with using typescript decorator (Issue #89)

Hade the same problem and found out that I had enabled typescript decorators the wrong place, namely in tsconfig.app.json. It needs to go into your top level tsconfig.json - like this:

{ "files": [], "compilerOptions": { "experimentalDecorators": true, }, "references": [ { "path": "./tsconfig.node.json" }, { "path": "./tsconfig.app.json" } ] }

it works, you saved my day! thanks!

— Reply to this email directly, view it on GitHubhttps://github.com/vitejs/vite-plugin-vue2/issues/89#issuecomment-2068832954, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BEJCGV3OERTJBEZTRJFAODDY6TEZLAVCNFSM6AAAAAAZ7X52SOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRYHAZTEOJVGQ. You are receiving this because you commented.Message ID: @.***>

chessydk-vertica avatar Apr 22 '24 12:04 chessydk-vertica