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
+2-12Lines changed: 2 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -75,8 +75,6 @@ The default options provide a set of "best practices", intended to provide safet
75
75
- Avoid the `Object` and `{}` types, as they mean "any non-nullish value".
76
76
- This is a point of confusion for many developers, who think it means "any object type".
77
77
- See [this comment for more information](https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492).
78
-
- Avoid the `object` type, as it is currently hard to use due to not being able to assert that keys exist.
79
-
- See [microsoft/TypeScript#21732](https://github.com/microsoft/TypeScript/issues/21732).
80
78
81
79
**_Important note:_** the default options suggest using `Record<string, unknown>`; this was a stylistic decision, as the built-in `Record` type is considered to look cleaner.
82
80
@@ -126,12 +124,6 @@ const defaultTypes = {
126
124
'- If you want a type meaning "any value", you probably want `unknown` instead.',
127
125
].join('\n'),
128
126
},
129
-
object: {
130
-
message: [
131
-
'The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).',
132
-
'Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys.',
133
-
].join('\n'),
134
-
},
135
127
};
136
128
```
137
129
@@ -152,8 +144,6 @@ const symb: Symbol = Symbol('foo');
152
144
const func:Function= () =>1;
153
145
154
146
// use safer object types
155
-
const lowerObj:object= {};
156
-
157
147
const capitalObj1:Object=1;
158
148
const capitalObj2:Object= { a: 'string' };
159
149
@@ -174,7 +164,7 @@ const symb: symbol = Symbol('foo');
0 commit comments