question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Output files are not recognized without exports

See original GitHub issue

Sorry if I’m understanding something wrong here. I’m still learning TypeScript (or rather exporting TypeScript definitions from a JavaScript project).

The generated d.ts files don’t have any export statements. Your readme states that the JSDoc @exports annotation is not needed as everything is exported, but I’m not sure how the generated definitions are supposed to work without export statements.

VSCode

VSCode uses the DefinitelyTyped repository in order to automatically fetch TypeScript definitions for auto completion and documentation tooltips.

image

Every single of them has export statements and they don’t seem to work without them.

fast-deep-equal

fast-deep-equal is distributed with its own definition file and VSCode recognizes that one and displays basic typing info.

image

resource-loader

Your module resource-loader also gets distributed with its own definition file, but that one doesn’t have export statement as it comes from tsd-jsdoc.

Trying with module.default.

image

Trying with new module.default().

image

Trying with new module.Loader().

image

Question

Do you think tsd-jsdoc could need the option to create a TypeScript definition file that contains export statements? If not, I guess I will have to write a post processor that takes tsd-jsdoc-generated files as input and outputs TypeScript definitions with export statements.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
englercjcommented, Feb 9, 2019

Could a custom JSDoc tag be a real solution? Something like @tsExport?

I’m currently leaning towards marking anything within a “declare module” as export, and letting you use @ignore, etc to skip things.

Also, are you personally fine with adding support for ES6 modules in your project?

Depends on what you mean, I definitely want to support ES6 but there is only so much that can be done on this side of jsdoc. I’m open to changes to work around jsdoc limitations though.

0reactions
glen-84commented, May 29, 2020

@englercj,

When using the TypeScript compiler to generate definitions, the following:

// ... classes etc.

module.exports = XlsxPopulate;

Results in:

export = XlsxPopulate;

// ... declare classes etc.

Is it not possible for this library to do the same?

(I’m unable to use the TS compiler because of the issues mentioned here.)

Edit: I guess that might require a separate output file to be generated for each input file?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exporting a class with Webpack and Babel not working
Default exports are stored in the default property of the module. If you want to make your library accessible without users having to...
Read more >
Why don't I see the output files? - Export Kit
I am using Windows 8/Photoshop CC, and Export Kit Suit v125 does not write the html or css. It goes through the process...
Read more >
Fix export issues in Premiere Pro - Adobe Support
If you are not exporting to H.264, or if the issue persists: Choose File > Project Settings > General. The Project Settings window ......
Read more >
PROC EXPORT Statement - SAS OnlineDoc, V8
OUTFILE="filename": specifies the complete path and filename of the output PC file, spreadsheet, or delimited external file. If the name does not include ......
Read more >
EXPORT command - IBM
If the complete path to the file is not specified, the export utility uses the current ... OF filetype: Specifies the format of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found