How to use the getPreEmitDiagnostics function from typescript
Find comprehensive JavaScript typescript.getPreEmitDiagnostics code examples handpicked from public code repositorys.
936 937 938 939 940 941 942 943 944
timingStart('emit'); const result = program.emit(undefined, undefined, cancellationToken); timingEnd('emit'); timingStart('diagnostics'); const diagnostics = ts.getPreEmitDiagnostics(program, undefined, cancellationToken).concat(result?.diagnostics); timingEnd('diagnostics'); const succeded = diagnostics.length === 0;
26
48
4
+ 711 other calls in file
GitHub: kibalabs/build-js
33 34 35 36 37 38 39 40 41 42
noEmit: true, }); // NOTE(krishan711): from https://github.com/microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md const emitResult = program.emit(); const allDiagnostics = typescript.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); console.log(new PrettyFormatter().format(allDiagnostics)); if (params.outputFile) { let formatter = null; const fileFormat = params.outputFileFormat || 'pretty';
1
2
2
+ 441 other calls in file
112 113 114 115 116 117 118 119 120 121
var _a, files, program, diagnostics, message; return tslib_1.__generator(this, function (_b) { _a = resolution_1.resolveFilesAndProgram(options, logger), files = _a.files, program = _a.program; // if type checking, run the type checker if (program && options.typeCheck) { diagnostics = ts.getPreEmitDiagnostics(program); if (diagnostics.length !== 0) { message = diagnostics .map(function (d) { return showDiagnostic(d, program, options.outputAbsolutePaths); }) .join("\n");
0
0
1
+ 84 other calls in file
typescript.SyntaxKind is the most popular function in typescript (82777 examples)