Allow decorators (and TypeScript) in component
See original GitHub issueWhat 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:
- Created 5 years ago
- Reactions:4
- Comments:11
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pamls Unfortunately it isn’t. The recommended workaround is to disable pages parsing and fallback on the modules configuration to customize paths:
Any update on this?