# Omit

```javascript
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
```

用之前的 Pick 和 Exclude 进行组合, 实现忽略对象某些属性功能

`Omit` = `Exclude` + `Pick`

`Omit<T, K>`的作用是忽略`T`中的某些属性.

在Typescript 3.4之前没有`Omit` 时，实现同样的功能必须写更多的代码

```typescript
type Person = {
    name: string;
    age: number;
    location: string;
};

type RemainingKeys = Exclude<keyof Person, "location">;

type QuantumPerson = Pick<Person, RemainingKeys>;

// equivalent to
type QuantumPerson = {
    name: string;
    age: number;
};
```

使用Omit

```javascript
type QuantumPersion = Omit<Person, "location">
```


---

# 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://mm.ricky.moe/javascript/typescript/shi-yong/omit.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.
