Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 08ac383

Browse files
committed
Add documentation
1 parent 8890e75 commit 08ac383

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

docs/rules/ban-types.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Enforces that types will not to be used (ban-types)
2+
3+
Bans specific types from being used. Does not ban the corresponding runtime objects from being used.
4+
5+
## Rule Details
6+
7+
Examples of **incorrect** code for this rule `["String", "Use string instead"]`,
8+
9+
```ts
10+
class Foo<F = String> extends Bar<String> implements Baz<String> {
11+
constructor (foo: String) {
12+
}
13+
14+
exit () : Array<String> {
15+
const foo: String = 1 as String
16+
}
17+
}
18+
```
19+
20+
Examples of **correct** code for this rule `["String", "Use string instead"]`,
21+
22+
```ts
23+
class Foo<F = string> extends Bar<string> implements Baz<string> {
24+
constructor (foo: string) {
25+
}
26+
27+
exit () : Array<string> {
28+
const foo: string = 1 as string
29+
}
30+
}
31+
```
32+
33+
## Options
34+
```json
35+
{
36+
"typescript/ban-types": ["error", {
37+
"types": [
38+
["String", "Use string instead"]
39+
]
40+
}]
41+
}
42+
```
43+
44+
## Compatibility
45+
46+
* TSLint: [ban-types](https://palantir.github.io/tslint/rules/ban-types/)

0 commit comments

Comments
 (0)