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.

nuxt/kit: incorrect declaration merging

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v16.9.1
  • Nuxt Version: 3-3.0.0-27238235.a1bcc53
  • Package Manager: npm
  • Bundler: Webpack
  • User Config: publicRuntimeConfig, build, css, buildModules
  • Runtime Modules: -
  • Build Modules: -

Describe the bug

It seems that nuxt kit adds a couple of hooks to nuxt but when this package installed by the user these hooks aren’t hinted at when using defineNuxtModule under the hooks property

export default defineNuxtModule({
    hooks: {
        'components:dirs'(dirs) {
            // Add ./components dir to the list
            dirs.push({
                path: path.join(__dirname, 'components')
            });
        }
    }
});

the declaration can be found here. If this isn’t desired perhaps the type ComponentsDir can be exported from kit so the user may us it above like 'components:dirs'(dirs: ComponentsDir) {

Reproduction

none

Additional context

No response

Logs

No response

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
pi0commented, Oct 18, 2021

@nandi95 Module authors should always add @nuxt/kit as a “dependency”.

0reactions
nandi95commented, Oct 18, 2021

@nandi95 Module authors should always add @nuxt/kit as a “dependency”.

ah that makes sense, hence why there are packages and a corresponding nuxt package as a wrapper 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Declaration Merging - TypeScript
For the purposes of this article, “declaration merging” means that the compiler merges two separate declarations declared with the same name into a...
Read more >
Member of merged string enum declaration incorrectly ...
declare module './test-module' : This is a declare -- it just declares things to exist, but it doesn't actually emit any code that...
Read more >
Typescript Declaration Merging fail about Express Request
This seems to be an issue with how you've configured ts-node . To keep things simple and also speed up startup I'd recommend...
Read more >
no-unsafe-declaration-merging - TypeScript ESLint
TypeScript's "declaration merging" supports merging separate declarations with the same name. Declaration merging between classes and interfaces is unsafe.
Read more >
Typescript interface declaration merging not working
I am using latest Intellij Idea 14.01 for Typescript dev and I noticed that interface merging was not working. For instance, i wanted...
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