@@ -4,26 +4,26 @@ import { ModuleResponseObject } from '../module/module';
44const ATTRIBUTES = '@attributes' ;
55
66export interface AdditionalInfoConstructorOptions {
7- os : string ;
8- debuggerOutput : string ;
9- registers : Array < Register > ;
10- modules : Array < Module > ;
11- threads : Array < ThreadCollection > ;
7+ os ? : string ;
8+ debuggerOutput ? : string ;
9+ registers ? : Array < Register > ;
10+ modules ? : Array < Module > ;
11+ threads ? : Array < ThreadCollection > ;
1212}
1313
1414export interface AdditionalInfoResponseObject {
1515 os : string ;
1616 process : {
17- DebugOutput : {
17+ DebugOutput ? : {
1818 DbgEngOutput : string ;
1919 } ,
20- exception : {
20+ exception ? : {
2121 registers : Record < string , string > ;
2222 } ,
23- threads : {
23+ threads ? : {
2424 thread : ThreadResponseObject | Array < ThreadResponseObject > ;
2525 } ,
26- modules : {
26+ modules ? : {
2727 module : Array < ModuleResponseObject > ;
2828 }
2929 } ;
@@ -45,7 +45,7 @@ export interface ThreadResponseObject {
4545 frame : FrameResponseObject | Array < FrameResponseObject >
4646}
4747
48- export class AdditionalInfo implements AdditionalInfoConstructorOptions {
48+ export class AdditionalInfo implements Required < AdditionalInfoConstructorOptions > {
4949 os : string ;
5050 debuggerOutput : string ;
5151 registers : Array < Register > ;
@@ -78,19 +78,19 @@ export class AdditionalInfo implements AdditionalInfoConstructorOptions {
7878 const os = response . os || '' ;
7979
8080 const debuggerOutput = ! isEmpty ( response . process . DebugOutput )
81- ? response . process . DebugOutput . DbgEngOutput
81+ ? response . process . DebugOutput ? .DbgEngOutput
8282 : '' ;
8383
84- const registers = ! isEmpty ( response . process . exception . registers )
85- ? createRegistersArray ( response . process . exception . registers )
84+ const registers = ! isEmpty ( response . process . exception ? .registers )
85+ ? createRegistersArray ( response . process . exception ? .registers )
8686 : [ ] ;
8787
8888 const threads = ! isEmpty ( response . process . threads )
89- ? createThreadCollectionArray ( response . process . threads . thread )
89+ ? createThreadCollectionArray ( response . process . threads ? .thread )
9090 : [ ] ;
9191
9292 const modules = ! isEmpty ( response . process . modules )
93- ? createModulesArray ( response . process . modules . module )
93+ ? createModulesArray ( response . process . modules ? .module )
9494 : [ ] ;
9595
9696 return new AdditionalInfo ( {
@@ -103,7 +103,7 @@ export class AdditionalInfo implements AdditionalInfoConstructorOptions {
103103 }
104104}
105105
106- function createModulesArray ( modules : Array < ModuleResponseObject > ) : Array < Module > {
106+ function createModulesArray ( modules ? : Array < ModuleResponseObject > ) : Array < Module > {
107107 if ( ! modules ) {
108108 modules = [ ] ;
109109 }
@@ -115,11 +115,15 @@ function createModulesArray(modules: Array<ModuleResponseObject>): Array<Module>
115115 return modules . map ( module => Module . fromResponseObject ( module ) ) ;
116116}
117117
118- function createRegistersArray ( registers : Record < string , string > ) : Array < Register > {
118+ function createRegistersArray ( registers ?: Record < string , string > ) : Array < Register > {
119+ if ( ! registers ) {
120+ return [ ] ;
121+ }
122+
119123 return Register . fromResponseObject ( registers ) ;
120124}
121125
122- function createThreadCollectionArray ( threads : ThreadResponseObject | Array < ThreadResponseObject > ) : Array < ThreadCollection > {
126+ function createThreadCollectionArray ( threads ? : ThreadResponseObject | Array < ThreadResponseObject > ) : Array < ThreadCollection > {
123127 if ( ! threads ) {
124128 threads = [ ] ;
125129 }
0 commit comments