question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow decorators (and TypeScript) in component

See original GitHub issue

What problem does this feature solve?

Allow using decorators inside component (and TypeScript).

I’m using TypeScript in .vue files with nuxt-property-decorator. Since nuxt-i18n 3.x is using acron to parse each component files to check i18n property, it will throw exception on decorations (e.g. @Component from nuxt-property-decorator)

As I know, acron has a plugin acron-es7 can parse. But the better solution is to load component files via webpack processor that webpack will solve the future syntax.

What does the proposed changes look like?

While using nuxt-i18n 3.x, I can use these syntax below in component file:

<script lang="ts">
import {
  Component,
  Vue,
} from 'nuxt-property-decorator'
import AppLogo from '~/components/AppLogo.vue'

@Component({ // <- acron (or nuxt-i18n) should not blame here
  components: {
    AppLogo
  }
})
export default class extends Vue {
}
</script>
<div align="right">This feature request is available on Nuxt.js community (#c71)</div>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:11

github_iconTop GitHub Comments

7reactions
paulgvcommented, Jul 13, 2019

@pamls Unfortunately it isn’t. The recommended workaround is to disable pages parsing and fallback on the modules configuration to customize paths:

3reactions
m4rvrcommented, Aug 22, 2019

Any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Decorators - TypeScript
A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators use...
Read more >
How To Use Decorators in TypeScript - DigitalOcean
In TypeScript, you can create decorators using the special syntax @expression , where expression is a function that will be called automatically ...
Read more >
A practical guide to TypeScript decorators - LogRocket Blog
In TypeScript, decorators are functions that can be attached to classes and their members, such as methods and properties. Let's look at some ......
Read more >
Angular, Typescript, and Decorators | by Nicholas Cunningham
In this post, we'll learn what decorators are, why they're useful, and how to create them. We'll do this with TypeScript — demonstrating...
Read more >
TypeScript decorators basics - Jannik Wempe
Enable decorators. Since decorators are an experimental feature, they are disabled by default. You must enable them by either enabling it in the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found