Merged
Conversation
CodFrm
reviewed
Jan 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
这个 PR 修正了 ScriptCat 的 TypeScript 类型定义,主要包括参数命名优化和类型精确化。这些改动提升了 API 的类型安全性和代码可读性。
主要改动:
- 将参数名从通用的
obj/objs改为更具描述性的tab/tabs - 将
GM_addElement的any类型改为更精确的Record<string, string | number | boolean> - 修正
GM.addStyle的返回类型从Promise<void>到Promise<HTMLStyleElement> - 将
parentNode类型从Element/EventTarget精确化为Node
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/types/scriptcat.d.ts | 更新 GM API 的类型定义,包括参数命名、属性类型精确化和返回类型修正 |
| src/template/scriptcat.d.tpl | 与 scriptcat.d.ts 保持一致的类型定义模板更新 |
| src/app/service/content/gm_api/gm_api.ts | 将 GM_addElement 的 parentNode 参数类型从 EventTarget 改为 Node |
| src/app/service/content/content.ts | 同步更新 parentNode 类型为 Node,并移除不必要的 Element 类型断言 |
这些类型修正都是正确的改进,使类型定义更准确地反映了实际的 API 行为和 DOM 标准。所有更改在类型定义文件和实现代码之间保持了一致性。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.