Skip to content

Commit de14fc3

Browse files
author
roman.vasilev
committed
Docs: Updated readme
1 parent 0c7e6aa commit de14fc3

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,37 @@
11
typescript-service
22
===
3+
Language service which helps to get diagnostic messages from typescript source files.
34

5+
## INSTALL
6+
```
7+
npm install --save-dev typescript-service
8+
```
49

5-
CHANGELOG
6-
---
10+
## USAGE
11+
```ts
12+
import { createService } from 'typescript-service';
13+
14+
const service = createService({ configFile, compilerOptions });
15+
const diagnostics = service.getDiagnostics(fileName);
16+
```
17+
18+
## API
19+
```
20+
createService({ configFile, compilerOptions })
21+
```
22+
`configFile` (required, string) Path to tsconfig.json file
23+
`compilerOptions` (optional, Object) Compiler options to overwrite defined in tsconfig.json
24+
25+
Returns object with properties which are functions:
26+
27+
* `update({ fileName: string, fileContent?: string })` Update (add) information about file in typescript service
28+
`fileName` (required, string) Path to typescript file
29+
`fileContent (optional, string)` File content of this file
30+
31+
* `getDiagnostics(fileName: string): Array<ts.DiagnosticWithLocation>` Get diagnostic messages for `fileName`
32+
`fileName` (required, string) Path to typescript file
33+
34+
* `getProgram(): ts.Program` Get `ts.Program`
35+
36+
## CHANGELOG
737
See [CHANGELOG.md](CHANGELOG.md)

0 commit comments

Comments
 (0)