Socket
Socket
Sign inDemoInstall

babel-plugin-s2s-action-types-ts

Package Overview
Dependencies
56
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-s2s-action-types-ts

generate action types


Version published
Weekly downloads
5
decreased by-16.67%
Maintainers
1
Install size
4.41 MB
Created
Weekly downloads
 

Readme

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: Actions.Foo;
}
export interface Bar {
  type: Actions.Bar;
  payload: string;
}

/***** Do not edit below this line *****/
export const enum Actions {
  Foo = "container/example/Foo",
  Bar = "container/example/Bar",
}

Request/Success/Failure pattern

IN:
export type Action = FetchRequest;
OUT:
export type Action = FetchRequest | FetchSuccess | FetchFailure;

export interface FetchRequest {
  type: Actions.FetchRequest;
}
export interface FetchSuccess {
  type: Actions.FetchSuccess;
}
export interface FetchFailure {
  type: Actions.FetchFailure;
}

/***** Do not edit below this line *****/
export const enum Actions {
  FetchRequest = "examples/request/FetchRequest",
  FetchSuccess = "examples/request/FetchSuccess",
  FetchFailure = "examples/request/FetchFailure",
}

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

Last updated on 23 Jan 2018

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