File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -15,4 +15,26 @@ module.exports = {
15
15
'react-hooks/rules-of-hooks' : 'error' , // Checks rules of Hooks
16
16
'react-hooks/exhaustive-deps' : 'warn' , // Checks effect dependencies
17
17
} ,
18
+ overrides : [
19
+ {
20
+ // For react component files, we want to allow types of the form `type Props = {}`
21
+ // as Props is guaranteed to be an object by React. Without overriding this rule,
22
+ // we would need to extend the Props generic from Record<string, unknown>
23
+ // which causes issues when consumer props are defined as interface without an index signature.
24
+ // Refer to react part of the comment for more details.
25
+ // https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492
26
+ excludedFiles : "src/*.tsx" ,
27
+ rules : {
28
+ "@typescript-eslint/ban-types" : [
29
+ "error" ,
30
+ {
31
+ extendDefaults : true ,
32
+ types : {
33
+ "{}" : false ,
34
+ } ,
35
+ } ,
36
+ ] ,
37
+ } ,
38
+ } ,
39
+ ] ,
18
40
} ;
Original file line number Diff line number Diff line change @@ -346,7 +346,7 @@ export function useModal(modal?: any, args?: any): any {
346
346
resolveHide,
347
347
} ;
348
348
}
349
- export const create = < P extends Record < string , unknown > > (
349
+ export const create = < P extends { } > (
350
350
Comp : React . ComponentType < P > ,
351
351
) : React . FC < P & NiceModalHocProps > => {
352
352
return ( { defaultVisible, keepMounted, id, ...props } ) => {
You can’t perform that action at this time.
0 commit comments