mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
chore(compiler): Enable strict property access TS compiler flag. (#6255)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -17,8 +17,8 @@ describe('AuthDialog', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
originalEnv = { ...process.env };
|
||||
process.env.GEMINI_API_KEY = '';
|
||||
process.env.GEMINI_DEFAULT_AUTH_TYPE = '';
|
||||
process.env['GEMINI_API_KEY'] = '';
|
||||
process.env['GEMINI_DEFAULT_AUTH_TYPE'] = '';
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('AuthDialog', () => {
|
||||
});
|
||||
|
||||
it('should show an error if the initial auth type is invalid', () => {
|
||||
process.env.GEMINI_API_KEY = '';
|
||||
process.env['GEMINI_API_KEY'] = '';
|
||||
|
||||
const settings: LoadedSettings = new LoadedSettings(
|
||||
{
|
||||
@@ -62,7 +62,7 @@ describe('AuthDialog', () => {
|
||||
|
||||
describe('GEMINI_API_KEY environment variable', () => {
|
||||
it('should detect GEMINI_API_KEY environment variable', () => {
|
||||
process.env.GEMINI_API_KEY = 'foobar';
|
||||
process.env['GEMINI_API_KEY'] = 'foobar';
|
||||
|
||||
const settings: LoadedSettings = new LoadedSettings(
|
||||
{
|
||||
@@ -94,8 +94,8 @@ describe('AuthDialog', () => {
|
||||
});
|
||||
|
||||
it('should not show the GEMINI_API_KEY message if GEMINI_DEFAULT_AUTH_TYPE is set to something else', () => {
|
||||
process.env.GEMINI_API_KEY = 'foobar';
|
||||
process.env.GEMINI_DEFAULT_AUTH_TYPE = AuthType.LOGIN_WITH_GOOGLE;
|
||||
process.env['GEMINI_API_KEY'] = 'foobar';
|
||||
process.env['GEMINI_DEFAULT_AUTH_TYPE'] = AuthType.LOGIN_WITH_GOOGLE;
|
||||
|
||||
const settings: LoadedSettings = new LoadedSettings(
|
||||
{
|
||||
@@ -127,8 +127,8 @@ describe('AuthDialog', () => {
|
||||
});
|
||||
|
||||
it('should show the GEMINI_API_KEY message if GEMINI_DEFAULT_AUTH_TYPE is set to use api key', () => {
|
||||
process.env.GEMINI_API_KEY = 'foobar';
|
||||
process.env.GEMINI_DEFAULT_AUTH_TYPE = AuthType.USE_GEMINI;
|
||||
process.env['GEMINI_API_KEY'] = 'foobar';
|
||||
process.env['GEMINI_DEFAULT_AUTH_TYPE'] = AuthType.USE_GEMINI;
|
||||
|
||||
const settings: LoadedSettings = new LoadedSettings(
|
||||
{
|
||||
@@ -162,7 +162,7 @@ describe('AuthDialog', () => {
|
||||
|
||||
describe('GEMINI_DEFAULT_AUTH_TYPE environment variable', () => {
|
||||
it('should select the auth type specified by GEMINI_DEFAULT_AUTH_TYPE', () => {
|
||||
process.env.GEMINI_DEFAULT_AUTH_TYPE = AuthType.LOGIN_WITH_GOOGLE;
|
||||
process.env['GEMINI_DEFAULT_AUTH_TYPE'] = AuthType.LOGIN_WITH_GOOGLE;
|
||||
|
||||
const settings: LoadedSettings = new LoadedSettings(
|
||||
{
|
||||
@@ -222,7 +222,7 @@ describe('AuthDialog', () => {
|
||||
});
|
||||
|
||||
it('should show an error and fall back to default if GEMINI_DEFAULT_AUTH_TYPE is invalid', () => {
|
||||
process.env.GEMINI_DEFAULT_AUTH_TYPE = 'invalid-auth-type';
|
||||
process.env['GEMINI_DEFAULT_AUTH_TYPE'] = 'invalid-auth-type';
|
||||
|
||||
const settings: LoadedSettings = new LoadedSettings(
|
||||
{
|
||||
|
||||
@@ -42,18 +42,18 @@ export function AuthDialog({
|
||||
}
|
||||
|
||||
const defaultAuthType = parseDefaultAuthType(
|
||||
process.env.GEMINI_DEFAULT_AUTH_TYPE,
|
||||
process.env['GEMINI_DEFAULT_AUTH_TYPE'],
|
||||
);
|
||||
|
||||
if (process.env.GEMINI_DEFAULT_AUTH_TYPE && defaultAuthType === null) {
|
||||
if (process.env['GEMINI_DEFAULT_AUTH_TYPE'] && defaultAuthType === null) {
|
||||
return (
|
||||
`Invalid value for GEMINI_DEFAULT_AUTH_TYPE: "${process.env.GEMINI_DEFAULT_AUTH_TYPE}". ` +
|
||||
`Invalid value for GEMINI_DEFAULT_AUTH_TYPE: "${process.env['GEMINI_DEFAULT_AUTH_TYPE']}". ` +
|
||||
`Valid values are: ${Object.values(AuthType).join(', ')}.`
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
process.env.GEMINI_API_KEY &&
|
||||
process.env['GEMINI_API_KEY'] &&
|
||||
(!defaultAuthType || defaultAuthType === AuthType.USE_GEMINI)
|
||||
) {
|
||||
return 'Existing API key detected (GEMINI_API_KEY). Select "Gemini API Key" option to use it.';
|
||||
@@ -65,7 +65,7 @@ export function AuthDialog({
|
||||
label: 'Login with Google',
|
||||
value: AuthType.LOGIN_WITH_GOOGLE,
|
||||
},
|
||||
...(process.env.CLOUD_SHELL === 'true'
|
||||
...(process.env['CLOUD_SHELL'] === 'true'
|
||||
? [
|
||||
{
|
||||
label: 'Use Cloud Shell user credentials',
|
||||
@@ -86,13 +86,13 @@ export function AuthDialog({
|
||||
}
|
||||
|
||||
const defaultAuthType = parseDefaultAuthType(
|
||||
process.env.GEMINI_DEFAULT_AUTH_TYPE,
|
||||
process.env['GEMINI_DEFAULT_AUTH_TYPE'],
|
||||
);
|
||||
if (defaultAuthType) {
|
||||
return item.value === defaultAuthType;
|
||||
}
|
||||
|
||||
if (process.env.GEMINI_API_KEY) {
|
||||
if (process.env['GEMINI_API_KEY']) {
|
||||
return item.value === AuthType.USE_GEMINI;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,15 +103,16 @@ export const Footer: React.FC<FooterProps> = ({
|
||||
>
|
||||
{isTrustedFolder === false ? (
|
||||
<Text color={theme.status.warning}>untrusted</Text>
|
||||
) : process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec' ? (
|
||||
) : process.env['SANDBOX'] &&
|
||||
process.env['SANDBOX'] !== 'sandbox-exec' ? (
|
||||
<Text color="green">
|
||||
{process.env.SANDBOX.replace(/^gemini-(?:cli-)?/, '')}
|
||||
{process.env['SANDBOX'].replace(/^gemini-(?:cli-)?/, '')}
|
||||
</Text>
|
||||
) : process.env.SANDBOX === 'sandbox-exec' ? (
|
||||
) : process.env['SANDBOX'] === 'sandbox-exec' ? (
|
||||
<Text color={theme.status.warning}>
|
||||
macOS Seatbelt{' '}
|
||||
<Text color={theme.text.secondary}>
|
||||
({process.env.SEATBELT_PROFILE})
|
||||
({process.env['SEATBELT_PROFILE']})
|
||||
</Text>
|
||||
</Text>
|
||||
) : (
|
||||
|
||||
@@ -321,7 +321,7 @@ function visitBoxRow(element: React.ReactNode): Row {
|
||||
const segment: StyledText = { text, props: parentProps ?? {} };
|
||||
|
||||
// Check the 'wrap' property from the merged props to decide the segment type.
|
||||
if (parentProps === undefined || parentProps.wrap === 'wrap') {
|
||||
if (parentProps === undefined || parentProps['wrap'] === 'wrap') {
|
||||
hasSeenWrapped = true;
|
||||
row.segments.push(segment);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user