Generic function returns `false` rather than an object
Closed this issue · 1 comments
michaellperry commented
I've declared a generic function in a TypeScript file:
export function create<T>(template: T): Wrapper<T> {
return new Wrapper<T>(template);
}
When I call the function from a Notebook, the answer is the boolean false
.
const template: Product = {}
const product = create<Product>(template)
product
false
If I remove the explicit generic and allow the type to be inferred, an object is returned.
const template: Product = {}
const product = create(template)
product
Wrapper {}
Repro attached:
DonJayamanne commented
Thanks for filing this issue, I've been able to repro this.
Apologies for the delay