Skip to content

quickmodel / IQAliasedSerializedInterface

Type Alias: IQAliasedSerializedInterface<T, TAliasMap> ​

IQAliasedSerializedInterface<T, TAliasMap> = { [K in keyof T as K extends string ? K extends keyof TAliasMap ? TAliasMap[K] : K : K]: IQSerialized<T[K]> }

Maps a complete interface to its IQSerialized version, remapping keys according to the alias map passed to @Quick(). This is the return type of serialize() when @Quick is used with the alias option.

Keys present in TAliasMap are renamed to their alias values; all other keys are kept.

Type Parameters ​

T ​

T

The model interface (property names)

TAliasMap ​

TAliasMap extends Record<string, string> = Record<never, never>

Literal map { propertyName: 'alias_name' } from @Quick({ alias: ... })

See ​

  • IQSerializedInterface — non-aliased variant
  • QAlias — property-level decorator (from quickmodel/decorators) that also produces key remapping
  • QModel.$qSerialize — returns this type when a TAliasMap is provided

Example ​

typescript
interface IUser { firstName: string; lastName: string; }

@Quick({}, { alias: { firstName: 'first_name', lastName: 'last_name' } })
class User extends QModel<IUser> {
  declare firstName: string;
  declare lastName: string;
}

const user = new User({ first_name: 'Dave', last_name: 'Jones' });
const json = user.$qSerialize();
// Type: { first_name: string; last_name: string }  ✅  IDE autocomplete correcto
json.first_name; // 'Dave'