Skip to content

Commit

Permalink
fix(@angular-devkit/architect): explicitly type functions
Browse files Browse the repository at this point in the history
Closes: #11992
hansl authored and vikerman committed Aug 28, 2018
1 parent 02bfde5 commit 62e72fe
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@

import {
Path,
PathFragment,
basename,
dirname,
join,
@@ -128,7 +129,7 @@ export class TestProjectHost extends NodeJsSyncHost {
virtualFs.stringToFileBuffer(content.concat(str)));
}

fileMatchExists(dir: string, regex: RegExp) {
fileMatchExists(dir: string, regex: RegExp): PathFragment | undefined {
const [fileName] = this.scopedSync().list(normalize(dir)).filter(name => name.match(regex));

return fileName || undefined;
4 changes: 2 additions & 2 deletions packages/angular_devkit/build_angular/test/utils.ts
Original file line number Diff line number Diff line change
@@ -7,13 +7,13 @@
*/

import { TestProjectHost } from '@angular-devkit/architect/testing';
import { join, normalize } from '@angular-devkit/core';
import { Path, join, normalize } from '@angular-devkit/core';


const devkitRoot = normalize((global as any)._DevKitRoot); // tslint:disable-line:no-any
const workspaceRoot = join(devkitRoot, 'tests/angular_devkit/build_angular/hello-world-app/');
export const host = new TestProjectHost(workspaceRoot);
export const outputPath = normalize('dist');
export const outputPath: Path = normalize('dist');

export const browserTargetSpec = { project: 'app', target: 'build' };
export const devServerTargetSpec = { project: 'app', target: 'serve' };
6 changes: 3 additions & 3 deletions packages/angular_devkit/core/src/virtual-fs/host/test.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import { Observable } from 'rxjs';
import { Path, join, normalize } from '../path';
import { Path, PathFragment, join, normalize } from '../path';
import { fileBufferToString, stringToFileBuffer } from './buffer';
import { FileBuffer, HostWatchEvent, HostWatchOptions, Stats } from './interface';
import { SimpleMemoryHost, SimpleMemoryHostStats } from './memory';
@@ -96,7 +96,7 @@ export class TestHost extends SimpleMemoryHost {

return super._rename(from, to);
}
protected _list(path: Path) {
protected _list(path: Path): PathFragment[] {
this._records.push({ kind: 'list', path });

return super._list(path);
@@ -135,7 +135,7 @@ export class TestHost extends SimpleMemoryHost {
return fileBufferToString(super._read(normalize(path)));
}

$list(path: string) {
$list(path: string): PathFragment[] {
return super._list(normalize(path));
}

0 comments on commit 62e72fe

Please sign in to comment.