Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

@workflow/serde

Serialization symbols for custom class serialization in Workflow DevKit.

Usage

import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';

class MyClass {
  constructor(public value: string) {}

  static [WORKFLOW_SERIALIZE](instance: MyClass) {
    return { value: instance.value };
  }

  static [WORKFLOW_DESERIALIZE](data: { value: string }) {
    return new MyClass(data.value);
  }
}

License

Apache-2.0