# Decorators और Advanced Features — बेबल और SWC

Source: https://www.geekswithgeeks.com/hi/babel-swc/bs-decorator-transform

> Decorators, class properties, और experimental JavaScript features को transform करें।

## Decorators: metadata और class enhancement

Decorators (जैसे `@Component`) experimental हैं। Babel और SWC को उन्हें metadata या function calls में transform करने के लिए plugins की जरूरत है।

## TypeScript decorators को function calls में

`@Component` एक function call बन जाता है जो class को wrap या modify करता है। `@babel/plugin-proposal-decorators` की जरूरत है।

```typescript
// TypeScript + Decorators
@Component({ selector: 'app' })
class AppComponent {}

// Transformed by Babel plugin
var AppComponent = __decorate([
  Component({ selector: 'app' })
], AppComponent);
```

## Decorator version के लिए plugin options का उपयोग करें

Decorators के कई proposals हैं (legacy vs new)। Plugin config में `version: '2023-05'` या similar निर्दिष्ट करें यह control करने के लिए कि Babel कौन सा standard follow करता है।
