Hegel: Type "[T]" is incompatible with type "Array<T>"
Created on 3 May 2020
路
2Comments
路
Source: JSMonk/hegel
function ensureArray<T>(value: T | Array<T> | null | undefined): Array<T> {
if (value == null) {
return []
}
if (typeof value === 'object' && value instanceof Array) {
return value
} else {
return [value]// Type "[T]" is incompatible with type "Array<T>"
}
}