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
Merge pull request #259 from brettz9/check-types-preferred-generic-specific
BREAKING CHANGE: Cause `preferredTypes` setting not to apply by default to parent types; need to target type name with "<>" appended to target parent types (and only parent types); can alternatively; also adds option `unifyParentAndChildTypeChecks` to restore the old behavior
Allows for warning against overly generic types only (e.g., `Array` without its own children) or against the parent type only (to disallow `Array.<someType>`)
To restore old behavior, also target type names with "<>" or set the `unifyParentAndChildTypeChecks` option.
Copy file name to clipboardExpand all lines: .README/rules/check-types.md
+12-4Lines changed: 12 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,21 @@ RegExp
21
21
22
22
`check-types` allows one option:
23
23
24
-
- An option object with the key `noDefaults` to insist that only the
25
-
supplied option type map is to be used, and that the default preferences
26
-
(such as "string" over "String") will not be enforced.
24
+
- An option object:
25
+
- with the key `noDefaults` to insist that only the supplied option type
26
+
map is to be used, and that the default preferences (such as "string"
27
+
over "String") will not be enforced.
28
+
- with the key `unifyParentAndChildTypeChecks` to treat
29
+
`settings.jsdoc.preferredTypes` keys the same whether they are of the form
30
+
`SomeType` or `SomeType<>`. If this is `false` or unset, the former
31
+
will only apply to types which are not parent types/unions whereas the
32
+
latter will only apply for parent types/unions.
27
33
28
34
See also the documentation on `settings.jsdoc.preferredTypes` which impacts
29
35
the behavior of `check-types`.
30
36
37
+
38
+
31
39
#### Why not capital case everything?
32
40
33
41
Why are `boolean`, `number` and `string` exempt from starting with a capital letter? Let's take `string` as an example. In Javascript, everything is an object. The string Object has prototypes for string functions such as `.toUpperCase()`.
0 commit comments