An open API service indexing awesome lists of open source software.

https://github.com/exeteres/function-decorator-ts-plugin

A simple tsserver and ts-patch plugin that enables function decorators
https://github.com/exeteres/function-decorator-ts-plugin

Last synced: about 1 month ago
JSON representation

A simple tsserver and ts-patch plugin that enables function decorators

Awesome Lists containing this project

README

        

# Function Decorator TypeScript Plugin

A simple `tsserver` and `ts-patch` plugin that enables function decorators.

## Installation

```shell
npm i function-decorator-ts-plugin -D
# or
yarn add function-decorator-ts-plugin -D
```

## Usage

It is assumed that you will use [`ts-patch`](https://github.com/nonara/ts-patch) instead of `ttypescript`.

Just add this plugin to `tsconfig.json`:

```json
{
"compilerOptions": {
"plugins": [{
"name": "function-decorator-ts-plugin",
"transform": "function-decorator-ts-plugin/transformer",
"transformProgram": true
}]
}
}
```

If you use VSCode, you may need to switch the typescript version to local one by adding this setting in `.vscode/settings.json`:

```json
{
"typescript.tsdk": "node_modules\\typescript\\lib"
}
```

## Limitations

- Decorated functions are not hoisted
- There is no type cheсking in decorator expressions