为什么不在继承BasicRouteProps的时候声明泛型类型?
现在我想使用match.params里面的属性的时候总是提示我找不到
使用computedMatch总是要先判断不为空才能使用
interface RouterTypes<T extends Object = {}, P = {}> extends BasicRouteProps<P>
这样不是更好吗?



@ycjcl868 大兄弟 这个里面没有router相关的啊
看了下,可以使用 RouterTypes,使用 computedMatch,match 如需要可以 PR 一个
import { RouterTypes } from 'umi';
type IRoute = RouterTypes<{}, { code: string }>;
this.props.computedMatch.params.code


大哥你在忽悠我
@ycjcl868

我现在是加 ! 号解决。。。
@Sayid1
我直接用react-router-dom的类型了
来自阿里邮箱 iPhone版
------------------原始邮件 ------------------
发件人:handy notifications@github.com
日期:2019-10-11 10:30:05
收件人:umijs/umi umi@noreply.github.com
抄送:m sayid.zheng@aliyun.com, Mention mention@noreply.github.com
主题:Re: [umijs/umi] RouterTypes类型定义有缺陷 (#3218)
我现在是加 ! 号解决。。。
@Sayid1
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
目前的想到的一个解决方法是类似这样
interface IRoute extends RouterTypes {
match: RouterTypes['match'] & { params: ParamsType };
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
目前的想到的一个解决方法是类似这样
interface IRoute extends RouterTypes { match: RouterTypes['match'] & { params: ParamsType }; }
建议把这个加到 umi 文档里,挺常见的一个需求。
Most helpful comment
目前的想到的一个解决方法是类似这样