Created
November 10, 2022 09:07
-
-
Save temoncher/aac622225a2f13ffe0e9c07ae2d9d189 to your computer and use it in GitHub Desktop.
Soultion for `{}` type with `EmptyObject` global type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // global.d.ts | |
| declare global { | |
| // eslint-disable-next-line @typescript-eslint/ban-types | |
| type EmptyObject = Record<string, never>; | |
| } | |
| // .eslintrc.js | |
| '@typescript-eslint/ban-types': [ | |
| 2, | |
| { | |
| types: { | |
| '{}': { message: 'Use EmptyObject instead', fixWith: 'EmptyObject' }, | |
| 'Record<string, never>': { | |
| message: 'Use EmptyObject instead', | |
| fixWith: 'EmptyObject', | |
| }, | |
| }, | |
| }, | |
| ], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment