diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5f2ddfed95315..63b77f84dbcc9 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4070,6 +4070,7 @@ export interface JSDocImportTag extends JSDocTag { // NOTE: Ensure this is up-to-date with src/debug/debug.ts // dprint-ignore +/** @internal */ export const enum FlowFlags { Unreachable = 1 << 0, // Unreachable code Start = 1 << 1, // Start of flow graph @@ -4089,6 +4090,7 @@ export const enum FlowFlags { Condition = TrueCondition | FalseCondition, } +/** @internal */ export type FlowNode = | FlowStart | FlowLabel @@ -4099,6 +4101,7 @@ export type FlowNode = | FlowCall | FlowReduceLabel; +/** @internal */ export interface FlowNodeBase { flags: FlowFlags; id?: number; // Node id used by flow type cache in checker @@ -4107,22 +4110,26 @@ export interface FlowNodeBase { // FlowStart represents the start of a control flow. For a function expression or arrow // function, the node property references the function (which in turn has a flowNode // property for the containing control flow). +/** @internal */ export interface FlowStart extends FlowNodeBase { node?: FunctionExpression | ArrowFunction | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration; } // FlowLabel represents a junction with multiple possible preceding control flows. +/** @internal */ export interface FlowLabel extends FlowNodeBase { antecedents: FlowNode[] | undefined; } // FlowAssignment represents a node that assigns a value to a narrowable reference, // i.e. an identifier or a dotted name that starts with an identifier or 'this'. +/** @internal */ export interface FlowAssignment extends FlowNodeBase { node: Expression | VariableDeclaration | BindingElement; antecedent: FlowNode; } +/** @internal */ export interface FlowCall extends FlowNodeBase { node: CallExpression; antecedent: FlowNode; @@ -4130,12 +4137,14 @@ export interface FlowCall extends FlowNodeBase { // FlowCondition represents a condition that is known to be true or false at the // node's location in the control flow. +/** @internal */ export interface FlowCondition extends FlowNodeBase { node: Expression; antecedent: FlowNode; } // dprint-ignore +/** @internal */ export interface FlowSwitchClause extends FlowNodeBase { switchStatement: SwitchStatement; clauseStart: number; // Start index of case/default clause range @@ -4145,11 +4154,13 @@ export interface FlowSwitchClause extends FlowNodeBase { // FlowArrayMutation represents a node potentially mutates an array, i.e. an // operation of the form 'x.push(value)', 'x.unshift(value)' or 'x[n] = value'. +/** @internal */ export interface FlowArrayMutation extends FlowNodeBase { node: CallExpression | BinaryExpression; antecedent: FlowNode; } +/** @internal */ export interface FlowReduceLabel extends FlowNodeBase { target: FlowLabel; antecedents: FlowNode[]; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 7f7bf51496508..dd7852454197c 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -5793,61 +5793,6 @@ declare namespace ts { readonly moduleSpecifier: Expression; readonly attributes?: ImportAttributes; } - enum FlowFlags { - Unreachable = 1, - Start = 2, - BranchLabel = 4, - LoopLabel = 8, - Assignment = 16, - TrueCondition = 32, - FalseCondition = 64, - SwitchClause = 128, - ArrayMutation = 256, - Call = 512, - ReduceLabel = 1024, - Referenced = 2048, - Shared = 4096, - Label = 12, - Condition = 96, - } - type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel; - interface FlowNodeBase { - flags: FlowFlags; - id?: number; - } - interface FlowStart extends FlowNodeBase { - node?: FunctionExpression | ArrowFunction | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration; - } - interface FlowLabel extends FlowNodeBase { - antecedents: FlowNode[] | undefined; - } - interface FlowAssignment extends FlowNodeBase { - node: Expression | VariableDeclaration | BindingElement; - antecedent: FlowNode; - } - interface FlowCall extends FlowNodeBase { - node: CallExpression; - antecedent: FlowNode; - } - interface FlowCondition extends FlowNodeBase { - node: Expression; - antecedent: FlowNode; - } - interface FlowSwitchClause extends FlowNodeBase { - switchStatement: SwitchStatement; - clauseStart: number; - clauseEnd: number; - antecedent: FlowNode; - } - interface FlowArrayMutation extends FlowNodeBase { - node: CallExpression | BinaryExpression; - antecedent: FlowNode; - } - interface FlowReduceLabel extends FlowNodeBase { - target: FlowLabel; - antecedents: FlowNode[]; - antecedent: FlowNode; - } type FlowType = Type | IncompleteType; interface IncompleteType { flags: TypeFlags | 0;