Socket
Socket
Sign inDemoInstall

babel-plugin-s2s-action-creator-ts

Package Overview
Dependencies
56
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-s2s-action-creator-ts

generate action creator


Version published
Weekly downloads
3
Maintainers
1
Created
Weekly downloads
 

Readme

Source

babel-plugin-s2s-action-creator-ts

plugin for https://github.com/akameco/s2s

Install

$ npm install --save-dev babel-plugin-s2s-action-creator-ts

Example

Basic

IN:
import External from 'external';
export type Action = Hoge | Fuga;

export interface Hoge {
  type: Actions.Hoge;
  key: number;
  data: External;
}
export interface Fuga {
  type: Actions.Fuga;
}

/***** Do not edit below this line *****/
export const enum Actions {
  Hoge = 'containers/Hoge',
  Fuga = 'containers/Fuga',
}
OUT:
/***** Do not edit this file *****/
import External from 'external';
import { Actions, Hoge, Fuga } from "./actionTypes";
export function hoge(key: number, data: External): Hoge {
  return {
    type: Actions.Hoge,
    key,
    data
  };
}
export function fuga(): Fuga {
  return {
    type: Actions.Fuga
  };
}

Usage

module.exports = {
  watch: './**/*.ts',
  plugins: [
    {
      test: /actionTypes.ts$/,
      output: 'actions.ts',
      plugin: 's2s-action-creator-ts',
    },
  ],
}

FAQs

Last updated on 15 Dec 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc