Skip to content

Zaibot/fsa

Repository files navigation

@zaibot/fsa Coverage Status Build Status

Easy type checked Flux Standard Action for TypeScript

Installation

npm i -S @zaibot/fsa

Usage

import { Action, isType } from '@zaibot/fsa';

export const HELLO_WORLD = Action<{ message: string; }>('HELLO_WORLD');

const action = HELLO_WORLD({ message: 'Hello World!' });
if (isType(action, HELLO_WORLD)) {
    console.log(action.payload.message);
}
import { Action, isTypeOneOf } from '@zaibot/fsa';

export const HELLO_WORLD = Action<{ message: string; }>('HELLO_WORLD');
export const WELCOME_MESSAGE = Action<{ message: string; }>('WELCOME_MESSAGE');

const action = HELLO_WORLD({ message: 'Hello World!' });
if (isTypeOneOf(action, HELLO_WORLD, WELCOME_MESSAGE)) {
    console.log(action.payload.message);
}

About

Easy type checked Flux Standard Action for TypeScript

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •