Open huashiyiqike opened 7 years ago
dts-gen works differently from TypeScript, Flowtype, Tern, etc. because it simply examines the objects as they appear at runtime, rather than needing the source code that creates the object. This means no matter how the object was written, anything, including native objects, can be given an inferred shape.
This trade-off comes with a price -- you'll see a lot of anys in function parameters and return types. You may also see properties that are not intended for public use. dts-gen is meant to be a starting point for writing a high-quality definition file.
Now I get it, tsc won't generate header for normal js packages.
tsc -d velocity-react --allowJs error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
Yet, is there a way to generate type definitions with dts-gen for packages locally installed in node_modules directory? Seems that is not supported.
@huashiyiqike use npm | yarn link
The two commands seem the same. What are the differences and which one should I use?