Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-s2s-action-creator-ts

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-s2s-action-creator-ts

generate action creator

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 15 Dec 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc