javascript - Immutable.js Record.set type checking with TypeScript -


i'm using immutable.js typescript build redux app.

essentially, state looks like

const defaultstate = {   booleanvalue: true,   numbervalue: 0, }  const staterecord = immutable.record(defaultstate)  class stateclass extends staterecord {   booleanvalue: boolean   numbervalue: number }  const state = new stateclass() 

(this setup enables compile-time type checking expressions state.booleanvalue === 'hi')

is there way enable compile-time type checking set, such state.set('booleanvalue', 'hi')? (i want warning compiler saying 'booleanvalue' cannot set 'hi'.)

or, there alternative setup make immutable.js , typescript work both when getting , setting?

is there alternative setup make immutable.js , typescript work both when getting , setting

not without wrapping staterecord in helper functions (basically throwing more code @ needs duplicated , kept in sync). in short nope.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -