Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error in prose components #1856

Closed
tobiasdiez opened this issue Jan 27, 2023 · 10 comments
Closed

Type error in prose components #1856

tobiasdiez opened this issue Jan 27, 2023 · 10 comments

Comments

@tobiasdiez
Copy link

Environment

  • Operating System: Windows_NT
  • Node Version: v19.4.0
  • Nuxt Version: 3.1.1
  • Nitro Version: 2.1.0
  • Package Manager: yarn@3.3.0
  • Builder: vite
  • User Config: alias, experimental, nitro, app, css, modules, runtimeConfig, routeRules, tailwindcss, graphqlServer, content, naiveUI, vite
  • Runtime Modules: @nuxtjs/tailwindcss@6.2.0, @huntersofbook/naive-ui-nuxt@0.5.1, @pinia/nuxt@0.4.6, ./modules/storybook, nuxt-graphql-server@1.1.5, nuxt-runtime-compiler@1.1.3, @nuxt/content@2.4.2
  • Build Modules: -

Reproduction

Run nuxi typecheck in a project using nuxt/content.

Describe the bug

Reports the error:

node_modules/@nuxt/content/dist/runtime/components/Prose/ProseH2.vue:15:65 - error TS2339: Property 'exclude' does not exist on type 'boolean'.

15 const generate = anchorLinks?.depth >= heading && !anchorLinks?.exclude.includes(heading)        

and similarly for the other prose components.

Additional context

No response

Logs

No response

@CosAnca
Copy link

CosAnca commented Jan 27, 2023

I'm facing the same error. The only workaround for now was to set all the headings as excluded.

# nuxt.config.ts
...
content: {
  markdown: {
    anchorLinks: {
      depth: 0,
      exclude: [1, 2, 3, 4, 5, 6],
    },
  },
},
...

@nobkd
Copy link
Contributor

nobkd commented Mar 8, 2023

Should be fixed with https://github.com/nuxt/content/releases/tag/v2.5.0

@tobiasdiez
Copy link
Author

I still have this with v2.5.2:

node_modules/@nuxt/content/dist/runtime/components/Prose/ProseH1.vue:15:31 - error TS2339: Property 'depth' does not exist on type 'boolean'.

15 const generate = anchorLinks?.depth >= heading && !anchorLinks?.exclude.includes(heading)
                                 ~~~~~

node_modules/@nuxt/content/dist/runtime/components/Prose/ProseH1.vue:15:65 - error TS2339: Property 'exclude' does not exist on type 'boolean'.

15 const generate = anchorLinks?.depth >= heading && !anchorLinks?.exclude.includes(heading)

@nobkd
Copy link
Contributor

nobkd commented Mar 23, 2023

Have you tried deleting the .nuxt directory?
I can't reproduce it, so I'm just guessing...

@botmaster
Copy link

botmaster commented May 4, 2023

Hello.
I still have this issue with v2.6.0.

CleanShot 2023-05-04 at 15 17 01

@nobkd did you find a workaround ?
Thanks @CosAnca for the workaround.

@nobkd
Copy link
Contributor

nobkd commented Jun 25, 2023

Is anyone able to provide a reproduction for this?
I'm really unable to get this error on typecheck... 🤷

@tobiasdiez
Copy link
Author

It's sadly not a minimal reproduction, but you can checkout JabRef/JabRefOnline#2070 to see the error with yarn typecheck.

@nobkd
Copy link
Contributor

nobkd commented Jun 27, 2023

Thanks. I can reproduce it locally too when I check out pr #2070.
(Even though I still don't understand, why the type-check fails in this project...)

@nobkd
Copy link
Contributor

nobkd commented Sep 23, 2023

I can see, that your PR was closed, as it was done. Happy to see this 👍

Was this just the result of upgrading Nuxt Content?
If yes, maybe because the h1-h6 part was extracted and rewritten with #2187 (and nuxt-modules/mdc@e5770b3 and some later commits)...

@tobiasdiez
Copy link
Author

Not sure what fixed it in the end. But I'm also happy its working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants