(type, enclosingDeclaration, flags, writer)
| 52256 | } |
| 52257 | } |
| 52258 | function typeToString(type, enclosingDeclaration, flags, writer) { |
| 52259 | if (flags === void 0) { flags = 1048576 /* TypeFormatFlags.AllowUniqueESSymbolType */ | 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } |
| 52260 | if (writer === void 0) { writer = ts.createTextWriter(""); } |
| 52261 | var noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* TypeFormatFlags.NoTruncation */; |
| 52262 | var typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | (noTruncation ? 1 /* NodeBuilderFlags.NoTruncation */ : 0), writer); |
| 52263 | if (typeNode === undefined) |
| 52264 | return ts.Debug.fail("should always get typenode"); |
| 52265 | // The unresolved type gets a synthesized comment on `any` to hint to users that it's not a plain `any`. |
| 52266 | // Otherwise, we always strip comments out. |
| 52267 | var options = { removeComments: type !== unresolvedType }; |
| 52268 | var printer = ts.createPrinter(options); |
| 52269 | var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); |
| 52270 | printer.writeNode(4 /* EmitHint.Unspecified */, typeNode, /*sourceFile*/ sourceFile, writer); |
| 52271 | var result = writer.getText(); |
| 52272 | var maxLength = noTruncation ? ts.noTruncationMaximumTruncationLength * 2 : ts.defaultMaximumTruncationLength * 2; |
| 52273 | if (maxLength && result && result.length >= maxLength) { |
| 52274 | return result.substr(0, maxLength - "...".length) + "..."; |
| 52275 | } |
| 52276 | return result; |
| 52277 | } |
| 52278 | function getTypeNamesForErrorDisplay(left, right) { |
| 52279 | var leftStr = symbolValueDeclarationIsContextSensitive(left.symbol) ? typeToString(left, left.symbol.valueDeclaration) : typeToString(left); |
| 52280 | var rightStr = symbolValueDeclarationIsContextSensitive(right.symbol) ? typeToString(right, right.symbol.valueDeclaration) : typeToString(right); |
no test coverage detected
searching dependent graphs…