Skip to content

Commit

Permalink
fix: 🧩 添加类型注解
Browse files Browse the repository at this point in the history
  • Loading branch information
Plumbiu committed Aug 10, 2023
1 parent 39c1555 commit 7c9ee33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 5 additions & 11 deletions packages/web/src/utils/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Chart {
private relations: IRelations,
private versions: IVersions,
) {
this.nodesSet = new Set(nodes.map((item: any) => item.name))
this.nodesSet = new Set(nodes.map((item: INodes) => item.name))
this.versions = versions
this.rootName = relations.__root__.name
}
Expand Down Expand Up @@ -93,17 +93,11 @@ export class Chart {
},
],
}
this.setChartOptions(options)
this.echart.setOption(options)
}

private setChartOptions(options?: any) {
if (!this.echart)
return
if (options) {
this.echart.setOption(options)
return
}
this.echart.setOption({
private setChartOptions() {
this.echart?.setOption({
series: [
{
name: '引力图',
Expand All @@ -125,7 +119,7 @@ export class Chart {
const { devDependencies, dependencies } = this.relations[name]
const pkgs = assign(devDependencies, dependencies)
const result = []
for (const pkg of Object.keys(pkgs) as any) {
for (const pkg of Object.keys(pkgs)) {
if (this.relations[pkg]) {
const { devDependencies, dependencies } = this.relations[pkg]
const relationPkg = assign(devDependencies, dependencies)
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/utils/debounce.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function debounce(fn: () => any) {
export function debounce(fn: () => void) {
let timer: NodeJS.Timeout | null = null
// 原始函数的参数args
return function () {
Expand Down

0 comments on commit 7c9ee33

Please sign in to comment.