import { DataRepresentable } from './DataRepresentable' ; import "reflect-metadata" ; export const CodableSymbol = Symbol ( "Codable" ) ; export const Codable = < T extends DataRepresentable > ( type , convert = false , codingKey ? ) => { return < T extends DataRepresentable > ( target , fieldKey ) => { const key = codingKey || fieldKey ; const condingKeys = Reflect . getMetadata ( CodableSymbol , target ) || { } ; condingKeys [ key ] = { type , convert } ; Reflect . defineMetadata ( CodableSymbol , condingKeys , target ) ; } ; } ;