Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f17d34b

Browse files
docs(eslint-plugin): update site description of ban-types docs (typescript-eslint#6209)
1 parent b0f6c8e commit f17d34b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

packages/eslint-plugin/docs/rules/ban-types.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ The default options provide a set of "best practices", intended to provide safet
7272
- This is a point of confusion for many developers, who think it means "any object type".
7373
- See [this comment for more information](https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492).
7474

75-
:::important
76-
77-
The default options suggest using `Record<string, unknown>`; this was a stylistic decision, as the built-in `Record` type is considered to look cleaner.
78-
79-
:::
80-
8175
<details>
8276
<summary>Default Options</summary>
8377

@@ -115,15 +109,16 @@ const defaultTypes = {
115109
Object: {
116110
message: [
117111
'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.',
118-
'- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.',
112+
'- If you want a type meaning "any object", you probably want `object` instead.',
119113
'- If you want a type meaning "any value", you probably want `unknown` instead.',
120114
].join('\n'),
121115
},
122116
'{}': {
123117
message: [
124118
'`{}` actually means "any non-nullish value".',
125-
'- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.',
119+
'- If you want a type meaning "any object", you probably want `object` instead.',
126120
'- If you want a type meaning "any value", you probably want `unknown` instead.',
121+
'- If you want a type meaning "empty object", you probably want `Record<string, never>` instead.',
127122
].join('\n'),
128123
},
129124
};

0 commit comments

Comments
 (0)