Not working with compiled TypeScript declarations?
Closed this issue · 3 comments
I'm trying to use this loader with a Node package that contains both .js
files compiled from TypeScript and .d.ts
declaration file counterparts. However, it appears that this loader might not be reading the declaration files to generate a proper docgen, and therefore isn't getting component names or proptypes. In Storybook, I'm seeing the following:
Does this loader support compiled TypeScript with declarations? If not, is there any workaround for this?
Possibly related to #25
Closing this, as I believe the solution documented in the following thread solves this same issue: #25 (comment)
I have this problem.
For module made by me, did not work by below code.
// .storybook/webpack.config.js
const compilerOptions = {
...require('../../../tsconfig.json').compilerOptions,
};
delete compilerOptions.moduleResolution;
module.exports = (baseConfig, env, config) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: require.resolve('babel-loader'),
options: {
presets: [['react-app', { flow: false, typescript: true }]],
},
},
{
loader: require.resolve('react-docgen-typescript-loader'),
options: { compilerOptions },
},
],
});
config.resolve.extensions.push('.ts', '.tsx');
return config;
};
// *.stories.tsx
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Component } from 'original-modules';
storiesOf('Component', module).add('any caption', () => <Component />)
The exported component by modules has props information what only specific value for example defaultProps.
Because already build to not TypeScript.
For the reason, I am hoping to refer by *.d.ts
but it rendered only defaultProps.
@teddybradford Did you resolve this issue? How about the implement way?