@@ -33,7 +33,8 @@ export interface RailsContext {
3333 httpAcceptLanguage : string ;
3434}
3535
36- type AuthenticityHeaders = { [ id : string ] : string } & {
36+ // not strictly what we want, see https://github.com/microsoft/TypeScript/issues/17867#issuecomment-323164375
37+ type AuthenticityHeaders = Record < string , string > & {
3738 'X-CSRF-Token' : string | null ;
3839 'X-Requested-With' : string ;
3940} ;
@@ -167,10 +168,10 @@ export interface Root {
167168export type RenderReturnType = void | Element | Component | Root ;
168169
169170export interface ReactOnRails {
170- register ( components : { [ id : string ] : ReactComponentOrRenderFunction } ) : void ;
171+ register ( components : Record < string , ReactComponentOrRenderFunction > ) : void ;
171172 /** @deprecated Use registerStoreGenerators instead */
172- registerStore ( stores : { [ id : string ] : StoreGenerator } ) : void ;
173- registerStoreGenerators ( storeGenerators : { [ id : string ] : StoreGenerator } ) : void ;
173+ registerStore ( stores : Record < string , StoreGenerator > ) : void ;
174+ registerStoreGenerators ( storeGenerators : Record < string , StoreGenerator > ) : void ;
174175 getStore ( name : string , throwIfMissing ?: boolean ) : Store | undefined ;
175176 getOrWaitForStore ( name : string ) : Promise < Store > ;
176177 getOrWaitForStoreGenerator ( name : string ) : Promise < StoreGenerator > ;
@@ -180,7 +181,7 @@ export interface ReactOnRails {
180181 reactOnRailsComponentLoaded ( domId : string ) : void ;
181182 reactOnRailsStoreLoaded ( storeName : string ) : void ;
182183 authenticityToken ( ) : string | null ;
183- authenticityHeaders ( otherHeaders : { [ id : string ] : string } ) : AuthenticityHeaders ;
184+ authenticityHeaders ( otherHeaders : Record < string , string > ) : AuthenticityHeaders ;
184185 option ( key : string ) : string | number | boolean | undefined ;
185186 getStoreGenerator ( name : string ) : StoreGenerator ;
186187 setStore ( name : string , store : Store ) : void ;
0 commit comments