Rocky_Mountain_Vending/.pnpm-store/v10/files/42/088f7424cd8372405a7b2d26cfdc691b62c14feef53df0e6843271816d447f4372009d1efc462698f509958f856eeafc7ebe56478fd02d8b331c3aa13ddd45
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

65 lines
1.9 KiB
Text

import type {ApplyDefaultOptions} from './internal';
import type {Simplify} from './simplify';
type SetFieldTypeOptions = {
/**
Preserve optional and readonly modifiers for properties being updated.
NOTE: Property modifiers will always be preserved for properties that are not being updated.
@default true
*/
preservePropertyModifiers?: boolean;
};
type DefaultSetFieldTypeOptions = {
preservePropertyModifiers: true;
};
/**
Create a type that changes the type of the given keys.
Use-cases:
- Creating variations of a base model.
- Fixing incorrect external types.
@see `Merge` if you need to change multiple properties to different types.
@example
```
import type {SetFieldType} from 'type-fest';
type MyModel = {
readonly id: number;
readonly createdAt: Date;
updatedAt?: Date;
};
type MyModelApi = SetFieldType<MyModel, 'createdAt' | 'updatedAt', string>;
// {
// readonly id: number;
// readonly createdAt: string;
// updatedAt?: string;
// }
// `preservePropertyModifiers` option can be set to `false` if you want to remove property modifiers for properties being updated
type MyModelApi = SetFieldType<MyModel, 'createdAt' | 'updatedAt', string, {preservePropertyModifiers: false}>;
// {
// readonly id: number;
// createdAt: string; // no longer readonly
// updatedAt: string; // no longer optional
// }
```
@category Object
*/
export type SetFieldType<BaseType, Keys extends keyof BaseType, NewType, Options extends SetFieldTypeOptions = {}> =
_SetFieldType<BaseType, Keys, NewType, ApplyDefaultOptions<SetFieldTypeOptions, DefaultSetFieldTypeOptions, Options>>;
type _SetFieldType<BaseType, Keys extends keyof BaseType, NewType, Options extends Required<SetFieldTypeOptions>> =
Simplify<{
[P in keyof BaseType]: P extends Keys ? NewType : BaseType[P];
} & (
// `Record` is used to remove property modifiers
Options['preservePropertyModifiers'] extends false ? Record<Keys, NewType> : unknown
)>;