Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export default tseslint.config(
rules: {
'@typescript-eslint/no-unsafe-type-assertion': 'error',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-return': 'error',
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/a2a-server/src/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function resolveEnvVarsInObject<T>(obj: T): T {
}

if (Array.isArray(obj)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion, @typescript-eslint/no-unsafe-return
return obj.map((item) => resolveEnvVarsInObject(item)) as unknown as T;
}

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/commands/extensions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const defaultRequestConfirmation: RequestConfirmationCallback = async (
message,
initial: false,
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return response.confirm;
Comment on lines +50 to 51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of disabling the no-unsafe-return rule, you can ensure type safety by explicitly converting the returned value to a boolean. The response.confirm property from the prompts library is of type any, but this function is expected to return a boolean. Using !! is a concise way to guarantee a boolean return value.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return response.confirm;
return !!response.confirm;

};

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/config/extensionRegistryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class ExtensionRegistryClient {
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const results = await fzf.find(query);
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return results.map((r: { item: RegistryExtension }) => r.item);
Comment on lines +86 to 87

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of disabling the no-unsafe-return rule, you can fix the underlying type issue. The results variable is inferred as any due to the no-unsafe-assignment suppression. By casting results to its expected type, you can ensure type safety for the return value and remove the need for this suppression.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return results.map((r: { item: RegistryExtension }) => r.item);
return (results as Array<{ item: RegistryExtension }>).map((r) => r.item);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export class ExtensionEnablementManager {
readConfig(): AllExtensionsEnablementConfig {
try {
const content = fs.readFileSync(this.configFilePath, 'utf-8');
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(content);
Comment on lines +182 to 183

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, it's better to explicitly cast the result of JSON.parse to the expected return type AllExtensionsEnablementConfig. This improves type safety and makes the code clearer.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(content);
return JSON.parse(content) as AllExtensionsEnablementConfig;

} catch (error) {
if (
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/config/extensions/extensionSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export async function promptForSetting(
name: 'value',
message: `${setting.name}\n${setting.description}`,
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return response.value;
Comment on lines +159 to 160

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, you can ensure type safety by casting the any value from the prompts library to the expected string type.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return response.value;
return response.value as string;

}

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/config/extensions/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function recursivelyHydrateStrings<T>(
if (Array.isArray(obj)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
return obj.map((item) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
recursivelyHydrateStrings(item, values),
) as unknown as T;
}
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/test-utils/mockCommandContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@ export const createMockCommandContext = (
return output;
};

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return merge(defaultMocks, overrides);
};
2 changes: 2 additions & 0 deletions packages/cli/src/ui/hooks/useAtCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ async function searchResourceCandidates(
const results = await fzf.find(normalizedPattern, {
limit: MAX_SUGGESTIONS_TO_SHOW * 3,
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return results.map(
(result: { item: ResourceSuggestionCandidate }) => result.item.suggestion,
);
Comment on lines +173 to 176

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of disabling the no-unsafe-return rule, you can fix the underlying type issue. The results variable is inferred as any. By casting results to its expected type, you can ensure type safety for the return value and remove the need for this suppression.

  return (results as Array<{ item: ResourceSuggestionCandidate }>).map(
    (result) => result.item.suggestion,
  );

Expand All @@ -193,6 +194,7 @@ async function searchAgentCandidates(
const results = await fzf.find(normalizedPattern, {
limit: MAX_SUGGESTIONS_TO_SHOW,
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return results.map((r: { item: Suggestion }) => r.item);
Comment on lines +197 to 198

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of disabling the no-unsafe-return rule, you can fix the underlying type issue. The results variable is inferred as any. By casting results to its expected type, you can ensure type safety for the return value and remove the need for this suppression.

  return (results as Array<{ item: Suggestion }>).map((r) => r.item);

}

Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/ui/utils/TableRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,13 @@ export const TableRenderer: React.FC<TableRendererProps> = ({
const wrappedRows = styledRows.map((row) => wrapAndProcessRow(row));

// Use the TIGHTEST widths that fit the wrapped content + padding
const adjustedWidths = actualColumnWidths.map((w) => w + COLUMN_PADDING);
const adjustedWidths = actualColumnWidths.map(
(w) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
w + COLUMN_PADDING,
);
Comment on lines +196 to +200

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of disabling the no-unsafe-return rule, you can provide an explicit type for the map callback parameter w. This resolves the type inference issue where actualColumnWidths is treated as any[], ensuring type safety without needing to suppress the lint rule.

    const adjustedWidths = actualColumnWidths.map((w: number) => w + COLUMN_PADDING);



return { wrappedHeaders, wrappedRows, adjustedWidths };
}, [styledHeaders, styledRows, terminalWidth]);
// Helper function to render a cell with proper width
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/activityLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ export class ActivityLogger extends EventEmitter {
body,
pending: true,
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-type-assertion
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-type-assertion, @typescript-eslint/no-unsafe-return
return (oldEnd as any).apply(this, [chunk, ...etc]);
};

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/utils/envVarResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function resolveEnvVarsInObjectInternal<T>(
visited.add(obj);
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const result = obj.map((item) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
resolveEnvVarsInObjectInternal(item, visited, customEnv),
) as unknown as T;
visited.delete(obj);
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/utils/gitUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const getLatestGitHubRelease = async (
if (!releaseTag) {
throw new Error(`Response did not include tag_name field`);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return releaseTag;
Comment on lines +86 to 87

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, you can ensure type safety by casting the releaseTag to the expected string type. The result of response.json() is any, so this cast makes the return value type-safe.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return releaseTag;
return releaseTag as string;

} catch (_error) {
debugLogger.debug(
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/utils/jsonoutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function tryParseJSON(input: string): object | null {

if (!Array.isArray(parsed) && Object.keys(parsed).length === 0) return null;

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return parsed;
Comment on lines +43 to 44

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, it's better to explicitly cast the result of JSON.parse to the expected object type. This improves type safety.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return parsed;
return parsed as object;

} catch (_err) {
return null;
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/utils/settingsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ export function setPendingSettingValue(
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const newSettings = JSON.parse(JSON.stringify(pendingSettings));
setNestedValue(newSettings, path, value);
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return newSettings;
Comment on lines +377 to 378

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, you can ensure type safety by casting the result of JSON.parse to the expected Settings type.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return newSettings;
return newSettings as Settings;

}

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/zed-integration/fileSystemService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class AcpFileSystemService implements FileSystemService {
sessionId: this.sessionId,
});

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return response.content;
Comment on lines +32 to 33

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, you can ensure type safety by casting response.content to a string. The response object is of type any due to a previous eslint-disable, so this cast clarifies the intended return type.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return response.content;
return response.content as string;

}

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/code_assist/oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ async function fetchCachedCredentials(): Promise<
for (const keyFile of pathsToTry) {
try {
const keyFileString = await fs.readFile(keyFile, 'utf-8');
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(keyFileString);
Comment on lines +639 to 640

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, it's better to explicitly cast the result of JSON.parse to the expected return type. This improves type safety.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(keyFileString);
return JSON.parse(keyFileString) as Credentials | JWTInput;

} catch (error) {
// Log specific error for debugging, but continue trying other paths
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/config/projectRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class ProjectRegistry {

try {
const content = await fs.promises.readFile(this.registryPath, 'utf8');
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(content);
Comment on lines +62 to 63

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, it's better to explicitly cast the result of JSON.parse to the expected RegistryData type. This improves type safety.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(content);
return JSON.parse(content) as RegistryData;

} catch (e) {
debugLogger.debug('Failed to load registry: ', e);
Expand Down
7 changes: 3 additions & 4 deletions packages/core/src/core/baseLlmClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ import type {
GenerateContentConfig,
} from '@google/genai';
import type { Config } from '../config/config.js';
import type { ContentGenerator } from './contentGenerator.js';
import type { AuthType } from './contentGenerator.js';
import type { ContentGenerator , AuthType } from './contentGenerator.js';
import { handleFallback } from '../fallback/handler.js';
import { getResponseText } from '../utils/partUtils.js';
import { reportError } from '../utils/errorReporting.js';
import { getErrorMessage } from '../utils/errors.js';
import { logMalformedJsonResponse } from '../telemetry/loggers.js';
import { MalformedJsonResponseEvent } from '../telemetry/types.js';
import { MalformedJsonResponseEvent , LlmRole } from '../telemetry/types.js';
import { retryWithBackoff } from '../utils/retry.js';
import type { ModelConfigKey } from '../services/modelConfigService.js';
import {
applyModelSelection,
createAvailabilityContextProvider,
} from '../availability/policyHelpers.js';
import { LlmRole } from '../telemetry/types.js';

const DEFAULT_MAX_ATTEMPTS = 5;

Expand Down Expand Up @@ -164,6 +162,7 @@ export class BaseLlmClient {
);

// If we are here, the content is valid (not empty and parsable).
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(
this.cleanJsonResponse(getResponseText(result)!.trim(), model),
);
Comment on lines +165 to 168

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, it's better to explicitly cast the result of JSON.parse to the expected Record<string, unknown> type. This improves type safety.

    return JSON.parse(
      this.cleanJsonResponse(getResponseText(result)!.trim(), model),
    ) as Record<string, unknown>;

Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/core/fakeContentGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class FakeContentGenerator implements ContentGenerator {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
role: LlmRole,
): Promise<GenerateContentResponse> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return Object.setPrototypeOf(
this.getNextResponse('generateContent', request),
GenerateContentResponse.prototype,
Expand Down Expand Up @@ -110,12 +111,14 @@ export class FakeContentGenerator implements ContentGenerator {
async countTokens(
request: CountTokensParameters,
): Promise<CountTokensResponse> {

return this.getNextResponse('countTokens', request);
}

async embedContent(
request: EmbedContentParameters,
): Promise<EmbedContentResponse> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return Object.setPrototypeOf(
this.getNextResponse('embedContent', request),
EmbedContentResponse.prototype,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/ide/ide-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ export class IdeClient {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const parsedJson = JSON.parse(textPart.text);
if (parsedJson && typeof parsedJson.content === 'string') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return parsedJson.content;
Comment on lines +351 to 352

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, you can ensure type safety by casting parsedJson.content to a string. The parsedJson object is of type any, so this cast clarifies the intended return type.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return parsedJson.content;
return parsedJson.content as string;

}
if (parsedJson && parsedJson.content === null) {
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/ide/ide-connection-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export async function getConnectionConfigFromFile(
`gemini-ide-server-${pid}.json`,
);
const portFileContents = await fs.promises.readFile(portFile, 'utf8');
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(portFileContents);
Comment on lines +126 to 127

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, it's better to explicitly cast the result of JSON.parse to the function's expected return type. This improves type safety.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(portFileContents);
return JSON.parse(portFileContents) as ConnectionConfig & { workspacePath?: string; ideInfo?: IdeInfo };

} catch (_) {
// For newer extension versions, the file name matches the pattern
Expand Down Expand Up @@ -167,6 +168,7 @@ export async function getConnectionConfigFromFile(
}
const parsedContents = fileContents.map((content) => {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(content);
Comment on lines +171 to 172

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, it's better to explicitly cast the result of JSON.parse to the expected type within the map. This improves type safety for the parsedContents array, which will in turn resolve the other no-unsafe-return issues later in this function.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(content);
return JSON.parse(content) as (ConnectionConfig & { workspacePath?: string; ideInfo?: IdeInfo });

} catch (e) {
logger.debug('Failed to parse JSON from config file: ', e);
Expand Down Expand Up @@ -196,6 +198,7 @@ export async function getConnectionConfigFromFile(
if (fileIndex !== -1) {
logger.debug(`Selected IDE connection file: ${matchingFiles[fileIndex]}`);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return selected;
}

Expand All @@ -213,6 +216,7 @@ export async function getConnectionConfigFromFile(
`Selected IDE connection file (matched port from env): ${matchingFiles[fileIndex]}`,
);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return selected;
}
}
Expand All @@ -225,6 +229,7 @@ export async function getConnectionConfigFromFile(
`Selected first valid IDE connection file: ${matchingFiles[fileIndex]}`,
);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return selected;
}

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/services/chatRecordingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ export class ChatRecordingService {
private readConversation(): ConversationRecord {
try {
this.cachedLastConvData = fs.readFileSync(this.conversationFile!, 'utf8');
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(this.cachedLastConvData);
Comment on lines +422 to 423

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of suppressing the no-unsafe-return error, it's better to explicitly cast the result of JSON.parse to the expected ConversationRecord type. This improves type safety.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(this.cachedLastConvData);
return JSON.parse(this.cachedLastConvData) as ConversationRecord;

} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/utils/filesearch/fileSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class RecursiveFileSearch implements FileSearch {
filteredCandidates = await this.fzf
.find(pattern)
.then((results: Array<FzfResultItem<string>>) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
results.map((entry: FzfResultItem<string>) => entry.item),
)
.catch(() => {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/utils/safeJsonStringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function safeJsonStringify(
}
seen.add(value);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return value;
},
space,
Expand Down Expand Up @@ -60,6 +61,7 @@ export function safeJsonStringifyBooleanValuesOnly(obj: any): string {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
if ((value as Config) !== null && !configSeen) {
configSeen = true;
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return value;
}
if (typeof value === 'boolean') {
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/utils/stdio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,33 @@ export function createWorkingStdio() {
const inkStdout = new Proxy(process.stdout, {
get(target, prop, receiver) {
if (prop === 'write') {

return writeToStdout;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const value = Reflect.get(target, prop, receiver);
if (typeof value === 'function') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return value.bind(target);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return value;
},
});

const inkStderr = new Proxy(process.stderr, {
get(target, prop, receiver) {
if (prop === 'write') {

return writeToStderr;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const value = Reflect.get(target, prop, receiver);
if (typeof value === 'function') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return value.bind(target);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return value;
},
});
Expand Down
Loading