Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface IIoHost {
* Notifies the host of a message.
* The caller waits until the notification completes.
*/
notify<T>(msg: IoMessage<T>): Promise<void>;
notify(msg: IoMessage<unknown>): Promise<void>;

/**
* Notifies the host of a message that requires a response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type ActionLessRequest<T, U> = Omit<IoRequest<T, U>, 'action'>;
* Wraps a client provided IoHost and provides additional features & services to toolkit internal classes.
*/
export interface IoHelper extends IIoHost {
notify<T>(msg: ActionLessMessage<T>): Promise<void>;
notify(msg: ActionLessMessage<unknown>): Promise<void>;
requestResponse<T, U>(msg: ActionLessRequest<T, U>): Promise<U>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class TestIoHost implements IIoHost {
this.requestSpy = jest.fn();
}

public async notify<T>(msg: IoMessage<T>): Promise<void> {
public async notify(msg: IoMessage<unknown>): Promise<void> {
if (isMessageRelevantForLevel(msg, this.level)) {
this.notifySpy(msg);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-cdk/lib/cli/activity-printer/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IoMessage } from '../../toolkit/cli-io-host';
import { maxResourceTypeLength, stackEventHasErrorMessage } from '../../util';

export interface IActivityPrinter {
notify<T>(msg: IoMessage<T>): void;
notify(msg: IoMessage<unknown>): void;
}

export interface ActivityPrinterProps {
Expand Down Expand Up @@ -51,10 +51,10 @@ export abstract class ActivityPrinterBase implements IActivityPrinter {
/**
* Receive a stack activity message
*/
public notify(msg: IoMessage<any>): void {
public notify(msg: IoMessage<unknown>): void {
switch (msg.code) {
case 'CDK_TOOLKIT_I5501':
this.start(msg.data);
this.start(msg.data as { stack: CloudFormationStackArtifact });
break;
case 'CDK_TOOLKIT_I5502':
this.activity(msg.data as StackActivity);
Expand Down
8 changes: 4 additions & 4 deletions packages/aws-cdk/lib/toolkit/cli-io-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class CliIoHost implements IIoHost {

// Corked Logging
private corkedCounter = 0;
private readonly corkedLoggingBuffer: IoMessage<any>[] = [];
private readonly corkedLoggingBuffer: IoMessage<unknown>[] = [];

private constructor(props: CliIoHostProps = {}) {
this.currentAction = props.currentAction ?? 'none';
Expand Down Expand Up @@ -220,7 +220,7 @@ export class CliIoHost implements IIoHost {
* Notifies the host of a message.
* The caller waits until the notification completes.
*/
public async notify<T>(msg: IoMessage<T>): Promise<void> {
public async notify(msg: IoMessage<unknown>): Promise<void> {
if (this._internalIoHost) {
return this._internalIoHost.notify(msg);
}
Expand Down Expand Up @@ -250,7 +250,7 @@ export class CliIoHost implements IIoHost {
/**
* Detect stack activity messages so they can be send to the printer.
*/
private isStackActivity(msg: IoMessage<any>) {
private isStackActivity(msg: IoMessage<unknown>) {
return [
'CDK_TOOLKIT_I5501',
'CDK_TOOLKIT_I5502',
Expand Down Expand Up @@ -376,7 +376,7 @@ export class CliIoHost implements IIoHost {
/**
* Formats a message for console output with optional color support
*/
private formatMessage(msg: IoMessage<any>): string {
private formatMessage(msg: IoMessage<unknown>): string {
// apply provided style or a default style if we're in TTY mode
let message_text = this.isTTY
? styleMap[msg.level](msg.message)
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/test/_helpers/test-io-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class TestIoHost implements IIoHost {
this.requestSpy = jest.fn();
}

public async notify<T>(msg: IoMessage<T>): Promise<void> {
public async notify(msg: IoMessage<unknown>): Promise<void> {
if (isMessageRelevantForLevel(msg, this.level)) {
this.notifySpy(msg);
}
Expand Down