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

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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: 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

Package last updated on 18 Jan 2018

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