You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/eslint-plugin/docs/rules/ban-types.md
+3-8Lines changed: 3 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -72,12 +72,6 @@ The default options provide a set of "best practices", intended to provide safet
72
72
- This is a point of confusion for many developers, who think it means "any object type".
73
73
- See [this comment for more information](https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492).
74
74
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
-
81
75
<details>
82
76
<summary>Default Options</summary>
83
77
@@ -115,15 +109,16 @@ const defaultTypes = {
115
109
Object: {
116
110
message: [
117
111
'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.',
119
113
'- If you want a type meaning "any value", you probably want `unknown` instead.',
120
114
].join('\n'),
121
115
},
122
116
'{}': {
123
117
message: [
124
118
'`{}` 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.',
126
120
'- 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.',
0 commit comments