normalizr-decorators (highly experimental)
TypeScript normalizr decorators for normalization of class and property definitions
Which normalizr Schema types can be used as decorators?
- Class
- Entity via @Entity({key: string, options?: EntityOptions})
- Property
- Entity via @EntityProperty()
- Array via @ArrayProperty(element)
Example decorating, normalizing and denormalizing
; @ readonly id: number; @ readonly id: number; @ commenter: User; @ readonly id: number; @ author: User; @ comments: Comment; const originalData = id: 123 author: id: 1 name: 'Paul' title: 'My awesome blog post' comments: id: 324 commenter: id: 2 name: 'Nicole' ; const entities result = ;const denormalizedData = ;