Skip to content

refactor(@angular-devkit/schematics): initial isolated declarations type adjustments #30663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions goldens/public-api/angular_devkit/schematics/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ export type CollectionDescription<CollectionMetadataT extends object> = Collecti

// @public (undocumented)
export class CollectionImpl<CollectionT extends object, SchematicT extends object> implements Collection<CollectionT, SchematicT> {
constructor(_description: CollectionDescription<CollectionT>, _engine: SchematicEngine<CollectionT, SchematicT>, baseDescriptions?: Array<CollectionDescription<CollectionT>> | undefined);
constructor(_description: CollectionDescription<CollectionT>, _engine: SchematicEngine<CollectionT, SchematicT>, baseDescriptions?: CollectionDescription<CollectionT>[] | undefined);
// (undocumented)
readonly baseDescriptions?: Array<CollectionDescription<CollectionT>> | undefined;
readonly baseDescriptions?: CollectionDescription<CollectionT>[] | undefined;
// (undocumented)
createSchematic(name: string, allowPrivate?: boolean): Schematic<CollectionT, SchematicT>;
// (undocumented)
Expand Down
4 changes: 2 additions & 2 deletions packages/angular_devkit/schematics/src/engine/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class CollectionImpl<CollectionT extends object, SchematicT extends objec
constructor(
private _description: CollectionDescription<CollectionT>,
private _engine: SchematicEngine<CollectionT, SchematicT>,
public readonly baseDescriptions?: Array<CollectionDescription<CollectionT>>,
public readonly baseDescriptions?: CollectionDescription<CollectionT>[] | undefined,
) {}

get description(): CollectionDescription<CollectionT> {
Expand Down Expand Up @@ -180,7 +180,7 @@ export class SchematicEngine<CollectionT extends object, SchematicT extends obje

constructor(
private _host: EngineHost<CollectionT, SchematicT>,
protected _workflow?: Workflow,
protected _workflow?: Workflow | undefined,
) {}

get workflow(): Workflow | null {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/schematics/src/rules/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function asSource(rule: Rule): Source {
return (context) => callRule(rule, staticEmpty(), context);
}

export function branchAndMerge(rule: Rule, strategy = MergeStrategy.Default): Rule {
export function branchAndMerge(rule: Rule, strategy: MergeStrategy = MergeStrategy.Default): Rule {
return (tree, context) => {
return callRule(rule, tree.branch(), context).pipe(
map((branch) => tree.merge(branch, strategy || context.strategy)),
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/schematics/src/rules/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { FileOperator, Rule } from '../engine/interface';
import { FileEntry } from '../tree/interface';
import { chain, composeFileOperators, forEach, when } from './base';

export const TEMPLATE_FILENAME_RE = /\.template$/;
export const TEMPLATE_FILENAME_RE: RegExp = /\.template$/;

export class OptionIsNotDefinedException extends BaseException {
constructor(name: string) {
Expand Down
8 changes: 4 additions & 4 deletions packages/angular_devkit/schematics/src/sink/dryrun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export type DryRunEvent =
| DryRunRenameEvent;

export class DryRunSink extends HostSink {
protected _subject = new Subject<DryRunEvent>();
protected _fileDoesNotExistExceptionSet = new Set<string>();
protected _fileAlreadyExistExceptionSet = new Set<string>();
protected _subject: Subject<DryRunEvent> = new Subject();
protected _fileDoesNotExistExceptionSet: Set<string> = new Set();
protected _fileAlreadyExistExceptionSet: Set<string> = new Set();

readonly reporter: Observable<DryRunEvent> = this._subject.asObservable();

Expand All @@ -72,7 +72,7 @@ export class DryRunSink extends HostSink {
this._fileDoesNotExistExceptionSet.add(path);
}

override _done() {
override _done(): Observable<void> {
this._fileAlreadyExistExceptionSet.forEach((path) => {
this._subject.next({
kind: 'error',
Expand Down
8 changes: 4 additions & 4 deletions packages/angular_devkit/schematics/src/sink/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import { CreateFileAction } from '../tree/action';
import { SimpleSinkBase } from './sink';

export class HostSink extends SimpleSinkBase {
protected _filesToDelete = new Set<Path>();
protected _filesToRename = new Set<[Path, Path]>();
protected _filesToCreate = new Map<Path, Buffer>();
protected _filesToUpdate = new Map<Path, Buffer>();
protected _filesToDelete: Set<Path> = new Set();
protected _filesToRename: Set<[Path, Path]> = new Set();
protected _filesToCreate: Map<Path, Buffer<ArrayBufferLike>> = new Map();
protected _filesToUpdate: Map<Path, Buffer<ArrayBufferLike>> = new Map();

constructor(
protected _host: virtualFs.Host,
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/schematics/src/tree/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ContentHasMutatedException } from '../exception/exception';
import { FileEntry, UpdateRecorder } from './interface';

export class IndexOutOfBoundException extends BaseException {
constructor(index: number, min: number, max = Infinity) {
constructor(index: number, min: number, max: number = Infinity) {
super(`Index ${index} outside of range [${min}, ${max}].`);
}
}
Expand Down