@@ -15,14 +15,15 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
1515import { isMacintosh , IProcessEnvironment } from 'vs/base/common/platform' ;
1616import { ILogService } from 'vs/platform/log/common/log' ;
1717import { IWindowsService } from 'vs/platform/windows/common/windows' ;
18+ import { IWindowState } from 'vs/platform/windows/electron-main/windows' ;
1819
1920const DEFAULT_BACKGROUND_COLOR = '#1E1E1E' ;
2021
2122export class IssueService implements IIssueService {
2223 _serviceBrand : any ;
23- _issueWindow : BrowserWindow ;
24+ _issueWindow : BrowserWindow | null ;
2425 _issueParentWindow : BrowserWindow ;
25- _processExplorerWindow : BrowserWindow ;
26+ _processExplorerWindow : BrowserWindow | null ;
2627
2728 constructor (
2829 private machineId : string ,
@@ -108,7 +109,7 @@ export class IssueService implements IIssueService {
108109
109110 this . _issueWindow . focus ( ) ;
110111
111- return TPromise . as ( null ) ;
112+ return TPromise . as ( undefined ) ;
112113 }
113114
114115 openProcessExplorer ( data : ProcessExplorerData ) : TPromise < void > {
@@ -150,7 +151,7 @@ export class IssueService implements IIssueService {
150151
151152 this . _processExplorerWindow . loadURL ( `${ require . toUrl ( 'vs/code/electron-browser/processExplorer/processExplorer.html' ) } ?config=${ encodeURIComponent ( JSON . stringify ( config ) ) } ` ) ;
152153
153- this . _processExplorerWindow . on ( 'close' , ( ) => this . _processExplorerWindow = void 0 ) ;
154+ this . _processExplorerWindow . on ( 'close' , ( ) => this . _processExplorerWindow = null ) ;
154155
155156 parentWindow . on ( 'close' , ( ) => {
156157 if ( this . _processExplorerWindow ) {
@@ -163,12 +164,12 @@ export class IssueService implements IIssueService {
163164 // Focus
164165 this . _processExplorerWindow . focus ( ) ;
165166
166- return TPromise . as ( null ) ;
167+ return TPromise . as ( undefined ) ;
167168 }
168169
169- private getWindowPosition ( parentWindow : BrowserWindow , defaultWidth : number , defaultHeight : number ) {
170+ private getWindowPosition ( parentWindow : BrowserWindow , defaultWidth : number , defaultHeight : number ) : IWindowState {
170171 // We want the new window to open on the same display that the parent is in
171- let displayToUse : Electron . Display ;
172+ let displayToUse : Electron . Display | undefined ;
172173 const displays = screen . getAllDisplays ( ) ;
173174
174175 // Single Display
@@ -196,16 +197,14 @@ export class IssueService implements IIssueService {
196197 }
197198 }
198199
199- let state = {
200+ const state : IWindowState = {
200201 width : defaultWidth ,
201- height : defaultHeight ,
202- x : undefined ,
203- y : undefined
202+ height : defaultHeight
204203 } ;
205204
206205 const displayBounds = displayToUse . bounds ;
207- state . x = displayBounds . x + ( displayBounds . width / 2 ) - ( state . width / 2 ) ;
208- state . y = displayBounds . y + ( displayBounds . height / 2 ) - ( state . height / 2 ) ;
206+ state . x = displayBounds . x + ( displayBounds . width / 2 ) - ( state . width ! / 2 ) ;
207+ state . y = displayBounds . y + ( displayBounds . height / 2 ) - ( state . height ! / 2 ) ;
209208
210209 if ( displayBounds . width > 0 && displayBounds . height > 0 /* Linux X11 sessions sometimes report wrong display bounds */ ) {
211210 if ( state . x < displayBounds . x ) {
@@ -224,11 +223,11 @@ export class IssueService implements IIssueService {
224223 state . y = displayBounds . y ; // prevent window from falling out of the screen to the bottom
225224 }
226225
227- if ( state . width > displayBounds . width ) {
226+ if ( state . width ! > displayBounds . width ) {
228227 state . width = displayBounds . width ; // prevent window from exceeding display bounds width
229228 }
230229
231- if ( state . height > displayBounds . height ) {
230+ if ( state . height ! > displayBounds . height ) {
232231 state . height = displayBounds . height ; // prevent window from exceeding display bounds height
233232 }
234233 }
@@ -259,7 +258,11 @@ export class IssueService implements IIssueService {
259258 } ) ;
260259 }
261260
262- private getIssueReporterPath ( data : IssueReporterData , features : IssueReporterFeatures ) {
261+ private getIssueReporterPath ( data : IssueReporterData , features : IssueReporterFeatures ) : string {
262+ if ( ! this . _issueWindow ) {
263+ throw new Error ( 'Issue window has been disposed' ) ;
264+ }
265+
263266 const windowConfiguration = {
264267 appRoot : this . environmentService . appRoot ,
265268 nodeCachedDataDir : this . environmentService . nodeCachedDataDir ,
0 commit comments