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

@storybook/preset-typescript

Package Overview
Dependencies
Maintainers
16
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/preset-typescript

TypeScript preset for Storybook

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45K
increased by13.07%
Maintainers
16
Weekly downloads
 
Created
Source

Storybook TypeScript preset

One-line TypeScript configuration for Storybook.

  • Installation
  • Advanced usage
  • Options

Installation

First, install this preset to your project.

npm install -D @storybook/preset-typescript ts-loader fork-ts-checker-webpack-plugin # or yarn

Once installed, add this preset to the appropriate file:

  • ./.storybook/main.js (for Storybook 5.3.0 and newer)

    module.exports = {
      addons: ['@storybook/preset-typescript'],
    };
    
  • ./.storybook/presets.js (for all Storybook versions)

    module.exports = ['@storybook/preset-typescript'];
    

Advanced usage

You can also pass extra configuration options to configure the preset. For example:

// ./storybook/main.js
const path = require('path');

module.exports = {
  addons: [
    {
      name: '@storybook/preset-typescript',
      options: {
        tsLoaderOptions: {
          configFile: path.resolve(__dirname, './tsconfig.json'),
        },
        forkTsCheckerWebpackPluginOptions: {
          colors: false, // disables built-in colors in logger messages
        },
        include: [path.resolve(__dirname, '../src')],
        transpileManager: true,
      },
    },
  ],
};

All available options are described in the Options section below.

Options

forkTsCheckerWebpackPluginOptions

Type: Object

Default value
undefined;

fork-ts-checker-webpack-plugin options. transpileOnly flag needs to be set to true in tsLoaderOptions to be able to set options for this webpack plugin.

include

Type: Rule condition

Default value
undefined;

include rule for /\.tsx?$/.

transpileManager

Type: Boolean

Default value
false;

Toggles TypeScript transpilation on manager side.

FAQs

Package last updated on 25 Mar 2020

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