Skip to content

Commit

Permalink
Docs: Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
roman.vasilev committed Jul 1, 2018
1 parent 0c7e6aa commit de14fc3
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
typescript-service
===
Language service which helps to get diagnostic messages from typescript source files.

## INSTALL
```
npm install --save-dev typescript-service
```

CHANGELOG
---
## USAGE
```ts
import { createService } from 'typescript-service';

const service = createService({ configFile, compilerOptions });
const diagnostics = service.getDiagnostics(fileName);
```

## API
```
createService({ configFile, compilerOptions })
```
`configFile` (required, string) Path to tsconfig.json file
`compilerOptions` (optional, Object) Compiler options to overwrite defined in tsconfig.json

Returns object with properties which are functions:

* `update({ fileName: string, fileContent?: string })` Update (add) information about file in typescript service
`fileName` (required, string) Path to typescript file
`fileContent (optional, string)` File content of this file

* `getDiagnostics(fileName: string): Array<ts.DiagnosticWithLocation>` Get diagnostic messages for `fileName`
`fileName` (required, string) Path to typescript file

* `getProgram(): ts.Program` Get `ts.Program`

## CHANGELOG
See [CHANGELOG.md](CHANGELOG.md)

0 comments on commit de14fc3

Please sign in to comment.