Comments (12)
So there were two issues:
- Multi-line description strings were not being escaped properly.
- Multiple props were not having a comma added as a separator.
Can you try version 1.0.1 and see if that fixes your issue?
from react-docgen-typescript-loader.
hello! i am using 1.0.1. now the issue is Uncaught SyntaxError: Unexpected token -
and the source of it seems to be this JS code:
edit: i investigated this and this was due to me importing a Modal component from react-bootstrap
. once i removed it it worked!
from react-docgen-typescript-loader.
@tsiq-swyx I was able to reproduce the issue. Can you try v1.0.2?
from react-docgen-typescript-loader.
yes, and it was totally fixed. wow!
from react-docgen-typescript-loader.
@strothj my Unexpected identifier
was related to importing from "react-select":
...
import Select, { ReactSelectProps } from "react-select";
And there are 2 members of ReactSelectProps
interface that are causing the error:
1.
/**
* Message to use for screenreaders to press backspace to remove the current item
* {label} is replaced with the item label
* @default "Press backspace to remove..."
*/
backspaceToRemoveMessage?: string;
/**
* whether the Select is loading externally or not (such as options being loaded).
* if true, a loading spinner will be shown at the right side.
* @default false
*/
isLoading?: boolean;
I don't know why these annotations are compiled without closing quote:
If I edit comment or remove this import, everything works fine.
from react-docgen-typescript-loader.
@ainalain Are you still having this problem with v1.0.2 ? I think this was related to not escaping the new lines in description text which I believe is fixed.
from react-docgen-typescript-loader.
@strothj Yes, unfortunately, v1.0.2 didn't help.
from react-docgen-typescript-loader.
I didn't encounter these sorts of problems with the Babel plugin I developed since it was operating on the AST.
I think I will need to investigate another place to hook into the pipeline to gain access to the original TypeScript source. Right now I'm only getting access to the post compiled output from ts-loader. I think generating the code snippet as an AST will prevent issues with strings having line breaks, etc.
I will need to investigate further.
from react-docgen-typescript-loader.
I understand. It would be cool to have all documentation tools provided by storybook but I know that typescript always adds extra challenge.
from react-docgen-typescript-loader.
Yep, I plan to look at this again soon. I'm working to knock out a milestone for a client's project at the moment. As soon as that's done I'll be taking a deep dive into it.
from react-docgen-typescript-loader.
Hello, I have begun work on code transformation at the original source code level. This will allow inserting the generated code before it is compiled by Webpack. This should resolve the esnext
module target issue. The line wrapping issue will be resolved through the use of AST to generate the code instead of string interpolation.
Tracking this on #3
from react-docgen-typescript-loader.
Closing as it is addressed by plugin.
from react-docgen-typescript-loader.
Related Issues (20)
- Discrepancy with ts-loader in monorepos
- Failure to describe props defined externally (without a corresponding component) HOT 1
- There is a bug when my filename is "switch" HOT 2
- React-native support ?
- Failed to launch - TypeError: Cannot read property 'getSourceFile' of undefined HOT 1
- Code fails when using displayName that contains invalid characters or reserved words HOT 4
- Missing peerDependency for @webpack-contrib/schema-utils
- Doesn't support union types HOT 7
- Crashing and performance issues with storybook 5.3 HOT 4
- Typescript errors HOT 6
- Importing component defined in index breaks the docgen HOT 1
- Component description detection doesn't work well with the Component Story Format (CSF) HOT 1
- The component file Name should be Capital Case to show Props
- Output more information on union types in prop values HOT 2
- Reversal of 3.7.0 HOT 3
- defaultValue value without double quotes
- question about customization of page layout? HOT 1
- Inline subtype shape inferred as "signature" HOT 1
- Looking for maintainer
- Can the loader use *.js+*.d.ts and work without TS source files and without ts-loader? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-docgen-typescript-loader.