Skip to content

Commit d0990a8

Browse files
renovate[bot]renovate-botfelixfbecker
authored
chore(deps): update dependency typescript to v4 (#464)
Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Felix Becker <[email protected]>
1 parent f9edd28 commit d0990a8

File tree

5 files changed

+57
-37
lines changed

5 files changed

+57
-37
lines changed

package-lock.json

Lines changed: 27 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
},
3636
"dependencies": {
3737
"file-url": "^2.0.2",
38-
"iconv-lite": "^0.4.15",
38+
"iconv-lite": "^0.6.2",
3939
"minimatch": "^3.0.4",
4040
"moment": "^2.29.1",
4141
"url-relative": "^1.0.0",
@@ -50,7 +50,7 @@
5050
"@types/file-url": "^2.0.0",
5151
"@types/minimatch": "^3.0.3",
5252
"@types/mocha": "^2.2.44",
53-
"@types/node": "7.0.32",
53+
"@types/node": "^14.14.14",
5454
"@types/semver": "^5.5.0",
5555
"@types/xmldom": "^0.1.29",
5656
"chai": "^4.0.2",
@@ -64,7 +64,7 @@
6464
"semver": "^5.7.1",
6565
"tslint": "^5.4.3",
6666
"tslint-config-prettier": "^1.6.0",
67-
"typescript": "^2.1.4",
67+
"typescript": "^4.1.3",
6868
"validate-commit-msg": "^2.14.0",
6969
"vsce": "^1.28.0",
7070
"vscode-debugadapter-testsupport": "^1.43.0"

src/phpDebug.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class PhpDebugSession extends vscode.DebugSession {
204204
/** launches the script as CLI */
205205
const launchScript = async () => {
206206
// check if program exists
207-
await new Promise((resolve, reject) =>
207+
await new Promise<void>((resolve, reject) =>
208208
fs.access(args.program!, fs.constants.F_OK, err => (err ? reject(err) : resolve()))
209209
)
210210
const runtimeArgs = args.runtimeArgs || []
@@ -219,10 +219,12 @@ class PhpDebugSession extends vscode.DebugSession {
219219
[runtimeExecutable, ...runtimeArgs, args.program!, ...programArgs],
220220
env
221221
)
222-
// we only do this for CLI mode. In normal listen mode, only a thread exited event is send.
223-
script.on('exit', () => {
224-
this.sendEvent(new vscode.TerminatedEvent())
225-
})
222+
if (script) {
223+
// we only do this for CLI mode. In normal listen mode, only a thread exited event is send.
224+
script.on('exit', () => {
225+
this.sendEvent(new vscode.TerminatedEvent())
226+
})
227+
}
226228
} else {
227229
const script = childProcess.spawn(runtimeExecutable, [...runtimeArgs, args.program!, ...programArgs], {
228230
cwd,
@@ -247,7 +249,7 @@ class PhpDebugSession extends vscode.DebugSession {
247249
}
248250
/** sets up a TCP server to listen for XDebug connections */
249251
const createServer = () =>
250-
new Promise((resolve, reject) => {
252+
new Promise<void>((resolve, reject) => {
251253
const server = (this._server = net.createServer())
252254
server.on('connection', async (socket: net.Socket) => {
253255
try {
@@ -316,7 +318,7 @@ class PhpDebugSession extends vscode.DebugSession {
316318
server.listen(
317319
args.port || 9000,
318320
args.hostname,
319-
(error: NodeJS.ErrnoException) => (error ? reject(error) : resolve())
321+
() => resolve()
320322
)
321323
})
322324
try {

src/terminal.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export class Terminal {
1313
public static launchInTerminal(
1414
dir: string,
1515
args: string[],
16-
envVars: { [key: string]: string }
17-
): Promise<CP.ChildProcess> {
16+
envVars: { [key: string]: string | undefined }
17+
): Promise<CP.ChildProcess | undefined> {
1818
return this.terminalService().launchInTerminal(dir, args, envVars)
1919
}
2020

@@ -46,29 +46,29 @@ export class Terminal {
4646
}
4747

4848
interface ITerminalService {
49-
launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string }): Promise<CP.ChildProcess>
49+
launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string | undefined }): Promise<CP.ChildProcess | undefined>
5050
killTree(pid: number): Promise<any>
5151
isOnPath(program: string): boolean
5252
}
5353

5454
class DefaultTerminalService implements ITerminalService {
5555
protected static TERMINAL_TITLE = 'VS Code Console'
5656

57-
public launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string }): Promise<CP.ChildProcess> {
57+
public launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string }): Promise<CP.ChildProcess | undefined> {
5858
throw new Error('launchInTerminal not implemented')
5959
}
6060

6161
public killTree(pid: number): Promise<any> {
6262
// on linux and OS X we kill all direct and indirect child processes as well
6363

64-
return new Promise<any>((resolve, reject) => {
64+
return new Promise<any | void>((resolve, reject) => {
6565
try {
6666
const cmd = Path.join(__dirname, './terminateProcess.sh')
6767
const result = (<any>CP).spawnSync(cmd, [pid.toString()])
6868
if (result.error) {
6969
reject(result.error)
7070
} else {
71-
resolve()
71+
resolve(undefined)
7272
}
7373
} catch (err) {
7474
reject(err)
@@ -100,8 +100,8 @@ class DefaultTerminalService implements ITerminalService {
100100
class WindowsTerminalService extends DefaultTerminalService {
101101
private static CMD = 'cmd.exe'
102102

103-
public launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string }): Promise<CP.ChildProcess> {
104-
return new Promise<CP.ChildProcess>((resolve, reject) => {
103+
public launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string }): Promise<CP.ChildProcess | undefined> {
104+
return new Promise<CP.ChildProcess | undefined>((resolve, reject) => {
105105
const title = `"${dir} - ${WindowsTerminalService.TERMINAL_TITLE}"`
106106
const command = `""${args.join('" "')}" & pause"` // use '|' to only pause on non-zero exit code
107107

@@ -127,11 +127,11 @@ class WindowsTerminalService extends DefaultTerminalService {
127127
// when killing a process in Windows its child processes are *not* killed but become root processes.
128128
// Therefore we use TASKKILL.EXE
129129

130-
return new Promise<any>((resolve, reject) => {
130+
return new Promise<any | void>((resolve, reject) => {
131131
const cmd = `taskkill /F /T /PID ${pid}`
132132
try {
133133
CP.execSync(cmd)
134-
resolve()
134+
resolve(undefined)
135135
} catch (err) {
136136
reject(err)
137137
}
@@ -143,8 +143,8 @@ class LinuxTerminalService extends DefaultTerminalService {
143143
private static LINUX_TERM = '/usr/bin/gnome-terminal' // private const string LINUX_TERM = "/usr/bin/x-terminal-emulator";
144144
private static WAIT_MESSAGE = 'Press any key to continue...'
145145

146-
public launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string }): Promise<CP.ChildProcess> {
147-
return new Promise<CP.ChildProcess>((resolve, reject) => {
146+
public launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string }): Promise<CP.ChildProcess | undefined> {
147+
return new Promise<CP.ChildProcess | undefined>((resolve, reject) => {
148148
if (!FS.existsSync(LinuxTerminalService.LINUX_TERM)) {
149149
reject(
150150
new Error(
@@ -181,7 +181,7 @@ class LinuxTerminalService extends DefaultTerminalService {
181181
cmd.on('exit', (code: number) => {
182182
if (code === 0) {
183183
// OK
184-
resolve() // since cmd is not the terminal process but just a launcher, we do not pass it in the resolve to the caller
184+
resolve(undefined) // since cmd is not the terminal process but just a launcher, we do not pass it in the resolve to the caller
185185
} else {
186186
reject(new Error('exit code: ' + code))
187187
}
@@ -193,8 +193,8 @@ class LinuxTerminalService extends DefaultTerminalService {
193193
class MacTerminalService extends DefaultTerminalService {
194194
private static OSASCRIPT = '/usr/bin/osascript' // osascript is the AppleScript interpreter on OS X
195195

196-
public launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string }): Promise<CP.ChildProcess> {
197-
return new Promise<CP.ChildProcess>((resolve, reject) => {
196+
public launchInTerminal(dir: string, args: string[], envVars: { [key: string]: string }): Promise<CP.ChildProcess | undefined> {
197+
return new Promise<CP.ChildProcess | undefined>((resolve, reject) => {
198198
// first fix the PATH so that 'runtimePath' can be found if installed with 'brew'
199199
// Utilities.FixPathOnOSX();
200200

@@ -230,7 +230,7 @@ class MacTerminalService extends DefaultTerminalService {
230230
osa.on('exit', (code: number) => {
231231
if (code === 0) {
232232
// OK
233-
resolve() // since cmd is not the terminal process but just the osa tool, we do not pass it in the resolve to the caller
233+
resolve(undefined) // since cmd is not the terminal process but just the osa tool, we do not pass it in the resolve to the caller
234234
} else {
235235
if (stderr) {
236236
reject(new Error(stderr))
@@ -247,7 +247,7 @@ class MacTerminalService extends DefaultTerminalService {
247247

248248
function extendObject<T>(objectCopy: T, object: T): T {
249249
for (let key in object) {
250-
if (object.hasOwnProperty(key)) {
250+
if (Object.prototype.hasOwnProperty.call(object, key)) {
251251
;(<any>objectCopy)[key] = (<any>object)[key]
252252
}
253253
}

src/test/dbgp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('DbgpConnection', () => {
7979
})
8080

8181
it('should error on invalid XML', () =>
82-
new Promise((resolve, reject) => {
82+
new Promise<void>((resolve, reject) => {
8383
conn.on('error', (error: Error) => {
8484
assert.isDefined(error)
8585
assert.instanceOf(error, Error)

0 commit comments

Comments
 (0)