# Type utilities (Prisma ORM v7) (/docs/orm/v7/prisma-client/client-extensions/type-utilities)
> For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL.
Advanced type safety: improve type safety in your custom model methods
Location: ORM > v7 > Prisma Client > Client Extensions > Type utilities
Several type utilities exist within Prisma Client that can assist in the creation of highly type-safe extensions.
## Type Utilities [#type-utilities]
[Prisma Client type utilities](https://www.prisma.io/docs/orm/v7/prisma-client/type-safety) are utilities available within your application and Prisma Client extensions and provide useful ways of constructing safe and extendable types for your extension.
The type utilities available are:
* `Exact`: Enforces strict type safety on `Input`. `Exact` makes sure that a generic type `Input` strictly complies with the type that you specify in `Shape`. It [narrows](https://www.typescriptlang.org/docs/handbook/2/narrowing.html) `Input` down to the most precise types.
* `Args`: Retrieves the input arguments for any given model and operation. This is particularly useful for extension authors who want to do the following:
* Re-use existing types to extend or modify them.
* Benefit from the same auto-completion experience as on existing operations.
* `Result`: Takes the input arguments and provides the result for a given model and operation. You would usually use this in conjunction with `Args`. As with `Args`, `Result` helps you to re-use existing types to extend or modify them.
* `Payload`: Retrieves the entire structure of the result, as scalars and relations objects for a given model and operation. For example, you can use this to determine which keys are scalars or objects at a type level.
The following example creates a new operation, `exists`, based on `findFirst`. It has all of the arguments that `findFirst`.
```ts
const prisma = new PrismaClient().$extends({
model: {
$allModels: {
// Define a new `exists` operation on all models
// T is a generic type that corresponds to the current model
async exists(
// `this` refers to the current type, e.g. `prisma.user` at runtime
this: T,
// The `exists` function will use the `where` arguments from the current model, `T`, and the `findFirst` operation
where: Prisma.Args["where"],
): Promise {
// Retrieve the current model at runtime
const context = Prisma.getExtensionContext(this);
// Prisma Client query that retrieves data based
const result = await (context as any).findFirst({ where });
return result !== null;
},
},
},
});
async function main() {
const user = await prisma.user.exists({ name: "Alice" });
const post = await prisma.post.exists({
OR: [{ title: { contains: "Prisma" } }, { content: { contains: "Prisma" } }],
});
}
```
## Add a custom property to a method [#add-a-custom-property-to-a-method]
The following example illustrates how you can add custom arguments, to a method in an extension:
```ts highlight=16
type CacheStrategy = {
swr: number;
ttl: number;
};
const prisma = new PrismaClient().$extends({
model: {
$allModels: {
findMany(
this: T,
args: Prisma.Exact<
A,
// For the `findMany` method, use the arguments from model `T` and the `findMany` method
// and intersect it with `CacheStrategy` as part of `findMany` arguments
Prisma.Args & CacheStrategy
>,
): Prisma.Result {
// method implementation with the cache strategy
},
},
},
});
async function main() {
await prisma.post.findMany({
cacheStrategy: {
ttl: 360,
swr: 60,
},
});
}
```
This example is conceptual. You must implement and operate the cache used by the extension.
## Related pages
- [`Add custom fields and methods to query results`](https://www.prisma.io/docs/orm/v7/prisma-client/client-extensions/result): Extend the functionality of Prisma Client, result component
- [`Add custom methods to your models`](https://www.prisma.io/docs/orm/v7/prisma-client/client-extensions/model): Extend the functionality of Prisma Client, model component
- [`Add methods to Prisma Client`](https://www.prisma.io/docs/orm/v7/prisma-client/client-extensions/client): Extend the functionality of Prisma Client, client component
- [`Create custom Prisma Client queries`](https://www.prisma.io/docs/orm/v7/prisma-client/client-extensions/query): Extend the functionality of Prisma Client, query component
- [`Shared packages & examples`](https://www.prisma.io/docs/orm/v7/prisma-client/client-extensions/extension-examples): Explore the Prisma Client extensions that have been built by Prisma and its community