Comments (7)
I think this is a bug and it would be nice to fix. PR's are always welcome.
from react-dts-generator.
@mozkarakoc will you adopt such MR?
from react-dts-generator.
The generator returns any
propType for undefined props. Could you provide more detailed sample input and expected output?
from react-dts-generator.
./Feedback.js
https://gist.github.com/vvscode/be98fb5072b498172913e3703edb7e16
const { generate } = require('react-dts-generator');
const result = generate({
input: './Feedback.js',
isBaseClass: true,
});
console.log(result);
gives me
~/r/docgen-issue [1]> node index.js
/Users/vvscode/repo/docgen-issue/node_modules/react-dts-generator/bin/src/utils.js:67
values.forEach(item => unions += `${item.value} | `);
^
TypeError: values.forEach is not a function
at generateOneOf (/Users/vvscode/repo/docgen-issue/node_modules/react-dts-generator/bin/src/utils.js:67:16)
at Object.generateProp (/Users/vvscode/repo/docgen-issue/node_modules/react-dts-generator/bin/src/utils.js:137:29)
at /Users/vvscode/repo/docgen-issue/node_modules/react-dts-generator/bin/src/index.js:44:46
at Array.forEach (<anonymous>)
at generate (/Users/vvscode/repo/docgen-issue/node_modules/react-dts-generator/bin/src/index.js:39:22)
at Object.<anonymous> (/Users/vvscode/repo/docgen-issue/index.js:2:16)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
debug output in code
function generateOneOf(name, values, flag) {
let unions = '';
values.forEach(item => unions += `${item.value} | `);
unions = unions.substr(0, unions.length - 3);
const property = dom.create.property(name, unions, flag);
return { property };
}
gives me
generateOneOf { name: 'feedbackActiveStep', values: 'Object.values(STEP)', flag: 8 }
from react-dts-generator.
I'm ready to provide a PR with tests and so on. Just wondering if you're fine about it
from react-dts-generator.
from react-dts-generator.
@vvscode thanks for your contribution. I'll publish a new version.
from react-dts-generator.
Related Issues (3)
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-dts-generator.