refactor(代码重复): 抽取共享工具函数与 UI 组件,消除多处重复实现

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
雨霖铃
2026-06-19 20:55:39 +08:00
parent 47d74f999e
commit 0f3060dcf3
24 changed files with 386 additions and 309 deletions
+4 -4
View File
@@ -77,15 +77,15 @@ describe('chromeStorage', () => {
describe('get 类型签名', () => {
it('无默认值时应推断为可选返回类型', () => {
const getWithoutDefault = () => storageUtil.get('app/theme');
expectTypeOf<ReturnType<typeof getWithoutDefault>>().toEqualTypeOf<
const _getWithoutDefault = () => storageUtil.get('app/theme');
expectTypeOf<ReturnType<typeof _getWithoutDefault>>().toEqualTypeOf<
Promise<string | undefined>
>();
});
it('有默认值时应推断为确定返回类型', () => {
const getWithDefault = () => storageUtil.get('app/theme', 'light');
expectTypeOf<ReturnType<typeof getWithDefault>>().toEqualTypeOf<Promise<string>>();
const _getWithDefault = () => storageUtil.get('app/theme', 'light');
expectTypeOf<ReturnType<typeof _getWithDefault>>().toEqualTypeOf<Promise<string>>();
});
});