Skip to content

Commit 3de6f48

Browse files
committed
refactor(@angular-devkit/core): adjust types to support strict mode
1 parent ba1aa08 commit 3de6f48

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

packages/angular_devkit/core/src/logger/logger.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ export class Logger extends Observable<LogEntry> implements LoggerApi {
142142
subscribe(_observerOrNext?: PartialObserver<LogEntry> | ((value: LogEntry) => void),
143143
_error?: (error: Error) => void,
144144
_complete?: () => void): Subscription {
145-
return this._observable.subscribe.apply(this._observable, arguments as unknown);
145+
return this._observable.subscribe.apply(
146+
this._observable,
147+
(arguments as unknown) as Parameters<Observable<LogEntry>['subscribe']>,
148+
);
146149
}
147150
forEach(next: (value: LogEntry) => void, PromiseCtor?: typeof Promise): Promise<void> {
148151
return this._observable.forEach(next, PromiseCtor);

packages/angular_devkit/core/src/virtual-fs/path_spec.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import {
99
InvalidPathException,
1010
Path,
11+
PathFragment,
1112
asWindowsPath,
1213
basename,
1314
dirname,
@@ -83,7 +84,7 @@ describe('path', () => {
8384
});
8485

8586
describe('split', () => {
86-
const tests = [
87+
const tests: [string, string[]][] = [
8788
['a', ['a']],
8889
['/a/b', ['', 'a', 'b']],
8990
['a/b', ['a', 'b']],
@@ -92,31 +93,29 @@ describe('path', () => {
9293
['/', ['']],
9394
];
9495

95-
for (const goldens of tests) {
96-
const result = goldens.pop();
97-
const args = goldens.map((x: string) => normalize(x)) as Path[];
96+
for (const [input, result] of tests) {
97+
const normalizedInput = normalize(input);
9898

99-
it(`(${JSON.stringify(args)}) == "${result}"`, () => {
100-
expect(split.apply(null, args)).toEqual(result);
99+
it(`(${JSON.stringify(normalizedInput)}) == "${result}"`, () => {
100+
expect(split(normalizedInput)).toEqual(result as PathFragment[]);
101101
});
102102
}
103103
});
104104

105105
describe('join', () => {
106-
const tests = [
107-
['a', 'a'],
108-
['/a', '/b', '/a/b'],
109-
['/a', '/b', '/c', '/a/b/c'],
110-
['/a', 'b', 'c', '/a/b/c'],
111-
['a', 'b', 'c', 'a/b/c'],
106+
const tests: [string[], string][] = [
107+
[['a'], 'a'],
108+
[['/a', '/b'], '/a/b'],
109+
[['/a', '/b', '/c'], '/a/b/c'],
110+
[['/a', 'b', 'c'], '/a/b/c'],
111+
[['a', 'b', 'c'], 'a/b/c'],
112112
];
113113

114-
for (const goldens of tests) {
115-
const result = goldens.pop();
116-
const args = goldens.map(x => normalize(x)) as Path[];
114+
for (const [input, result] of tests) {
115+
const args = input.map(x => normalize(x)) as [Path, ...Path[]];
117116

118117
it(`(${JSON.stringify(args)}) == "${result}"`, () => {
119-
expect(join.apply(null, args)).toBe(result);
118+
expect(join(...args)).toBe(result);
120119
});
121120
}
122121
});

0 commit comments

Comments
 (0)