-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage with esModuleInterop option #100
Comments
Do you use it with your custom
|
Hello, I had an issue come up regarding this in my project (which is a wrapper for this one): It seems that:
doesn't work, while this does:
|
@pvasek no, I got into all sorts of trouble when trying to use my custom But I tried changing the |
@Risker - I am guessing you have I had the same problem (but I'm an idiot and opened a separate issue for it: #102). The fix for me was to change the We figured this out after @photusenigma pointed me at this issue. My working config for a TS storybook project looks like the following (since it is {
"compilerOptions": {
/* Basic Options */
"target": "es2015",
"lib": [ // Specify library files to be included in the compilation.
"dom",
"es2015",
"es2017"
],
"jsx": "react", // Specify JSX code generation.
/* Strict Type-Checking Options: you may not need this but we are pedants */
"strict": true, // Enable all strict type-checking options.
"strictNullChecks": true, // Enable strict null checks.
/* Additional Checks */
"noUnusedLocals": true, // Report errors on unused locals.
"noUnusedParameters": true, // Report errors on unused parameters.
"noImplicitReturns": true, // Report error when not all code paths in function return a value.
"noFallthroughCasesInSwitch": true, // Report errors for fallthrough cases in switch statement.
/* Module Resolution Options */
"moduleResolution": "node", // Specify module resolution strategy.
"allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
"esModuleInterop": true, // Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports.
},
"exclude": ["node_modules/"]
} |
Hey, I just found a small error on my part - I had So I would like to change the objective of this issue - could it be possible to add |
|
Hi, thanks for this docgen!
TypeScript 2.7 added the
--esModuleInterop
compiler option. This should simplify imports, for example if previously it was necessary toimport * as React from 'react';
, it is now possible toimport React from 'react';
and the TypeScript compiler is happy.However, by using the new import statements,
react-docgen-typescript
stopped working. It does not recognize the parsed file as a React component anymore (i think). 'Any idea how I could get this to work?
The text was updated successfully, but these errors were encountered: