Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unlight/typescript-service
Language service which helps to get diagnostic messages from typescript source files.
https://github.com/unlight/typescript-service
typescript typescript-api typescript-compiler typescript-helpers typescript-wrapper
Last synced: 6 days ago
JSON representation
Language service which helps to get diagnostic messages from typescript source files.
- Host: GitHub
- URL: https://github.com/unlight/typescript-service
- Owner: unlight
- License: mit
- Created: 2018-07-01T10:01:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-17T09:06:32.000Z (almost 6 years ago)
- Last Synced: 2024-10-31T17:33:59.371Z (12 days ago)
- Topics: typescript, typescript-api, typescript-compiler, typescript-helpers, typescript-wrapper
- Language: TypeScript
- Size: 19.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# typescript-service
Language service which helps to get diagnostic messages from typescript source files.## INSTALL
```
npm install --save-dev typescript-service
```## USAGE
```ts
import { createService } from 'typescript-service';const service = createService({ configFile, compilerOptions });
const diagnostics = service.getDiagnostics(fileName);
```## API
#### createService({ configFile: string, compilerOptions?: ts.CompilerOptions })
* `configFile` (required, string) Path to tsconfig.json file
* `compilerOptions` (optional, Object) Compiler options to overwrite defined in tsconfig.jsonReturns object with properties which are functions:
##### getSourceFile({ fileName: string, sourceText?: string })
Update (add) information about file in typescript service.
* `fileName` (required, string) Path to typescript file
* `sourceText` (optional, string) File content of this file##### getDiagnostics: (fileName: string, sourceText?: string): Array
Get diagnostic messages for `fileName`
* `fileName` (required, string) Path to typescript file
* `sourceText` (optional, string) If path outside of scope defined in tsconfig you need provide `sourceText`##### getProgram(): ts.Program
Get `ts.Program`## CHANGELOG
See [CHANGELOG.md](CHANGELOG.md)