Storybook: Updating fork-ts-checker-webpack-plugin to v5.x

Created on 8 Oct 2020  路  2Comments  路  Source: storybookjs/storybook

Is your feature request related to a problem? Please describe

Will be great the fork-ts-checker-webpack-plugin can be updated to v5 in the future. It allows a concise way of overriding include field in tsconfig.json via configOverwrite to allow easier type-checking of story files (*.stories.ts).

Describe the solution you'd like

I was hoping to do something like:

// .storybook/main.js
module.exports = {
  ...
  typescript: {
    check: true, // Enabling fork-ts-checker-webpack-plugin for unlocking type-checking
    checkOptions: {
       typescript: {
         configOverwrite: { include: ["./src/**/*.stories.tsx"] }
       }
    }
  },
}

Describe alternatives you've considered

Other solutions that I tried seemed a little lengthy. I'd prefer not to modify the default Storybook Webpack config whenever possible.

Another (working) solution I tried is:

// .storybook/main.js
module.exports = {
  ...
  typescript: {
    check: true, // Enabling fork-ts-checker-webpack-plugin for unlocking type-checking
    checkOptions: {
        checkOptions: {
        tsconfig: "./tsconfig.storybook.json",
      },
    }
  },
}
// tsconfig.storybook.json
{
  "extends": "./tsconfig.json",
  "include": ["./src/**/*.stories.tsx"]
}

Are you able to assist to bring the feature to reality?

Can help with testing once it is installed onto master.

Additional context

https://github.com/storybookjs/storybook/issues/11804#issuecomment-668936341

PN dependencies help wanted typescript

Most helpful comment

@shilman
Can I try this?

All 2 comments

@shilman
Can I try this?

Hello all, a little heads up: fork-ts-checker-webpack-plugin recently released a 6.x pre-release (-alpha.1) which addresses https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/36 as mentioned here: https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/36#issuecomment-710771939. That fix is quite useful in Storybook's watch (start-storybook) mode as it makes the type checking feature more _complete_.

Was this page helpful?
0 / 5 - 0 ratings