请问,在函数参数里面加:和? 是什么意思?
还有function 定义函数后面是不是{},而是:
es6的数据解构中没看到,是我看漏了吗?求各大神指导一下

export function createRoute (
record: ?RouteRecord,
location: Location,
redirectedFrom?: Location
): Route {
const route: Route = {
name: location.name || (record && record.name),
meta: (record && record.meta) || {},
path: location.path || '/',
hash: location.hash || '',
query: location.query || {},
params: location.params || {},
fullPath: getFullPath(location),
matched: record ? formatMatch(record) : []
}
if (redirectedFrom) {
route.redirectedFrom = getFullPath(redirectedFrom)
}
return Object.freeze(route)
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
如果没说错的话.这应该是一种js的静态类型检测
可以看下flow相关东西
flow 静态类型检查。
:后面是对应的数据类型,?表示可选参数。function后面的代表的是返回值类型