TypeScript Version: 2.8.3
Search Terms:
jsdoc default export expression type
Code
import webpack from 'webpack';
// works
/** @type {webpack.Configuration[]} */
const foo = [ {}, {} ]; // has correct type
/** @type {webpack.Configuration[]} */
export default [ {}, {} ]; // has wrong type
/** @export {webpack.Configuration[]} */
export default [ {}, {} ]; // has wrong type
/** @exports {webpack.Configuration[]} */
export default [ {}, {} ]; // has wrong type
Expected behavior:
JSDoc type information is used.
Actual behavior:
JSDoc type information is not used.
Playground Link: n/a
Related Issues: none
I would say this is the correct form
/** @type {webpack.Configuration[]} */
export default [ {}, {} ]; // has wrong type
meanwhile as a workaround, you can use cast syntax:
```ts
export default /** @type {webpack.Configuration[]} */([{}, {}]);
````
Also impacted by this! I'm super new to TypeScript (only really use JSDoc within VS Code) but thought I'd poke around this issue a bit - I'm a little unsure of where to put an example test though. Is this the correct location / test style?
TypeScript\tests\cases\conformance\jsdoc\jsdocTypeTagExport.ts
// @allowJS: true
// @suppressOutputPathCheck: true
// @strictNullChecks: true
// @filename: a.js
/** @type {(key: string) => string} */
export default (key) => key;
// @filename: b.ts
export default (key: string) => string;
@IanMitchell You also need // @checkJs: true but otherwise you've got it.
@mhegazy workaround works.
export default /** @type {webpack.Configuration[]} */([{}, {}]); // OK
but the desired syntax does not
/** @type {webpack.Configuration[]} */
export default [{}, {}]); // Wrong
any Roadmap?
Export default doesn't work again. In-lining the type doesn't fix it.

It's hitting me too.

I'm running a Vue2 application with JavaScript. No typescript is involved.