Hook types incomplete
See original GitHub issueVersion
@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:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I will look into this
@dipsaus9 @benjamincanac can be closed.