Need to use renamed import
Opened this issue · 1 comments
michal-minich commented
I want to use "SArray" for data constructor and type in the same file. I have to use following import construct.
import SArray, { SArray as SArrayType } from "s-array";
function fill() : SArrayType<string> {
const items = SArray(["a", "b", "c"]);
return items;
}
this is import that work or SArray as a funciton
import SArray from "s-array";
function fill() {
const items = SArray(["a", "b", "c"]);
return items;
}
and this type of import make SArray a type
import { SArray } from "s-array";
function fill() : SArray<string> {
return null;
}
I suppose the error can be in way how type definition file is written?
I'm using TypeScript 3 and node/npm
Thank you.
adamhaile commented
Yep, looks like I need to mark the SArray type as the default type export of the module. I'll try to get that out soon. Thanks for the report!