paramander / contentful-rich-text-vue-renderer

Render Contentful Rich Text field using Vue
https://www.npmjs.com/package/contentful-rich-text-vue-renderer
MIT License
38 stars 12 forks source link

Import error in Vue/Nuxt TypeScript #25

Closed jcjp closed 3 years ago

jcjp commented 3 years ago
TS7016: Could not find a declaration file for module 'contentful-rich-text-vue-renderer'. 'C:/Users/chamv/Documents/Ubuntu/Documents/Project/dscl/wli-frontend/node_modules/contentful-rich-text-vue-renderer/dist/index.cjs.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/contentful-rich-text-vue-renderer` if it exists or add a new declaration (.d.ts) file containing `declare module 'contentful-rich-text-vue-renderer';`       
    16 |   import {defineComponent} from '@nuxtjs/composition-api'
    17 |   import {useQuery, useResult} from '@vue/apollo-composable/dist'
  > 18 |   import RichTextRenderer from 'contentful-rich-text-vue-renderer'
       |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    19 |
    20 |   import LoadingSpinner from '~/components/loading-spinner.vue'
    21 |

It is working as expect with no error on JavaScript Vue/Nuxt script but switching to TypeScript it shows that error. I could simple put // @ts-ginore to ignore the error.

jcjp commented 3 years ago

I just declared it on my global.d.ts as the types is not available in the npm. We may now close this ticket.