# noImplicitAny

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

```typescript
function log(someArg) {
  sendDataToServer(someArg);
}

// What arg is valid and what isn't?
log(123);
log('hello world');
```

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

```typescript
function log(someArg) { // Error : someArg has an implicit `any` type
  sendDataToServer(someArg);
}
```

もちろん、アノテーションを付けて前進できます:

```typescript
function log(someArg: number) {
  sendDataToServer(someArg);
}
```

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

```typescript
function log(someArg: any) {
  sendDataToServer(someArg);
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://typescript-jp.gitbook.io/deep-dive/intro/noimplicitany.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
