Skip to content

fix: build typescript error#29

Merged
ThanatosDi merged 2 commits intomainfrom
feat/claude-refactor
Mar 10, 2026
Merged

fix: build typescript error#29
ThanatosDi merged 2 commits intomainfrom
feat/claude-refactor

Conversation

@ThanatosDi
Copy link
Owner

No description provided.

- 補齊 TaskCreate/TaskUpdate 缺少的必要欄位
- 為 store.tasks[0] 加上非空斷言
- 補齊 updateSettings 測試中缺少的 locale 屬性
@ThanatosDi ThanatosDi merged commit 7b989d7 into main Mar 10, 2026
2 of 4 checks passed
@ThanatosDi ThanatosDi deleted the feat/claude-refactor branch March 10, 2026 12:07
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses TypeScript build errors by updating test files to correctly handle new schema fields and potential null values, ensuring type safety and test accuracy. Additionally, it includes a minor version increment across the project's configuration files, signaling a patch release.

Highlights

  • Version Bump: The project version has been incremented from 3.2.0 to 3.2.1 across the backend API definition (backend/backend.py), the frontend package.json, and the Python project configuration (pyproject.toml).
  • TypeScript Error Fixes in Task Store Tests: Resolved potential TypeScript build errors in src/stores/__tests__/taskStore.spec.ts by importing the TaskCreate type, adding non-null assertion operators (!) for array access, and updating task data objects in test cases to include new fields (src_filename, dst_filename, rename_rule, enabled) to align with an expanded TaskCreate schema.
  • Setting Store Test Update: A test case in src/stores/__tests__/settingStore.spec.ts was updated to include the locale field in the updateSettings payload, reflecting changes in the expected data structure for settings updates.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • backend/backend.py
    • Updated the API version from 3.2.0 to 3.2.1.
  • package.json
    • Updated the project version in package.json from 3.2.0 to 3.2.1.
  • pyproject.toml
    • Updated the project version in pyproject.toml from 3.2.0 to 3.2.1.
  • src/stores/tests/settingStore.spec.ts
    • Modified a test case for updateSettings to include the locale field in the payload when expecting an error.
  • src/stores/tests/taskStore.spec.ts
    • Imported the TaskCreate type.
    • Added non-null assertion operators (!) to store.tasks[0] access in several test expectations.
    • Expanded taskData objects in createTask and updateTask test cases to include src_filename, dst_filename, rename_rule, and enabled fields, aligning with an updated TaskCreate schema.
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request primarily addresses TypeScript build errors by updating test files to conform to stricter type definitions. This includes providing full data objects for function calls in tests and using non-null assertions. The application version has also been consistently updated across backend.py, package.json, and pyproject.toml. My review includes suggestions to replace non-null assertions (!) in the test files with safer and more descriptive matchers like toHaveProperty. This improves test robustness and readability.


expect(store.tasks).toHaveLength(2)
expect(store.tasks[0].name).toBe('測試任務')
expect(store.tasks[0]!.name).toBe('測試任務')

Choose a reason for hiding this comment

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

medium

While the non-null assertion operator (!) is safe here due to the preceding length check, it's a good practice to avoid it to prevent potential runtime errors if the code logic changes. Using a matcher like toHaveProperty is safer and more expressive for this kind of test.

Suggested change
expect(store.tasks[0]!.name).toBe('測試任務')
expect(store.tasks[0]).toHaveProperty('name', '測試任務')

expect(result).toEqual(sampleTask)
expect(store.tasks).toHaveLength(1)
expect(store.tasks[0].name).toBe('測試任務')
expect(store.tasks[0]!.name).toBe('測試任務')

Choose a reason for hiding this comment

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

medium

Similar to the previous comment, consider avoiding the non-null assertion (!). The toHaveProperty matcher can be used here as well for a safer and more descriptive assertion.

Suggested change
expect(store.tasks[0]!.name).toBe('測試任務')
expect(store.tasks[0]).toHaveProperty('name', '測試任務')


expect(result.name).toBe('更新後的名稱')
expect(store.tasks[0].name).toBe('更新後的名稱')
expect(store.tasks[0]!.name).toBe('更新後的名稱')

Choose a reason for hiding this comment

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

medium

To maintain consistency and avoid non-null assertions, you can use toHaveProperty here as well.

Suggested change
expect(store.tasks[0]!.name).toBe('更新後的名稱')
expect(store.tasks[0]).toHaveProperty('name', '更新後的名稱')


expect(result).toEqual(logs)
expect(store.tasks[0].logs).toEqual(logs)
expect(store.tasks[0]!.logs).toEqual(logs)

Choose a reason for hiding this comment

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

medium

To avoid the non-null assertion (!), you can use toHaveProperty to check the logs property. This combines the check and assertion into a single, more readable statement.

Suggested change
expect(store.tasks[0]!.logs).toEqual(logs)
expect(store.tasks[0]).toHaveProperty('logs', logs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant