Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tsickle

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsickle - npm Package Compare versions

Comparing version 0.21.5 to 0.21.6

5

build/definitions/es5processor.d.ts
/**
* Extracts the namespace part of a goog: import, or returns null if the given
* import is not a goog: import.
*/
export declare function extractGoogNamespaceImport(tsImport: string): string | null;
/**
* Converts TypeScript's JS+CommonJS output to Closure goog.module etc.

@@ -3,0 +8,0 @@ * For use as a postprocessing step *after* TypeScript emits JavaScript.

4

build/definitions/main.d.ts

@@ -7,4 +7,4 @@ import * as ts from 'typescript';

externsPath?: string;
/** If provided, convert every type to the Closure {?} type */
isUntyped: boolean;
/** If provided, attempt to provide types rather than {?}. */
isTyped?: boolean;
/** If true, log internal debug warnings to the console. */

@@ -11,0 +11,0 @@ verbose?: boolean;

@@ -18,4 +18,4 @@ import { SourceMapConsumer, SourceMapGenerator } from 'source-map';

*/
export declare function sourceMapGeneratorToConsumerWithFileName(sourceMapGenerator: SourceMapGenerator, fileName: string): SourceMapConsumer;
export declare function sourceMapGeneratorToConsumer(sourceMapGenerator: SourceMapGenerator, fileName?: string, sourceName?: string): SourceMapConsumer;
export declare function sourceMapTextToConsumer(sourceMapText: string): SourceMapConsumer;
export declare function sourceMapTextToGenerator(sourceMapText: string): SourceMapGenerator;

@@ -26,2 +26,8 @@ /**

/**
* The header to be used in generated externs. This is not included in the
* output of annotate() because annotate() works one file at a time, and
* typically you create one externs file from the entire compilation unit.
*/
export declare const EXTERNS_HEADER: string;
/**
* Symbols that are already declared as externs in Closure, that should

@@ -33,2 +39,2 @@ * be avoided by tsickle's "declare ..." => externs.js conversion.

export declare function isDtsFileName(fileName: string): boolean;
export declare function annotate(program: ts.Program, file: ts.SourceFile, options?: Options, host?: ts.ModuleResolutionHost, tsOpts?: ts.CompilerOptions): Output;
export declare function annotate(program: ts.Program, file: ts.SourceFile, pathToModuleName: (context: string, importPath: string) => string, options?: Options, host?: ts.ModuleResolutionHost, tsOpts?: ts.CompilerOptions): Output;

@@ -22,2 +22,3 @@ /**

private pathBlackList;
private symbolsToAliasedNames;
/**

@@ -34,4 +35,6 @@ * A list of types we've encountered while emitting; used to avoid getting stuck in recursive

* as {?}.
* @param symbolsToPrefix a mapping from symbols (`Foo`) to a prefix they should be emitted with
* (`tsickle_import.Foo`).
*/
constructor(typeChecker: ts.TypeChecker, node: ts.Node, pathBlackList?: Set<string>);
constructor(typeChecker: ts.TypeChecker, node: ts.Node, pathBlackList?: Set<string>, symbolsToAliasedNames?: Map<ts.Symbol, string>);
/**

@@ -38,0 +41,0 @@ * Converts a ts.Symbol to a string.

@@ -18,2 +18,12 @@ /**

/**
* Extracts the namespace part of a goog: import, or returns null if the given
* import is not a goog: import.
*/
function extractGoogNamespaceImport(tsImport) {
if (tsImport.match(/^goog:/))
return tsImport.substring('goog:'.length);
return null;
}
exports.extractGoogNamespaceImport = extractGoogNamespaceImport;
/**
* ES5Processor postprocesses TypeScript compilation output JS, to rewrite commonjs require()s into

@@ -215,6 +225,7 @@ * goog.require(). Contrary to its name it handles converting the modules in both ES5 and ES6

var isNamespaceImport = false;
if (tsImport.match(/^goog:/)) {
var nsImport = extractGoogNamespaceImport(tsImport);
if (nsImport !== null) {
// This is a namespace import, of the form "goog:foo.bar".
// Fix it to just "foo.bar", and save the variable name.
modName = tsImport.substr(5);
// Fix it to just "foo.bar".
modName = nsImport;
isNamespaceImport = true;

@@ -221,0 +232,0 @@ }

@@ -90,10 +90,31 @@ /**

/**
* A list of JSDoc @tags that are never allowed in TypeScript source.
* These are Closure tags that can be expressed in the TypeScript surface
* syntax.
* A list of JSDoc @tags that are never allowed in TypeScript source. These are Closure tags that
* can be expressed in the TypeScript surface syntax. As tsickle's emit will mangle type names,
* these will cause Closure Compiler issues and should not be used.
*/
var JSDOC_TAGS_BLACKLIST = ['constructor', 'extends', 'implements', 'private', 'public', 'type'];
/** A list of JSDoc @tags that might include a {type} after them. */
var JSDOC_TAGS_WITH_TYPES = ['export', 'param', 'return'];
var JSDOC_TAGS_BLACKLIST = [
'constructor',
'enum',
'extends',
'implements',
'interface',
'lends',
'private',
'public',
'record',
'template',
'this',
'type',
'typedef',
];
/**
* A list of JSDoc @tags that might include a {type} after them. Only banned when a type is passed.
*/
var JSDOC_TAGS_WITH_TYPES = [
'const',
'export',
'param',
'return',
];
/**
* parse parses JSDoc out of a comment string.

@@ -129,5 +150,10 @@ * Returns null if comment is not JSDoc.

else if (arrayIncludes(JSDOC_TAGS_WITH_TYPES, tagName) && text[0] === '{') {
warnings.push('type annotations (using {...}) are redundant with TypeScript types');
warnings.push("the type annotation on @" + tagName + " is redundant with its TypeScript type, " +
"remove the {...} part");
continue;
}
else if (tagName === 'dict') {
warnings.push('use index signatures (`[k: string]: type`) instead of @dict');
continue;
}
// Grab the parameter name from @param tags.

@@ -134,0 +160,0 @@ var parameterName = void 0;

@@ -20,3 +20,3 @@ #!/usr/bin/env node

function usage() {
console.error("usage: tsickle [tsickle options] -- [tsc options]\n\nexample:\n tsickle --externs=foo/externs.js -- -p src --noImplicitAny\n\ntsickle flags are:\n --externs=PATH save generated Closure externs.js to PATH\n --untyped convert every type in TypeScript to the Closure {?} type\n");
console.error("usage: tsickle [tsickle options] -- [tsc options]\n\nexample:\n tsickle --externs=foo/externs.js -- -p src --noImplicitAny\n\ntsickle flags are:\n --externs=PATH save generated Closure externs.js to PATH\n --typed [experimental] attempt to provide Closure types instead of {?}\n");
}

@@ -28,3 +28,3 @@ /**

function loadSettingsFromArgs(args) {
var settings = { isUntyped: false };
var settings = {};
var parsedArgs = minimist(args);

@@ -42,4 +42,4 @@ for (var _i = 0, _a = Object.keys(parsedArgs); _i < _a.length; _i++) {

break;
case 'untyped':
settings.isUntyped = true;
case 'typed':
settings.isTyped = true;
break;

@@ -105,3 +105,3 @@ case 'verbose':

es5Mode: false,
untyped: settings.isUntyped,
untyped: !settings.isTyped,
},

@@ -167,2 +167,8 @@ tsickleHost: {

}
if (config.options.module !== ts.ModuleKind.CommonJS) {
// This is not an upstream TypeScript diagnostic, therefore it does not go
// through the diagnostics array mechanism.
console.error('tsickle converts TypeScript modules to Closure modules via CommonJS internally. Set tsconfig.js "module": "commonjs"');
return 1;
}
// Run tsickle+TSC to convert inputs to Closure JS files.

@@ -169,0 +175,0 @@ var closure = toClosureJS(config.options, config.fileNames, settings, diagnostics);

@@ -64,9 +64,13 @@ "use strict";

*/
function sourceMapGeneratorToConsumerWithFileName(sourceMapGenerator, fileName) {
function sourceMapGeneratorToConsumer(sourceMapGenerator, fileName, sourceName) {
var rawSourceMap = sourceMapGenerator.toJSON();
rawSourceMap.sources = [fileName];
rawSourceMap.file = fileName;
if (sourceName) {
rawSourceMap.sources = [sourceName];
}
if (fileName) {
rawSourceMap.file = fileName;
}
return new source_map_1.SourceMapConsumer(rawSourceMap);
}
exports.sourceMapGeneratorToConsumerWithFileName = sourceMapGeneratorToConsumerWithFileName;
exports.sourceMapGeneratorToConsumer = sourceMapGeneratorToConsumer;
function sourceMapTextToConsumer(sourceMapText) {

@@ -73,0 +77,0 @@ var sourceMapJson = sourceMapText;

@@ -9,2 +9,3 @@ "use strict";

var sourceMapUtils = require("./source_map_utils");
var tsickle = require("./tsickle");
var tsickle_1 = require("./tsickle");

@@ -157,3 +158,3 @@ /**

var tsickleSourceMapGenerator = this.tsickleSourceMaps.get(sourceMapKey);
var tsickleSourceMapConsumer = sourceMapUtils.sourceMapGeneratorToConsumerWithFileName(tsickleSourceMapGenerator, sourceFileName);
var tsickleSourceMapConsumer = sourceMapUtils.sourceMapGeneratorToConsumer(tsickleSourceMapGenerator, sourceFileName, sourceFileName);
tscSourceMapGenerator.applySourceMap(tsickleSourceMapConsumer);

@@ -168,3 +169,3 @@ }

var decoratorDownlevelSourceMapGenerator = this.decoratorDownlevelSourceMaps.get(sourceMapKey);
var decoratorDownlevelSourceMapConsumer = sourceMapUtils.sourceMapGeneratorToConsumerWithFileName(decoratorDownlevelSourceMapGenerator, sourceFileName);
var decoratorDownlevelSourceMapConsumer = sourceMapUtils.sourceMapGeneratorToConsumer(decoratorDownlevelSourceMapGenerator, sourceFileName, sourceFileName);
tscSourceMapGenerator.applySourceMap(decoratorDownlevelSourceMapConsumer);

@@ -180,3 +181,3 @@ }

if (preexistingSourceMapGenerator) {
var preexistingSourceMapConsumer = new source_map_1.SourceMapConsumer(preexistingSourceMapGenerator.toJSON());
var preexistingSourceMapConsumer = sourceMapUtils.sourceMapGeneratorToConsumer(preexistingSourceMapGenerator, sourceFileName);
tscSourceMapGenerator.applySourceMap(preexistingSourceMapConsumer);

@@ -229,3 +230,3 @@ }

return sourceFile;
var _a = tsickle_1.annotate(program, sourceFile, this.options, this.delegate, this.tscOptions), output = _a.output, externs = _a.externs, diagnostics = _a.diagnostics, sourceMap = _a.sourceMap;
var _a = tsickle.annotate(program, sourceFile, this.environment.pathToModuleName.bind(this.environment), this.options, this.delegate, this.tscOptions), output = _a.output, externs = _a.externs, diagnostics = _a.diagnostics, sourceMap = _a.sourceMap;
if (externs) {

@@ -247,3 +248,3 @@ this.externs[fileName] = externs;

TsickleCompilerHost.prototype.getGeneratedExterns = function () {
var allExterns = '';
var allExterns = tsickle.EXTERNS_HEADER;
for (var _i = 0, _a = Object.keys(this.externs); _i < _a.length; _i++) {

@@ -250,0 +251,0 @@ var fileName = _a[_i];

@@ -133,7 +133,11 @@ /**

* as {?}.
* @param symbolsToPrefix a mapping from symbols (`Foo`) to a prefix they should be emitted with
* (`tsickle_import.Foo`).
*/
function TypeTranslator(typeChecker, node, pathBlackList) {
function TypeTranslator(typeChecker, node, pathBlackList, symbolsToAliasedNames) {
if (symbolsToAliasedNames === void 0) { symbolsToAliasedNames = new Map(); }
this.typeChecker = typeChecker;
this.node = node;
this.pathBlackList = pathBlackList;
this.symbolsToAliasedNames = symbolsToAliasedNames;
/**

@@ -155,2 +159,5 @@ * A list of types we've encountered while emitting; used to avoid getting stuck in recursive

var str = '';
var alias = this.symbolsToAliasedNames.get(sym);
if (alias)
return alias;
var writeText = function (text) { return str += text; };

@@ -180,2 +187,9 @@ var doNothing = function () {

builder.buildSymbolDisplay(sym, writer, this.node);
// Clutz (https://github.com/angular/clutz) emits global type symbols hidden in a special
// ಠ_ಠ.clutz namespace. While most code seen by Tsickle will only ever see local aliases, Clutz
// symbols can be written by users directly in code, and they can appear by dereferencing
// TypeAliases. The code below simply strips the prefix, the remaining type name then matches
// Closure's type.
if (str.startsWith('ಠ_ಠ.clutz.'))
str = str.substring('ಠ_ಠ.clutz.'.length);
return str;

@@ -224,4 +238,7 @@ };

// This is e.g. the T in a type like Foo<T>.
this.warn("unhandled type flags: " + ts.TypeFlags[type.flags]);
return '?';
if (!type.symbol) {
this.warn("TypeParameter without a symbol"); // should not happen (tm)
return '?';
}
return this.symbolToString(type.symbol);
case ts.TypeFlags.Object:

@@ -228,0 +245,0 @@ return this.translateObject(type);

@@ -28,4 +28,12 @@ /**

const formatted = ['*.js', 'src/**/*.ts', 'test/**/*.ts'];
gulp.task('format', function() {
return gulp.src(formatted, {base: '.'})
.pipe(formatter.format('file', clangFormat))
.pipe(gulp.dest('.'));
});
gulp.task('test.check-format', function() {
return gulp.src(['*.js', 'src/**/*.ts', 'test/**/*.ts'])
return gulp.src(formatted)
.pipe(formatter.checkFormat('file', clangFormat, {verbose: true}))

@@ -32,0 +40,0 @@ .on('warning', onError);

{
"name": "tsickle",
"version": "0.21.5",
"version": "0.21.6",
"description": "Transpile TypeScript code to JavaScript with Closure annotations.",

@@ -32,3 +32,3 @@ "main": "build/src/tsickle.js",

"chai": "^3.5.0",
"clang-format": "^1.0.45",
"clang-format": "^1.0.48",
"glob": "^7.0.0",

@@ -35,0 +35,0 @@ "google-closure-compiler": "^20161024.1.0",

@@ -1,10 +0,25 @@

# Tsickle - TypeScript to Closure Annotator [![Build Status](https://travis-ci.org/angular/tsickle.svg?branch=master)](https://travis-ci.org/angular/tsickle)
# Tsickle - TypeScript to Closure Translator [![Build Status](https://travis-ci.org/angular/tsickle.svg?branch=master)](https://travis-ci.org/angular/tsickle)
Tsickle processes TypeScript and adds [Closure Compiler]-compatible JSDoc
annotations. This allows using TypeScript to transpile your sources, and then
Closure Compiler to bundle and optimize them, while taking advantage of type
information in Closure Compiler.
Tsickle converts TypeScript code into a form acceptable to the [Closure
Compiler]. This allows using TypeScript to transpile your sources, and then
using Closure Compiler to bundle and optimize them, while taking advantage of
type information in Closure Compiler.
[Closure Compiler]: https://github.com/google/closure-compiler/
## What conversion means
A (non-exhaustive) list of the sorts of transformations Tsickle applies:
- inserts Closure-compatible JSDoc annotations on functions/classes/etc
- converts ES6 modules into `goog.module` modules
- generates externs.js from TypeScript d.ts (and `declare`, see below)
- declares types for class member variables
- translates `export * from ...` into a form Closure accepts
- converts TypeScript enums into a form Closure accepts
- reprocesses all jsdoc to strip Closure-invalid tags
In general the goal is that you write valid TypeScript and Tsickle handles
making it valid Closure Compiler code.
## Installation

@@ -96,2 +111,2 @@

Export the environment variable `TEST_FILTER`, a regex, to limit the end-to-end
tests (found in `test_files/...`) run tests with a name matching the regex.
tests (found in `test_files/...`) run tests with a name matching the regex.

@@ -14,2 +14,10 @@ /**

/**
* Extracts the namespace part of a goog: import, or returns null if the given
* import is not a goog: import.
*/
export function extractGoogNamespaceImport(tsImport: string): string|null {
if (tsImport.match(/^goog:/)) return tsImport.substring('goog:'.length);
return null;
}

@@ -213,6 +221,7 @@ /**

let isNamespaceImport = false;
if (tsImport.match(/^goog:/)) {
const nsImport = extractGoogNamespaceImport(tsImport);
if (nsImport !== null) {
// This is a namespace import, of the form "goog:foo.bar".
// Fix it to just "foo.bar", and save the variable name.
modName = tsImport.substr(5);
// Fix it to just "foo.bar".
modName = nsImport;
isNamespaceImport = true;

@@ -219,0 +228,0 @@ } else {

@@ -116,10 +116,31 @@ /**

/**
* A list of JSDoc @tags that are never allowed in TypeScript source.
* These are Closure tags that can be expressed in the TypeScript surface
* syntax.
* A list of JSDoc @tags that are never allowed in TypeScript source. These are Closure tags that
* can be expressed in the TypeScript surface syntax. As tsickle's emit will mangle type names,
* these will cause Closure Compiler issues and should not be used.
*/
const JSDOC_TAGS_BLACKLIST = ['constructor', 'extends', 'implements', 'private', 'public', 'type'];
const JSDOC_TAGS_BLACKLIST = [
'constructor',
'enum',
'extends',
'implements',
'interface',
'lends',
'private',
'public',
'record',
'template',
'this',
'type',
'typedef',
];
/** A list of JSDoc @tags that might include a {type} after them. */
const JSDOC_TAGS_WITH_TYPES = ['export', 'param', 'return'];
/**
* A list of JSDoc @tags that might include a {type} after them. Only banned when a type is passed.
*/
const JSDOC_TAGS_WITH_TYPES = [
'const',
'export',
'param',
'return',
];

@@ -154,4 +175,9 @@ /**

} else if (arrayIncludes(JSDOC_TAGS_WITH_TYPES, tagName) && text[0] === '{') {
warnings.push('type annotations (using {...}) are redundant with TypeScript types');
warnings.push(
`the type annotation on @${tagName} is redundant with its TypeScript type, ` +
`remove the {...} part`);
continue;
} else if (tagName === 'dict') {
warnings.push('use index signatures (`[k: string]: type`) instead of @dict');
continue;
}

@@ -158,0 +184,0 @@

@@ -25,4 +25,4 @@ #!/usr/bin/env node

/** If provided, convert every type to the Closure {?} type */
isUntyped: boolean;
/** If provided, attempt to provide types rather than {?}. */
isTyped?: boolean;

@@ -41,3 +41,3 @@ /** If true, log internal debug warnings to the console. */

--externs=PATH save generated Closure externs.js to PATH
--untyped convert every type in TypeScript to the Closure {?} type
--typed [experimental] attempt to provide Closure types instead of {?}
`);

@@ -51,3 +51,3 @@ }

function loadSettingsFromArgs(args: string[]): {settings: Settings, tscArgs: string[]} {
let settings: Settings = {isUntyped: false};
let settings: Settings = {};
let parsedArgs = minimist(args);

@@ -64,4 +64,4 @@ for (let flag of Object.keys(parsedArgs)) {

break;
case 'untyped':
settings.isUntyped = true;
case 'typed':
settings.isTyped = true;
break;

@@ -142,3 +142,3 @@ case 'verbose':

es5Mode: false,
untyped: settings.isUntyped,
untyped: !settings.isTyped,
},

@@ -164,4 +164,6 @@ tsickleHost: {

{jsFiles: Map<string, string>, externs: string}|null {
const closureJSOptions: ClosureJSOptions = {...getDefaultClosureJSOptions(fileNames, settings),
...partialClosureJSOptions};
const closureJSOptions: ClosureJSOptions = {
...getDefaultClosureJSOptions(fileNames, settings),
...partialClosureJSOptions
};
// Parse and load the program without tsickle processing.

@@ -221,2 +223,10 @@ // This is so:

if (config.options.module !== ts.ModuleKind.CommonJS) {
// This is not an upstream TypeScript diagnostic, therefore it does not go
// through the diagnostics array mechanism.
console.error(
'tsickle converts TypeScript modules to Closure modules via CommonJS internally. Set tsconfig.js "module": "commonjs"');
return 1;
}
// Run tsickle+TSC to convert inputs to Closure JS files.

@@ -223,0 +233,0 @@ let closure = toClosureJS(config.options, config.fileNames, settings, diagnostics);

@@ -67,7 +67,12 @@ import {SourceMapConsumer, SourceMapGenerator} from 'source-map';

*/
export function sourceMapGeneratorToConsumerWithFileName(
sourceMapGenerator: SourceMapGenerator, fileName: string): SourceMapConsumer {
export function sourceMapGeneratorToConsumer(
sourceMapGenerator: SourceMapGenerator, fileName?: string,
sourceName?: string): SourceMapConsumer {
const rawSourceMap = sourceMapGenerator.toJSON();
rawSourceMap.sources = [fileName];
rawSourceMap.file = fileName;
if (sourceName) {
rawSourceMap.sources = [sourceName];
}
if (fileName) {
rawSourceMap.file = fileName;
}
return new SourceMapConsumer(rawSourceMap);

@@ -74,0 +79,0 @@ }

import * as path from 'path';
import {SourceMapConsumer, SourceMapGenerator} from 'source-map';
import {SourceMapGenerator} from 'source-map';
import * as ts from 'typescript';

@@ -9,3 +9,4 @@

import * as sourceMapUtils from './source_map_utils';
import {annotate, isDtsFileName} from './tsickle';
import * as tsickle from './tsickle';
import {isDtsFileName} from './tsickle';

@@ -239,4 +240,4 @@ /**

const tsickleSourceMapGenerator = this.tsickleSourceMaps.get(sourceMapKey)!;
const tsickleSourceMapConsumer = sourceMapUtils.sourceMapGeneratorToConsumerWithFileName(
tsickleSourceMapGenerator, sourceFileName);
const tsickleSourceMapConsumer = sourceMapUtils.sourceMapGeneratorToConsumer(
tsickleSourceMapGenerator, sourceFileName, sourceFileName);
tscSourceMapGenerator.applySourceMap(tsickleSourceMapConsumer);

@@ -251,5 +252,4 @@ }

this.decoratorDownlevelSourceMaps.get(sourceMapKey)!;
const decoratorDownlevelSourceMapConsumer =
sourceMapUtils.sourceMapGeneratorToConsumerWithFileName(
decoratorDownlevelSourceMapGenerator, sourceFileName);
const decoratorDownlevelSourceMapConsumer = sourceMapUtils.sourceMapGeneratorToConsumer(
decoratorDownlevelSourceMapGenerator, sourceFileName, sourceFileName);
tscSourceMapGenerator.applySourceMap(decoratorDownlevelSourceMapConsumer);

@@ -264,4 +264,4 @@ }

if (preexistingSourceMapGenerator) {
const preexistingSourceMapConsumer =
new SourceMapConsumer(preexistingSourceMapGenerator.toJSON());
const preexistingSourceMapConsumer = sourceMapUtils.sourceMapGeneratorToConsumer(
preexistingSourceMapGenerator, sourceFileName);
tscSourceMapGenerator.applySourceMap(preexistingSourceMapConsumer);

@@ -329,4 +329,5 @@ }

let {output, externs, diagnostics, sourceMap} =
annotate(program, sourceFile, this.options, this.delegate, this.tscOptions);
let {output, externs, diagnostics, sourceMap} = tsickle.annotate(
program, sourceFile, this.environment.pathToModuleName.bind(this.environment), this.options,
this.delegate, this.tscOptions);
if (externs) {

@@ -349,3 +350,3 @@ this.externs[fileName] = externs;

getGeneratedExterns(): string {
let allExterns = '';
let allExterns = tsickle.EXTERNS_HEADER;
for (let fileName of Object.keys(this.externs)) {

@@ -352,0 +353,0 @@ allExterns += `// externs from ${fileName}:\n`;

@@ -145,6 +145,9 @@ /**

* as {?}.
* @param symbolsToPrefix a mapping from symbols (`Foo`) to a prefix they should be emitted with
* (`tsickle_import.Foo`).
*/
constructor(
private typeChecker: ts.TypeChecker, private node: ts.Node,
private pathBlackList?: Set<string>) {}
private pathBlackList?: Set<string>,
private symbolsToAliasedNames: Map<ts.Symbol, string> = new Map<ts.Symbol, string>()) {}

@@ -161,2 +164,4 @@ /**

let str = '';
let alias = this.symbolsToAliasedNames.get(sym);
if (alias) return alias;
let writeText = (text: string) => str += text;

@@ -187,2 +192,8 @@ let doNothing = () => {

builder.buildSymbolDisplay(sym, writer, this.node);
// Clutz (https://github.com/angular/clutz) emits global type symbols hidden in a special
// ಠ_ಠ.clutz namespace. While most code seen by Tsickle will only ever see local aliases, Clutz
// symbols can be written by users directly in code, and they can appear by dereferencing
// TypeAliases. The code below simply strips the prefix, the remaining type name then matches
// Closure's type.
if (str.startsWith('ಠ_ಠ.clutz.')) str = str.substring('ಠ_ಠ.clutz.'.length);
return str;

@@ -232,4 +243,7 @@ }

// This is e.g. the T in a type like Foo<T>.
this.warn(`unhandled type flags: ${ts.TypeFlags[type.flags]}`);
return '?';
if (!type.symbol) {
this.warn(`TypeParameter without a symbol`); // should not happen (tm)
return '?';
}
return this.symbolToString(type.symbol);
case ts.TypeFlags.Object:

@@ -236,0 +250,0 @@ return this.translateObject(type as ts.ObjectType);

@@ -22,3 +22,3 @@ /**

}
array.push(ir.value!);
array.push(ir.value);
}

@@ -25,0 +25,0 @@ return array;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc