mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
Merge pull request #1522 from asger-semmle/ts-stringify-recursive-type-alias
Approved by xiemaisi
This commit is contained in:
@@ -244,7 +244,7 @@ function parseSingleFile(filename: string): {ast: ts.SourceFile, code: string} {
|
||||
|
||||
function handleOpenProjectCommand(command: OpenProjectCommand) {
|
||||
let tsConfigFilename = String(command.tsConfig);
|
||||
let tsConfig = ts.readConfigFile(tsConfigFilename, ts.sys.readFile)
|
||||
let tsConfig = ts.readConfigFile(tsConfigFilename, ts.sys.readFile);
|
||||
let basePath = pathlib.dirname(tsConfigFilename);
|
||||
|
||||
let parseConfigHost: ts.ParseConfigHost = {
|
||||
|
||||
@@ -436,7 +436,10 @@ export class TypeTable {
|
||||
let toStringValue: string;
|
||||
// Some types can't be stringified. Just discard the type if we can't stringify it.
|
||||
try {
|
||||
toStringValue = this.typeChecker.typeToString(type);
|
||||
toStringValue = this.typeChecker.typeToString(
|
||||
type,
|
||||
undefined,
|
||||
ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope);
|
||||
} catch (e) {
|
||||
console.warn("Recovered from a compiler crash while stringifying a type. Discarding the type.");
|
||||
console.warn(e.stack);
|
||||
@@ -454,7 +457,11 @@ export class TypeTable {
|
||||
// Some types can't be stringified. Just discard the type if we can't stringify it.
|
||||
try {
|
||||
toStringValue =
|
||||
this.typeChecker.signatureToString(signature, signature.declaration, ts.TypeFormatFlags.None, kind);
|
||||
this.typeChecker.signatureToString(
|
||||
signature,
|
||||
signature.declaration,
|
||||
ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope,
|
||||
kind);
|
||||
} catch (e) {
|
||||
console.warn("Recovered from a compiler crash while stringifying a signature. Discarding the signature.");
|
||||
console.warn(e.stack);
|
||||
|
||||
Reference in New Issue
Block a user