Is there a way to check whether got a function or value here ?
function f<T>(valueOrFunction : T | (()=>T)) {
if(typeof valueOrFunction === "function" ) {
// Got a function
} else {
// Still 'T | (()=>T)'
// Wanted: to get 'T'.
}
}
Everything works as intended. It was 'Resharper' which thinks the code is incorrect.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.