Language service which helps to get diagnostic messages from typescript source files.
npm install --save-dev typescript-service
import { createService } from 'typescript-service';
const service = createService({ configFile, compilerOptions });
const diagnostics = service.getDiagnostics(fileName);
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 forfileName
fileName
(required, string) Path to typescript file -
getProgram(): ts.Program
Getts.Program
See CHANGELOG.md