diff --git a/packages/angular_devkit/schematics/src/engine/engine.ts b/packages/angular_devkit/schematics/src/engine/engine.ts index 033ecc5a383d..8d0ba84ed8ca 100644 --- a/packages/angular_devkit/schematics/src/engine/engine.ts +++ b/packages/angular_devkit/schematics/src/engine/engine.ts @@ -90,10 +90,10 @@ export class CollectionImpl>, ) {} - get description() { + get description(): CollectionDescription { return this._description; } - get name() { + get name(): string { return this.description.name || ''; } @@ -183,10 +183,10 @@ export class SchematicEngine { return this._description; } - get collection() { + get collection(): Collection { return this._collection; } diff --git a/packages/angular_devkit/schematics/src/sink/host.ts b/packages/angular_devkit/schematics/src/sink/host.ts index 489addec1083..a2e3a4b34a14 100644 --- a/packages/angular_devkit/schematics/src/sink/host.ts +++ b/packages/angular_devkit/schematics/src/sink/host.ts @@ -86,7 +86,7 @@ export class HostSink extends SimpleSinkBase { return EMPTY; } - _done() { + _done(): Observable { // Really commit everything to the actual filesystem. return concatObservables( observableFrom([...this._filesToDelete.values()]).pipe( diff --git a/packages/angular_devkit/schematics/src/tree/action.ts b/packages/angular_devkit/schematics/src/tree/action.ts index 495d1db2e510..2f5f5e38e900 100644 --- a/packages/angular_devkit/schematics/src/tree/action.ts +++ b/packages/angular_devkit/schematics/src/tree/action.ts @@ -27,7 +27,7 @@ let _id = 1; export class ActionList implements Iterable { private _actions: Action[] = []; - protected _action(action: Partial) { + protected _action(action: Partial): void { this._actions.push({ ...(action as Action), id: _id++, @@ -35,20 +35,20 @@ export class ActionList implements Iterable { }); } - create(path: Path, content: Buffer) { + create(path: Path, content: Buffer): void { this._action({ kind: 'c', path, content }); } - overwrite(path: Path, content: Buffer) { + overwrite(path: Path, content: Buffer): void { this._action({ kind: 'o', path, content }); } - rename(path: Path, to: Path) { + rename(path: Path, to: Path): void { this._action({ kind: 'r', path, to }); } - delete(path: Path) { + delete(path: Path): void { this._action({ kind: 'd', path }); } - optimize() { + optimize(): void { const toCreate = new Map(); const toRename = new Map(); const toOverwrite = new Map(); @@ -122,13 +122,13 @@ export class ActionList implements Iterable { }); } - push(action: Action) { + push(action: Action): void { this._actions.push(action); } - get(i: number) { + get(i: number): Action { return this._actions[i]; } - has(action: Action) { + has(action: Action): boolean { for (let i = 0; i < this._actions.length; i++) { const a = this._actions[i]; if (a.id == action.id) { @@ -144,10 +144,10 @@ export class ActionList implements Iterable { find(predicate: (value: Action) => boolean): Action | null { return this._actions.find(predicate) || null; } - forEach(fn: (value: Action, index: number, array: Action[]) => void, thisArg?: {}) { + forEach(fn: (value: Action, index: number, array: Action[]) => void, thisArg?: {}): void { this._actions.forEach(fn, thisArg); } - get length() { + get length(): number { return this._actions.length; } [Symbol.iterator](): IterableIterator { diff --git a/packages/angular_devkit/schematics/src/tree/entry.ts b/packages/angular_devkit/schematics/src/tree/entry.ts index 15eeac8d003e..fc2f898d437b 100644 --- a/packages/angular_devkit/schematics/src/tree/entry.ts +++ b/packages/angular_devkit/schematics/src/tree/entry.ts @@ -15,10 +15,10 @@ export class SimpleFileEntry implements FileEntry { private _content: Buffer, ) {} - get path() { + get path(): Path { return this._path; } - get content() { + get content(): Buffer { return this._content; } } @@ -31,10 +31,10 @@ export class LazyFileEntry implements FileEntry { private _load: (path?: Path) => Buffer, ) {} - get path() { + get path(): Path { return this._path; } - get content() { + get content(): Buffer { return this._content || (this._content = this._load(this._path)); } } diff --git a/packages/angular_devkit/schematics/src/tree/host-tree.ts b/packages/angular_devkit/schematics/src/tree/host-tree.ts index d2d7852630e5..6f5e55970543 100644 --- a/packages/angular_devkit/schematics/src/tree/host-tree.ts +++ b/packages/angular_devkit/schematics/src/tree/host-tree.ts @@ -107,7 +107,7 @@ export class HostTree implements Tree { private _dirCache = new Map(); - [TreeSymbol]() { + [TreeSymbol](): this { return this; } @@ -132,19 +132,19 @@ export class HostTree implements Tree { return normalize('/' + path); } - protected _willCreate(path: Path) { + protected _willCreate(path: Path): boolean { return this._record.willCreate(path); } - protected _willOverwrite(path: Path) { + protected _willOverwrite(path: Path): boolean { return this._record.willOverwrite(path); } - protected _willDelete(path: Path) { + protected _willDelete(path: Path): boolean { return this._record.willDelete(path); } - protected _willRename(path: Path) { + protected _willRename(path: Path): boolean { return this._record.willRename(path); } diff --git a/packages/angular_devkit/schematics/src/tree/null.ts b/packages/angular_devkit/schematics/src/tree/null.ts index df88209b5b9d..2a772a8fbceb 100644 --- a/packages/angular_devkit/schematics/src/tree/null.ts +++ b/packages/angular_devkit/schematics/src/tree/null.ts @@ -43,11 +43,11 @@ export class NullTreeDirEntry implements DirEntry { return null; } - visit() {} + visit(): void {} } export class NullTree implements Tree { - [TreeSymbol]() { + [TreeSymbol](): this { return this; } @@ -74,10 +74,10 @@ export class NullTree implements Tree { get(_path: string) { return null; } - getDir(path: string) { + getDir(path: string): NullTreeDirEntry { return new NullTreeDirEntry(normalize('/' + path)); } - visit() {} + visit(): void {} // Change content of host files. beginUpdate(path: string): never { diff --git a/packages/angular_devkit/schematics/src/tree/recorder.ts b/packages/angular_devkit/schematics/src/tree/recorder.ts index a6a0b6e7d70f..2bf13504deee 100644 --- a/packages/angular_devkit/schematics/src/tree/recorder.ts +++ b/packages/angular_devkit/schematics/src/tree/recorder.ts @@ -59,11 +59,11 @@ export class UpdateRecorderBase implements UpdateRecorder { return new UpdateRecorderBase(entry.content, entry.path); } - get path() { + get path(): string { return this._path; } - protected _assertIndex(index: number) { + protected _assertIndex(index: number): void { if (index < 0 || index > this.content.original.length) { throw new IndexOutOfBoundException(index, 0, this.content.original.length); } diff --git a/packages/angular_devkit/schematics/src/tree/scoped.ts b/packages/angular_devkit/schematics/src/tree/scoped.ts index 1f7dbc01fc65..b8cdbc09d23a 100644 --- a/packages/angular_devkit/schematics/src/tree/scoped.ts +++ b/packages/angular_devkit/schematics/src/tree/scoped.ts @@ -197,7 +197,7 @@ export class ScopedTree implements Tree { return scopedActions; } - [TreeSymbol]() { + [TreeSymbol](): this { return this; } diff --git a/packages/angular_devkit/schematics/src/tree/static.ts b/packages/angular_devkit/schematics/src/tree/static.ts index 9057221653d5..f4a7ce1b8618 100644 --- a/packages/angular_devkit/schematics/src/tree/static.ts +++ b/packages/angular_devkit/schematics/src/tree/static.ts @@ -10,15 +10,19 @@ import { SchematicsException } from '../exception/exception'; import { FilterHostTree, HostTree } from './host-tree'; import { FilePredicate, MergeStrategy, Tree } from './interface'; -export function empty() { +export function empty(): HostTree { return new HostTree(); } -export function branch(tree: Tree) { +export function branch(tree: Tree): Tree { return tree.branch(); } -export function merge(tree: Tree, other: Tree, strategy: MergeStrategy = MergeStrategy.Default) { +export function merge( + tree: Tree, + other: Tree, + strategy: MergeStrategy = MergeStrategy.Default, +): Tree { tree.merge(other, strategy); return tree;