@@ -33,7 +33,8 @@ export interface RailsContext {
33
33
httpAcceptLanguage : string ;
34
34
}
35
35
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 > & {
37
38
'X-CSRF-Token' : string | null ;
38
39
'X-Requested-With' : string ;
39
40
} ;
@@ -167,10 +168,10 @@ export interface Root {
167
168
export type RenderReturnType = void | Element | Component | Root ;
168
169
169
170
export interface ReactOnRails {
170
- register ( components : { [ id : string ] : ReactComponentOrRenderFunction } ) : void ;
171
+ register ( components : Record < string , ReactComponentOrRenderFunction > ) : void ;
171
172
/** @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 ;
174
175
getStore ( name : string , throwIfMissing ?: boolean ) : Store | undefined ;
175
176
getOrWaitForStore ( name : string ) : Promise < Store > ;
176
177
getOrWaitForStoreGenerator ( name : string ) : Promise < StoreGenerator > ;
@@ -180,7 +181,7 @@ export interface ReactOnRails {
180
181
reactOnRailsComponentLoaded ( domId : string ) : void ;
181
182
reactOnRailsStoreLoaded ( storeName : string ) : void ;
182
183
authenticityToken ( ) : string | null ;
183
- authenticityHeaders ( otherHeaders : { [ id : string ] : string } ) : AuthenticityHeaders ;
184
+ authenticityHeaders ( otherHeaders : Record < string , string > ) : AuthenticityHeaders ;
184
185
option ( key : string ) : string | number | boolean | undefined ;
185
186
getStoreGenerator ( name : string ) : StoreGenerator ;
186
187
setStore ( name : string , store : Store ) : void ;
0 commit comments