Reputation: 1078
In Javascript I have:
var session = require('express-session');
var SequelizeStore = require('connect-session-sequelize')(session.Store);
new SequelizeStore({
db: sequelize
});
I set these types:
function ConnectSessionSequelize(store: expressSession.IBaseStore): expressSession.IBaseStore;
This fails because expressSession.IBaseStore refers to an instance type, not a class type. Is there a way to specify class types, similar to Java: Class<expressSession.IBaseStore>
?
Currently I'm using function CoSeSe(store: Function): Function
, but this has major type leakage!
Upvotes: 1
Views: 322
Reputation: 220904
The syntax typeof SomeClass
will give you the type of the constructor function SomeClass
(e.g. the type of x
if you wrote let x = SomeClass
) rather than the instance side (e.g. the type of y
if you wrote let y = new SomeClass()
).
Upvotes: 2