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.

Hook types incomplete

See original GitHub issue

Version

@nuxt/content: 1.7.0 nuxt: 2.14.1

Steps to reproduce

When using hooks in the nuxt config TypeScript warns me for incomplete types of the hook builder by Nuxt.

//nuxt.config.ts
export default {
  modules: [,
    '@nuxt/content'
  ],
  hooks: {
    'content:file:beforeInsert': (document) => {
      if (document.extension === '.md') {
        const { time } = require('reading-time')(document.text)

        document.readingTime = time
      }
    }
  }
}

TypeScript doesn’t know the content:file:beforeInsert function (and other hooks)

What is Expected?

That TypeScript and the Nuxt type config knows these options.

What is actually happening?

The Nuxt content decalrations should be expanded for hooks: https://github.com/nuxt/content/blob/1dff4e9e9c4bcff03396d711c37f5eee70b8690c/packages/content/types/index.d.ts#L35

As a start I tried the following:


declare module "@nuxt/types" {
	...
	interface Configuration {
		"content:file:beforeInsert": (document: any) => void;
	}
	...
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
mathe42commented, Aug 27, 2020

I will look into this

0reactions
mathe42commented, Sep 14, 2020

@dipsaus9 @benjamincanac can be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incomplete fracture | Radiology Reference Article - Radiopaedia
Incomplete fractures are a heterogeneous group of fractures that predominantly occur in the long bones of pediatric patients.
Read more >
React Hook Form dirtyFields returns incomplete/ missing field ...
One field in my form endTimeMins seems to be not registering to formState. I have four fields all of them have no problem...
Read more >
Compound incomplete dislocation of the trapezium ... - PubMed
A wringer injury with a compound "fracture" dislocation of the trapezium treated with single Kirschner-wire axial-fixation to the proximal second metacarpal ...
Read more >
How and When to Use Hooks to Improve Deformity Correction
If there is bone overlying from an incomplete osteotomy, a curette can be used to easily complete the resection. This sequence will allow...
Read more >
Types of events – curl - Stripe API reference
subscription do not trigger the parent's update event. Events marked as selection required are only created when a webhook has been configured to...
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