Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove emitDecoratorMetadata from tsconfig.json #1708

Closed
doppelreim opened this issue Jun 29, 2018 · 9 comments
Closed

remove emitDecoratorMetadata from tsconfig.json #1708

doppelreim opened this issue Jun 29, 2018 · 9 comments

Comments

@doppelreim
Copy link

Version

3.0.0-rc.3

Reproduction link

kaorun343/vue-property-decorator#107

Steps to reproduce

This is the initial bug-report: #1498

There was nothing that could be done in vue-cli to fix it, but I was redirected to vue-property-decorator.

I opened kaorun343/vue-property-decorator#107 and a new version was released.

The new version does not use reflect-metadata anymore. That means, it does not rely on emitDecoratorMetadata any more.
In fact, when emitDecoratorMetadata is enabled, warnings are thrown.

vue-cli enables emitDecoratorMetadata here:

Could that be removed?

What is expected?

There should be no warnings.

What is actually happening?

There are warnings.

@silkentrance
Copy link

@doppelreim vue-router does not have an export called Route, there is just the default export which is VueRouter.

"export 'Route' was not found in 'vue-router'

@silkentrance
Copy link

silkentrance commented Jul 4, 2018

@Akryum and please do not remove the default emitDecoratorMetadata=true as it is required by other packages.

@silkentrance
Copy link

@doppelreim

from your augmented components/HelloWorld.vue:

import { Route } from 'vue-router';

@kaorun343 😀

@doppelreim
Copy link
Author

I'm confused...

What I want to have is a watcher on $route with typed arguments.
Something like this:

@Watch('$route')
private async onParamChanged(newRoute: Route, oldRoute: Route) {
  ...
}

I think, that is a reasonable thing to want?

vue-router does export a named thing called Route. But you are right, it is an interface.
I do not understand why it being an interface means that I can not import it. The typescript compiler does not seem to care, as long as I do not use Route as the type for the function-arguments.
I can use it just fine inside of the function-body (as a type).


Apart from that:
Who else requires emitDecoratorMetadata? It is not a default for vue-cli to include it.
It is only included if options.classComponent is set (see linked code in the opening post).
I assume that flag gets set, when the user answers this question from the wizard Use class-style component syntax? (Y/n) Y.

@doppelreim
Copy link
Author

Is there anything I can do to get this issue resolved (in whatever form)?
Some info I could provide?
@silkentrance Could you comment on my questions/confusion?

@yyx990803
Copy link
Member

The flag defaults to true because it was required by vue-property-decorator 6.x.

@silkentrance
Copy link

silkentrance commented Jul 27, 2018

@doppelreim have you tried with the latest rc7? I have just set up a new project using that, added @vue/typescript plugin and then imported { Route } from vue-router. I then copied your function skeleton but without the decorator.

It compiles just fine, without tsc complaining about anything.

And overcome this obsession with the decorator metadata, this has nothing to with it.

@silkentrance
Copy link

@doppelreim I then added the above method incl. the watch decorator to the HelloWorld component, ran npm run build and npm run serve without any problems.

@doppelreim
Copy link
Author

I updated vue-cli to rc10.
It adds a dependency on vue-property-decorator v7. Before, that was v6.
v6 depends on the flag emitDecoratorMetadata to be set, v7 does not.
The flag was removed from tsconfig.

The issue is solved for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants