Skip to content

Commit

Permalink
types: use satisfies to replace as in src/router/modules
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxian521 committed Nov 2, 2023
1 parent 9bbfb8b commit b4fd313
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/router/modules/able.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/flowchart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/formdesign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/guide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/menuoverflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/nested.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/ppt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/puredoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/pureutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/remaining.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ export default [
rank: 103
}
}
] as Array<RouteConfigsTable>;
] satisfies Array<RouteConfigsTable>;
2 changes: 1 addition & 1 deletion src/router/modules/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;
2 changes: 1 addition & 1 deletion src/router/modules/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ export default {
}
}
]
} as RouteConfigsTable;
} satisfies RouteConfigsTable;

1 comment on commit b4fd313

@xiaoxian521
Copy link
Member Author

@xiaoxian521 xiaoxian521 commented on b4fd313 Nov 2, 2023

Choose a reason for hiding this comment

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

satisfiesTypeScript 4.9新增的一个操作符,具体看 https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/

修改前(使用as):

image

修改后(使用satisfies):

image

总结:as 用于类型转换, satisfies 用于自定义类型检查和过滤

Please sign in to comment.