Skip to content

Instantly share code, notes, and snippets.

@temoncher
Created November 10, 2022 09:07
Show Gist options
  • Select an option

  • Save temoncher/aac622225a2f13ffe0e9c07ae2d9d189 to your computer and use it in GitHub Desktop.

Select an option

Save temoncher/aac622225a2f13ffe0e9c07ae2d9d189 to your computer and use it in GitHub Desktop.
Soultion for `{}` type with `EmptyObject` global type
// 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