Fix unsafe assertions in code_assist folder. (#19706)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Christian Gunderman
2026-02-20 20:44:23 +00:00
committed by GitHub
parent c04602f209
commit b7555ab1e1
5 changed files with 62 additions and 38 deletions
+7 -6
View File
@@ -115,9 +115,9 @@ async function initOauthClient(
if (
credentials &&
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
(credentials as { type?: string }).type ===
'external_account_authorized_user'
typeof credentials === 'object' &&
'type' in credentials &&
credentials.type === 'external_account_authorized_user'
) {
const auth = new GoogleAuth({
scopes: OAUTH_SCOPE,
@@ -603,9 +603,10 @@ export function getAvailablePort(): Promise<number> {
}
const server = net.createServer();
server.listen(0, () => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const address = server.address()! as net.AddressInfo;
port = address.port;
const address = server.address();
if (address && typeof address === 'object') {
port = address.port;
}
});
server.on('listening', () => {
server.close();