diff --git a/packages/eslint-plugin/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md index 761cac128f3..bf59ffb8461 100644 --- a/packages/eslint-plugin/docs/rules/ban-types.md +++ b/packages/eslint-plugin/docs/rules/ban-types.md @@ -74,6 +74,7 @@ The default options provide a set of "best practices", intended to provide safet - It accepts class declarations, which will fail when called, as they are called without the `new` keyword. - Avoid the `Object` and `{}` types, as they mean "any non-nullish value". - This is a point of confusion for many developers, who think it means "any object type". + - See [this comment for more information](https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492). - Avoid the `object` type, as it is currently hard to use due to not being able to assert that keys exist. - See [microsoft/TypeScript#21732](https://github.com/microsoft/TypeScript/issues/21732). diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index 0187134e991..c9f03c89b96 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -93,6 +93,7 @@ const defaultTypes: Types = { '`{}` actually means "any non-nullish value".', '- If you want a type meaning "any object", you probably want `Record` instead.', '- If you want a type meaning "any value", you probably want `unknown` instead.', + '- If you want a type meaning "empty object", you probably want `Record` instead.', ].join('\n'), }, object: {