# csharp-models-to-typescript-enhanced

> This is a soft fork of [Jonathan Persson's](https://github.com/jonathanp) [csharp-models-to-typescript](https://www.npmjs.com/package/csharp-models-to-typescript) npm package. The main difference is that we do auto import of dependent classes and interfac

Latest version **1.0.2** (published 2019-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install csharp-models-to-typescript-enhanced
pnpm add csharp-models-to-typescript-enhanced
yarn add csharp-models-to-typescript-enhanced
bun add csharp-models-to-typescript-enhanced
```

Provides the command `csharp-models-to-typescript-enhanced`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-07-17 |
| First published | 2019-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 0 |
| Unpacked size | 27.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jonathan Persson |
| Maintainers | atgdev |

## Links

- npm: https://www.npmjs.com/package/csharp-models-to-typescript-enhanced
- Repository: https://github.com/atgfr8/csharp-models-to-typescript
- Homepage: https://github.com/atgfr8/csharp-models-to-typescript#readme
- Issues: https://github.com/atgfr8/csharp-models-to-typescript/issues
- npm.io page: https://npm.io/package/csharp-models-to-typescript-enhanced

## Recent versions

- 1.0.2 (latest) — 2019-07-17
- 1.0.1 — 2019-07-17
- 1.0.0 — 2019-07-17
- 0.15.9 — 2019-07-17
- 0.15.8 — 2019-07-17
- 0.15.7 — 2019-07-17
- 0.15.6 — 2019-07-17
- 0.15.5 — 2019-07-17
- 0.15.4 — 2019-07-17
- 0.15.3 — 2019-07-17
- 0.15.2 — 2019-07-17
- 0.15.1 — 2019-07-17
- 0.15.0 — 2019-07-10

## README

# C# models to TypeScript

This is a soft fork of [Jonathan Persson's](https://github.com/jonathanp) [csharp-models-to-typescript](https://www.npmjs.com/package/csharp-models-to-typescript) npm package.
The main difference is that we do auto import of dependent classes and interfaces in csharp classes.
In order to facilitate this, you are required to append your types with "Model".


For example
```csharp
public class MyExampleModel: IExample
{
    public SomePropClass SomeValue {get; set; }
}
```
is translated into
```typescript
import {IExample} from "./IExample"
import { SomePropClass } from "./SomePropClass";

export interface MyExampleModel extends IExample {
    SomeValue: SomePropClass;
}
```


## Dependencies

* [.NET Core SDK](https://www.microsoft.com/net/download/macos)


## Install

```
$ npm install --save csharp-models-to-typescript-enhance
```

## How to use

1. Add a config file to your project that contains for example...

```
{
    "include": [
        "./models/**/*.cs",
        "./enums/**/*.cs"
    ],
    "exclude": [
        "./models/foo/bar.cs"
    ],
    "namespace": "Api",
    "output": "./models",
    "camelCase": false,
    "camelCaseEnums": false,
    "numericEnums": false,
    "stringLiteralTypesInsteadOfEnums": false,
    "customTypeTranslations": {
        "ProductName": "string",
        "ProductNumber": "string"
    }
}
```

2. Add a npm script to your package.json that references your config file...

```
"scripts": {
    "generate-types": "csharp-models-to-typescript-enhanced --config=your-config-file.json"
},
```

3. Run the npm script `generate-types` and the output file specified in your config should be created and populated with your models.


## License

MIT © [Jonathan Persson](https://github.com/jonathanp), Armstrong DevTeam

---
_Source: https://npm.io/package/csharp-models-to-typescript-enhanced · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
