Skip to content

Update noImplicitAny.md #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/options/noImplicitAny.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# noImplicitAny

推測できないものや推測できないものがあり、予期しないエラーが発生する可能性があります。良い例は関数の引数です。アノテーションを付けないと、何が有効であるべきか、または無効であるべきかが明確ではありません
型を推測できない、あるいは型を推測した結果が予期せぬエラーとなるかもしれない場合があります。良い例は関数の引数です。アノテーションを付けなければ、どの型が有効であるべきか、そうでないかが不明確になります

```ts
function log(someArg) {
Expand All @@ -12,7 +12,7 @@ log(123);
log('hello world');
```

だから、もしあなたが何かの関数の引数にアノテーションをつけなければ、TypeScriptは`any`とみなして動きます。これにより、JavaScriptデベロッパーが期待しているような型チェックがオフになります。しかし、これは高い安全性を守ることを望む人々の足をすくうかもしれません。したがって、スイッチをオンにすると、型推論できない場合にフラグを立てるオプション、noImplicitAnyがあります
だから、もしあなたが関数の引数にアノテーションを付けなければ、TypeScriptは`any`とみなして動きます。これにより、JavaScriptデベロッパーが期待しているような型チェックがオフになります。しかし、これは高い安全性を守ることを望む人々の足をすくうかもしれません。したがって、スイッチをオンにすると、型推論できない場合にフラグを立てるオプション、`noImplicitAny`があります

```ts
function log(someArg) { // Error : someArg has an implicit `any` type
Expand All @@ -28,7 +28,7 @@ function log(someArg: number) {
}
```

あなたが本当にゼロの安全性を望むなら*明示的に`any`とマークすることができます
あなたが本当にゼロの安全性を望むなら*明示的*に`any`とマークすることができます:

```ts
function log(someArg: any) {
Expand Down