How to use the tsickle.annotate function in tsickle

To help you get started, we’ve selected a few tsickle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Promact / md2 / libs / @angular / tsc-wrapped / src / compiler_host.js View on Github external
this.getSourceFile = function (fileName, languageVersion, onError) {
            var sourceFile = _this.oldProgram.getSourceFile(fileName);
            var isDefinitions = /\.d\.ts$/.test(fileName);
            // Don't tsickle-process any d.ts that isn't a compilation target;
            // this means we don't process e.g. lib.d.ts.
            if (isDefinitions)
                return sourceFile;
            var _a = tsickle.annotate(_this.oldProgram, sourceFile, { untyped: true }), output = _a.output, externs = _a.externs, diagnostics = _a.diagnostics;
            _this.diagnostics = diagnostics;
            return ts.createSourceFile(fileName, output, languageVersion, true);
        };
    }