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
Merged pull request #248 from brettz9/object-default
BREAKING CHANGE: `check-types` now expects "object" instead of "Object"
Makes consistent with Typescript recommendation and fact that `Object.create(null)` is not `instanceof Object` but its `typeof` is `object`.
Can restore old behavior through `settings: {jsdoc: {preferredTypes: {object: 'Object'}}}}` (and `check-types` still enabled). Closes#164
To make things more confusing, there are also object literals and object Objects. But object literals are still static Objects and object Objects are instantiated Objects. So an object primitive is still an object Object. (`Object.create(null)` objects are not, however.)
44
+
To make things more confusing, there are also object literals and object Objects. But object literals are still static Objects and object Objects are instantiated Objects. So an object primitive is still an object Object.
45
+
46
+
However, `Object.create(null)` objects are not `instanceof Object`, however, so
47
+
in the case of this Object we lower-case to indicate possible support for
48
+
these objects.
45
49
46
50
Basically, for primitives, we want to define the type as a primitive, because that's what we use in 99.9% of cases. For everything else, we use the type rather than the primitive. Otherwise it would all just be `{object}`.
47
51
48
-
In short: It's not about consistency, rather about the 99.9% use case.
52
+
In short: It's not about consistency, rather about the 99.9% use case. (And some
53
+
functions might not even support the objects if they are checking for identity.)
To make things more confusing, there are also object literals and object Objects. But object literals are still static Objects and object Objects are instantiated Objects. So an object primitive is still an object Object. (`Object.create(null)` objects are not, however.)
1284
+
To make things more confusing, there are also object literals and object Objects. But object literals are still static Objects and object Objects are instantiated Objects. So an object primitive is still an object Object.
1285
+
1286
+
However, `Object.create(null)` objects are not `instanceof Object`, however, so
1287
+
in the case of this Object we lower-case to indicate possible support for
1288
+
these objects.
1285
1289
1286
1290
Basically, for primitives, we want to define the type as a primitive, because that's what we use in 99.9% of cases. For everything else, we use the type rather than the primitive. Otherwise it would all just be `{object}`.
1287
1291
1288
-
In short: It's not about consistency, rather about the 99.9% use case.
1292
+
In short: It's not about consistency, rather about the 99.9% use case. (And some
1293
+
functions might not even support the objects if they are checking for identity.)
// Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"{{badType}}\"; prefer: \"{{preferredType}}\".","replacement":"Abc"},"cde":{"message":"More messed up JSDoc @{{tagName}}{{tagValue}} type \"{{badType}}\"; prefer: \"{{preferredType}}\".","replacement":"Cde"},"Object":"object"}}}
1387
+
// Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"{{badType}}\"; prefer: \"{{preferredType}}\".","replacement":"Abc"},"cde":{"message":"More messed up JSDoc @{{tagName}}{{tagValue}} type \"{{badType}}\"; prefer: \"{{preferredType}}\".","replacement":"Cde"},"object":"Object"}}}
1383
1388
// Message: Messed up JSDoc @param "foo" type "abc"; prefer: "Abc".
0 commit comments