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
- Host: GitHub
- URL: https://github.com/exeteres/function-decorator-ts-plugin
- Owner: Exeteres
- License: mit
- Created: 2020-07-07T18:09:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-10T09:23:56.000Z (over 1 year ago)
- Last Synced: 2025-03-31T10:11:18.664Z (2 months ago)
- Language: TypeScript
- Size: 43.9 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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