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

babel-plugin-s2s-action-types-ts

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-s2s-action-types-ts

generate action types

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-s2s-action-types-ts

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

Install

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

Example

Basic

IN:
export type Action = Foo | Bar;
OUT:
export type Action = Foo | Bar;
export interface Foo {
  type: FOO;
}
export interface Bar {
  type: BAR;
  payload: string;
}


/***** Do not edit below this line *****/

export const FOO = "container/example/FOO";
export type FOO = typeof FOO;
export const BAR = "container/example/BAR";
export type BAR = typeof BAR;
export const Actions = {
  FOO,
  BAR
};

Request/Success/Failure pattern

IN:
export type Action = FetchRequest;
OUT:
export type Action = FetchRequest;

export interface FetchRequest {
  type: FETCH_REQUEST;
}
export interface FetchSuccess {
  type: FETCH_SUCCESS;
}
export interface FetchFailure {
  type: FETCH_FAILURE;
}

/***** Do not edit below this line *****/
export const FETCH_REQUEST = "examples/request/FETCH_REQUEST";
export type FETCH_REQUEST = typeof FETCH_REQUEST;
export const FETCH_SUCCESS = "examples/request/FETCH_SUCCESS";
export type FETCH_SUCCESS = typeof FETCH_SUCCESS;
export const FETCH_FAILURE = "examples/request/FETCH_FAILURE";
export type FETCH_FAILURE = typeof FETCH_FAILURE;
export const Actions = {
  FETCH_REQUEST,
  FETCH_SUCCESS,
  FETCH_FAILURE
};

Usage

module.exports = {
  watch: './**/*.ts',
  plugins: [
    {
      test: /actionTypes.ts$/,
      plugin: ['s2s-action-types-ts', {
        usePrefix: true,
        removePrefix: 'src/',
      }],
    },
  ],
}

usePrefix

type: boolean
required: false

removePrefix

type: string
required: false

outputh path.

FAQs

Package last updated on 05 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