# @indilago/ts-ng-annotate

> Add and fix dependency annotations of AngularJS on TypeScript files

Latest version **0.3.0** (published 2021-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @indilago/ts-ng-annotate
pnpm add @indilago/ts-ng-annotate
yarn add @indilago/ts-ng-annotate
bun add @indilago/ts-ng-annotate
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2021-04-08 |
| First published | 2021-04-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 28.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | kbanman |

## Links

- npm: https://www.npmjs.com/package/@indilago/ts-ng-annotate
- Repository: https://github.com/indilago/ts-ng-annotate
- Homepage: https://github.com/indilago/ts-ng-annotate#readme
- Issues: https://github.com/indilago/ts-ng-annotate/issues
- npm.io page: https://npm.io/package/@indilago/ts-ng-annotate

## Recent versions

- 0.3.0 (latest) — 2021-04-08
- 0.2.0 — 2021-04-08
- 0.1.0 — 2021-04-08

## README

# ts-ng-annotate

ts-ng-annotate adds and fixes dependency annotations of AngularJS on TypeScript files.

## Getting Started

The following steps add and fix annotations in place:

```
git clone https://github.com/kabuku/ts-ng-annotate.git
cd ts-ng-annotate
npm install
./node_modules/.bin/ts-node ts-ng-annotate-main.ts /path/to/ts-file...
```

## Supported code

ts-ng-annotate supports the following code:

- Inline function like argument of `angular.Module` method call which follows AngularJS Style Guide ([Definitions (aka Setters)](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#definitions-aka-setters))
- Function like expression which has `'ngInject'` prologue
- Constructor which has `'ngInject'` prologue

where function like means function expression or arrow function.

## Examples

### Inline arrow function

```ts
// Before
angular.module('myapp').factory('MyService', ($http) => {});

// After
angular.module('myapp').factory('MyService', ['$http', ($http) => {}]);
```

### Constructor

```ts
// Before
class MyService {
    constructor($http) {
        'ngInject';
    }
}

// After
class MyService {
    static $inject = ['$http'];
    constructor($http) {
        'ngInject';
    }
}
```

## License

MIT

---
_Source: https://npm.io/package/@indilago/ts-ng-annotate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
