Skip to content

Commit aa3961a

Browse files
committed
refactor: use node v12 types, matching WORKSPACE version
1 parent a7cf22c commit aa3961a

File tree

12 files changed

+25
-23
lines changed

12 files changed

+25
-23
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.13
1+
12.14

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"@types/loader-utils": "^1.1.3",
109109
"@types/minimatch": "3.0.3",
110110
"@types/minimist": "^1.2.0",
111-
"@types/node": "10.12.30",
111+
"@types/node": "13.13.5",
112112
"@types/node-fetch": "^2.1.6",
113113
"@types/npm-package-arg": "^6.1.0",
114114
"@types/progress": "^2.0.3",

packages/angular/cli/lib/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ if (process.env['NG_CLI_PROFILING']) {
156156
standardInput = process.stdin;
157157
} catch (e) {
158158
delete process.stdin;
159-
process.stdin = new Duplex();
159+
process.stdin = new Duplex() as NodeJS.ReadStream;
160160
standardInput = process.stdin;
161161
}
162162

packages/angular_devkit/benchmark/src/monitored-process.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export class LocalMonitoredProcess implements MonitoredProcess {
5050
const childProcess = spawn(cmd, args, spawnOptions);
5151

5252
// Emit output and stats.
53-
childProcess.stdout.on('data', (data: Buffer) => this.stdout.next(data));
54-
childProcess.stderr.on('data', (data: Buffer) => this.stderr.next(data));
53+
childProcess.stdout?.on('data', (data: Buffer) => this.stdout.next(data));
54+
childProcess.stderr?.on('data', (data: Buffer) => this.stderr.next(data));
5555
const statsSubs = timer(0, this.pollingRate).pipe(
5656
concatMap(() => from(pidtree(childProcess.pid, { root: true }))),
5757
concatMap((pids: number[]) => from(pidusage(pids, { maxage: 5 * this.pollingRate }))),

packages/angular_devkit/build_angular/src/dev-server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export function serveWebpackBrowser(
169169
publicHost = `${options.ssl ? 'https' : 'http'}://${publicHost}`;
170170
}
171171
clientAddress = url.parse(publicHost);
172-
options.publicHost = clientAddress.host;
172+
options.publicHost = clientAddress.host ?? undefined;
173173
}
174174

175175
// Add live reload config.

packages/angular_devkit/build_webpack/src/webpack-dev-server/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ export function runWebpackDevServer(
9292
obs.error(err);
9393
} else {
9494
const address = this.address();
95+
if (address === null) {
96+
throw new Error('Server is not listening');
97+
}
9598
result = {
9699
success: true,
97100
port: typeof address === 'string' ? 0 : address.port,

packages/angular_devkit/core/node/host.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ function loadFSWatcher() {
5858
}
5959
}
6060

61-
type FsFunction0<R> = (cb: (err?: Error, result?: R) => void) => void;
62-
type FsFunction1<R, T1> = (p1: T1, cb: (err?: Error, result?: R) => void) => void;
61+
type FsFunction0<R> = (cb: (err?: Error|null, result?: R) => void) => void;
62+
type FsFunction1<R, T1> = (p1: T1, cb: (err?: Error|null, result?: R) => void) => void;
6363
type FsFunction2<R, T1, T2>
64-
= (p1: T1, p2: T2, cb: (err?: Error, result?: R) => void) => void;
64+
= (p1: T1, p2: T2, cb: (err?: Error|null, result?: R) => void) => void;
6565

6666

6767
function _callFs<R>(fn: FsFunction0<R>): Observable<R>;
@@ -70,7 +70,7 @@ function _callFs<R, T1, T2>(fn: FsFunction2<R, T1, T2>, p1: T1, p2: T2): Observa
7070

7171
function _callFs<ResultT>(fn: Function, ...args: {}[]): Observable<ResultT> {
7272
return new Observable(obs => {
73-
fn(...args, (err?: Error, result?: ResultT) => {
73+
fn(...args, (err?: Error|null, result?: ResultT) => {
7474
if (err) {
7575
obs.error(err);
7676
} else {
@@ -176,12 +176,12 @@ export class NodeJsAsyncHost implements virtualFs.Host<fs.Stats> {
176176
}
177177

178178
isDirectory(path: Path): Observable<boolean> {
179-
return _callFs(fs.stat, getSystemPath(path)).pipe(
179+
return _callFs<fs.Stats, string>(fs.stat, getSystemPath(path)).pipe(
180180
map(stat => stat.isDirectory()),
181181
);
182182
}
183183
isFile(path: Path): Observable<boolean> {
184-
return _callFs(fs.stat, getSystemPath(path)).pipe(
184+
return _callFs<fs.Stats, string>(fs.stat, getSystemPath(path)).pipe(
185185
map(stat => stat.isFile()),
186186
);
187187
}

packages/angular_devkit/core/src/terminal/caps.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88
import ReadableStream = NodeJS.ReadableStream;
99
import WriteStream = NodeJS.WriteStream;
10-
import Socket = NodeJS.Socket;
1110
const supportsColor = require('../../third_party/github.com/chalk/supports-color');
1211

1312
/**
@@ -76,7 +75,7 @@ function _getColumns() {
7675

7776

7877
function _createCapabilities(
79-
stream: Socket,
78+
stream: WriteStream,
8079
isTerminalStream: boolean,
8180
level: 0|1|2|3 = supportsColor.stdout.level,
8281
): StreamCapabilities {
@@ -96,7 +95,7 @@ function _createCapabilities(
9695

9796

9897
export function getCapabilities(
99-
stream: Socket,
98+
stream: WriteStream,
10099
isTerminalStream = !!stream.isTTY,
101100
): StreamCapabilities {
102101
let maybeCaps = streamMap.get(stream);

packages/angular_devkit/schematics/tasks/package-manager/executor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ export default function(
125125
}
126126
});
127127
if (options.hideOutput) {
128-
childProcess.stdout.on('data', (data: Buffer) =>
128+
childProcess.stdout?.on('data', (data: Buffer) =>
129129
bufferedOutput.push({ stream: process.stdout, data: data }));
130-
childProcess.stderr.on('data', (data: Buffer) =>
130+
childProcess.stderr?.on('data', (data: Buffer) =>
131131
bufferedOutput.push({ stream: process.stderr, data: data }));
132132
}
133133
});

packages/ngtools/webpack/src/angular_compiler_plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ export class AngularCompilerPlugin {
565565

566566
// Handle child messages.
567567
this._typeCheckerProcess.on('message', message => {
568-
switch (message.kind) {
568+
switch ((message as {kind: MESSAGE_KIND}).kind) {
569569
case MESSAGE_KIND.Log:
570570
const logMessage = message as LogMessage;
571571
this._logger.log(logMessage.level, `\n${logMessage.message}`);

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"./node_modules/@types"
2828
],
2929
"types": [
30-
"node"
30+
"node/v12"
3131
],
3232
"paths": {
3333
"@_/benchmark": [ "./packages/_/benchmark/src/index" ],

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,10 +1453,10 @@
14531453
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.4.tgz#1581d6c16e3d4803eb079c87d4ac893ee7501c2c"
14541454
integrity sha512-x26ur3dSXgv5AwKS0lNfbjpCakGIduWU1DU91Zz58ONRWrIKGunmZBNv4P7N+e27sJkiGDsw/3fT4AtsqQBrBA==
14551455

1456-
"@types/node@10.12.30":
1457-
version "10.12.30"
1458-
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.30.tgz#4c2b4f0015f214f8158a347350481322b3b29b2f"
1459-
integrity sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==
1456+
"@types/node@13.13.5":
1457+
version "13.13.5"
1458+
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.5.tgz#96ec3b0afafd64a4ccea9107b75bf8489f0e5765"
1459+
integrity sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g==
14601460

14611461
"@types/node@^10.1.0":
14621462
version "10.17.21"

0 commit comments

Comments
 (0)