Skip to content

Commit 94a6576

Browse files
authored
Add debug format helpers for more enums (#49732)
1 parent 9872184 commit 94a6576

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

src/compiler/checker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace ts {
6161
GeneratorYield,
6262
}
6363

64-
const enum TypeFacts {
64+
export const enum TypeFacts {
6565
None = 0,
6666
TypeofEQString = 1 << 0, // typeof x === "string"
6767
TypeofEQNumber = 1 << 1, // typeof x === "number"
@@ -169,7 +169,7 @@ namespace ts {
169169
WriteType,
170170
}
171171

172-
const enum CheckMode {
172+
export const enum CheckMode {
173173
Normal = 0, // Normal type checking
174174
Contextual = 1 << 0, // Explicitly assigned contextual type, therefore not cacheable
175175
Inferential = 1 << 1, // Inferential typing
@@ -182,7 +182,7 @@ namespace ts {
182182
// we need to preserve generic types instead of substituting them for constraints
183183
}
184184

185-
const enum SignatureCheckMode {
185+
export const enum SignatureCheckMode {
186186
BivariantCallback = 1 << 0,
187187
StrictCallback = 1 << 1,
188188
IgnoreReturnTypes = 1 << 2,

src/compiler/debug.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,22 @@ namespace ts {
394394
return formatEnum(flags, (ts as any).FlowFlags, /*isFlags*/ true);
395395
}
396396

397+
export function formatRelationComparisonResult(result: RelationComparisonResult | undefined): string {
398+
return formatEnum(result, (ts as any).RelationComparisonResult, /*isFlags*/ true);
399+
}
400+
401+
export function formatCheckMode(mode: CheckMode | undefined): string {
402+
return formatEnum(mode, (ts as any).CheckMode, /*isFlags*/ true);
403+
}
404+
405+
export function formatSignatureCheckMode(mode: SignatureCheckMode | undefined): string {
406+
return formatEnum(mode, (ts as any).SignatureCheckMode, /*isFlags*/ true);
407+
}
408+
409+
export function formatTypeFacts(facts: TypeFacts | undefined): string {
410+
return formatEnum(facts, (ts as any).TypeFacts, /*isFlags*/ true);
411+
}
412+
397413
let isDebugInfoEnabled = false;
398414

399415
interface ExtendedDebugModule {

0 commit comments

Comments
 (0)