Closed
Description
Bug Report
π Search Terms
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about jsdoc and export default
β― Playground Link
/**
* The complete Triforce, or one or more components of the Triforce.
*
* @typedef {Object} WishGranter
* @property {boolean} hasCourage - Indicates whether the Courage component is present.
* @property {boolean} hasPower - Indicates whether the Power component is present.
* @property {boolean} hasWisdom - Indicates whether the Wisdom component is present.
*/
/** @type {WishGranter} */
const works = {
hasCourage: true,
foo: false // correctly errors
}
// does not work for export default
/** @type {WishGranter} */
export default {
hasCourage: true,
foo: false // no error
}
// workaround that "breaks" prettier e.g. you can't format anymore as it will remove the `()`
// https://github.com/prettier/prettier/issues/11279
///** @type {WishGranter} */
//export default ({
// // type RocketCliConfig
//});
Compiler Options
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"esModuleInterop": true,
"checkJs": true,
"allowJs": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"target": "ES2017",
"jsx": "react",
"module": "ESNext",
"moduleResolution": "node"
}
}
Playground Link: Provided
π» Code
/** @type {import('rocket/cli').RocketCliConfig} */
export default {
// "no" type - e.g. any
}
π Actual behavior
It does not put any type for export default.
π Expected behavior
/** @type {import('rocket/cli').RocketCliConfig} */
export default {
// type RocketCliConfig
}
π Workaround
A possible workaround is to typecast via ()
but that "breaks" prettier as it will always remove it as "usless" brackets.
See prettier/prettier#11279
/** @type {import('rocket/cli').RocketCliConfig} */
export default ({
// type RocketCliConfig
})