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.

vue-docgen-api: failed to parsed when exported component use "as" with typescript

See original GitHub issue

Current behavior We have exported components this way (for better typing extended components with composition api)

import { defineComponent } from '@vue/composition-api'
import CeHeader from './CeHeader'

const CeHeaderTheme = defineComponent({
  extends: CeHeader
})

export default CeHeaderTheme as typeof CeHeader

But this way of exporting causes warnings in storybook:

[vue-docgen-loader] failed to parse the component file with docgen-api: No suitable component definition found on...

To reproduce

Just export some component as default and add some as typeof operator:

export default {
  name: 'Test'
} as {
  name: string
}

Expected behavior

I would like to use “as” operator without any warnings.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mercs600commented, Apr 13, 2021

@shilman I love open source cooperation like this. It works like a charm.

1reaction
mercs600commented, Apr 12, 2021

@elevatebart I saw your changes in your repository, I have tested it with my current code base and it works great. I have crated PR to storybook to bump your package in this repository. Thank you for your time ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue-docgen-api: failed to parsed when exported component ...
On how it works: Use babel to parse the code; Find where the exports are in the file; Determine if each export is...
Read more >
vue-docgen-api: failed to parsed when exported component ...
Current behavior We have exported components this way (for better typing extended components with composition api) import { defineComponent } from ...
Read more >
vue-docgen-api - Vue Styleguidist
vue -docgen-api turns VueJs components into documentation objects. ... Same as parse , but allows for multiple exported components in one file.
Read more >
vue-docgen-api - npm
Start using vue-docgen-api in your project by running `npm i ... than one component exported by a file, which make parse throw an...
Read more >
Vue: Module parse failed when using "export * as" in TypeScript
I have an index.ts file to export all of my helpers functions. To import them in a ...
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