Skip to content

Commit

Permalink
🏷️ up to date with typescript@5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
volatile-static committed Jul 7, 2024
1 parent fbc9f63 commit 84e1721
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"typescript.tsdk": "node_modules/typescript/lib",
"editor.suggestSelection": "recentlyUsed",
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/bootstrap/modules/recent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ICON_URL, isValid } from './utils';
import { ICON_URL } from './utils';

export default function (win: MainWindow) {
// 注册“最近在读”菜单
Expand Down Expand Up @@ -41,7 +41,7 @@ export default function (win: MainWindow) {

async function addRecentTabsMenu({ target }: Event) {
const win = (target as any).ownerGlobal as MainWindow,
openedItems = win.Zotero_Tabs.getState().map(tab => tab.data?.itemID).filter(isValid),
openedItems = win.Zotero_Tabs.getState().map(tab => tab.data?.itemID).filter(i => !!i),
regex = new RegExp(`(${Zotero.Utilities.quotemeta(win.Zotero_Tabs._tabsMenuFilter)})`, 'gi');
let tabIndex = win.Zotero_Tabs.tabsMenuList.querySelectorAll('*[tabindex]').length;
if (__dev__)
Expand Down Expand Up @@ -107,7 +107,7 @@ function getHistoryInfo() {
return addon.history
.getAll()
.map((his, id) => (his ? { tim: his.record.lastTime ?? 0, id } : undefined))
.filter(isValid)
.filter(i => !!i)
.sort((a, b) => b.tim - a.tim)
.slice(0, 10)
.map(his => {
Expand All @@ -125,5 +125,5 @@ function getHistoryInfo() {
return null;
}
})
.filter(isValid);
.filter(i => !!i);
}
4 changes: 0 additions & 4 deletions src/bootstrap/modules/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ export class WorkerManager extends WorkerManagerBase<Worker> {
}
}

export function isValid<T>(x: T | undefined | null): x is T {
return Boolean(x);
}

export function isPDFReader(
reader: _ZoteroTypes.ReaderInstance
): reader is _ZoteroTypes.ReaderInstance<'pdf'> {
Expand Down

0 comments on commit 84e1721

Please sign in to comment.