前端显式 any 类型清理

全前端显式 any 计数 2→0:Slot children?: any → ReactNode | MotionValue 联合(motion 真实类型),顺带修复潜在崩溃(原代码在 isValidElement 前访问 children.type,children 缺失时 TypeError,现无效 children 返回 null,hooks 无条件合规);useControlledState Rest extends any[] → unknown[]。两处 eslint-disable no-explicit-any 注释随之删除。

Experiments: #28
Metric: 全前端 any 2 → 0,tsc/eslint/vitest 全绿
This commit is contained in:
ryan
2026-08-16 21:23:38 +08:00
parent 5a8722ff07
commit c76c5a697b
2 changed files with 19 additions and 13 deletions
+1 -2
View File
@@ -14,8 +14,7 @@ interface CommonControlledStateProps<T> {
* const [value, setValue] = useControlledState({ value: propValue, onChange: console.log })
* ```
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function useControlledState<T, Rest extends any[] = []>(
export function useControlledState<T, Rest extends unknown[] = []>(
props: CommonControlledStateProps<T> & {
onChange?: (value: T, ...args: Rest) => void;
},