attr()

Define a generic type


Usage

User.js
import { Model } from 'pinia-orm'class User extends Model {  static entity = 'users'  static fields () {    return {      id: this.attr(null),      name: this.attr('John Doe')    }  }}

With Decorator

User.ts
import { Model } from 'pinia-orm'import { Attr } from 'pinia-orm/dist/decorators'class User extends Model {  static entity = 'users'    @Attr(null) declare id: number | null  @Attr('') declare name: string}

Typescript Declarations

function attr(value: any): Attr