I have this Flux Store class:
'use strict';
import flux = require('app/tools/flux');
import types = require('app/tools/types');
import Actions = require('app/actions/actions');
class Store
{
bindListeners(config : any) : void {;};
books : Array<types.IBook>;
selectedBookName : string;
...
}
export = flux.createStore<Store>(Store, 'Store');
That's being used in this view:
"use strict";
import React = require('react');
import Store = require('app/stores/store'); // <-- here we import the Store
import _ = require('lodash');
import BookHelper = require('app/tools/bookHelper');
import Msg = require('app/tools/messages');
interface props {}
interface state {}
class NoteContainer extends React.Component<props, state>
{
state: typeof Store; // <-- this is Altjs<Store>, not Store :(
render()
{
if (!this.state.selectedBookName) // <-- here's an error
return;
...
which gives this compiles error:
error TS2339: Property 'selectedBookName' does not exist on type 'AltStore<Store>'.
How do I set the state of the view to be the actual Store class, not the AltStore<Store>
class?
I.e. how can I get the type of the generic parameter, like this:
state: typeof Store<THIS THING>