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

fix(types): Add useNuxtImage type into runtime config #191

Merged
merged 1 commit into from
May 16, 2024

Conversation

binaryoverload
Copy link
Contributor

@binaryoverload binaryoverload commented May 1, 2024

A type issue in the newly released version 0.7.0 and introduced by #180 seems to be that the runtime config type wasn't updated to include the useNuxtImage type which is causing nuxi typecheck to fail with the error:

node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseImg.vue:15:52 - error TS2339: Property 'useNuxtImage' does not exist on type '{ components: { prose: boolean; map: Record<string, string>; }; headings: { anchorLinks?: { h1?: boolean | undefined; h2?: boolean | undefined; h3?: boolean | undefined; h4?: boolean | undefined; h5?: boolean | undefined; h6?: boolean | undefined; } | undefined; } | undefined; }'.

15 const imgComponent = useRuntimeConfig().public.mdc.useNuxtImage ? resolveComponent('NuxtImg') : 'img'
                                                      ~~~~~~~~~~~~


Found 1 error in node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseImg.vue:15

I have verified this change which I originally applied via pnpm patching:

diff --git a/dist/module.d.mts b/dist/module.d.mts
index a7d60f544b012898715d82b430df1ac07faab004..3619a534a9f13f5f3c4835c80b6477648e278bc9 100644
--- a/dist/module.d.mts
+++ b/dist/module.d.mts
@@ -83,6 +83,7 @@ declare module '@nuxt/schema' {
                 map: Record<string, string>;
             };
             headings: ModuleOptions['headings'];
+            useNuxtImage?: boolean;
         };
     }
     interface ConfigSchema {
diff --git a/dist/module.d.ts b/dist/module.d.ts
index 581941eaa560059fc5abce4329f0057ee5678a83..dfd089e203ad21631d2a78da69ba36811570fa3b 100644
--- a/dist/module.d.ts
+++ b/dist/module.d.ts
@@ -82,6 +82,7 @@ declare module '@nuxt/schema' {
                 prose: boolean;
                 map: Record<string, string>;
             };
+            useNuxtImage?: boolean;
             headings: ModuleOptions['headings'];
         };
     }

@adamdehaven
Copy link
Contributor

@farnabaz just came here to report the same issue; the proposed change in this PR resolves for me as well 🚢

@Atinux Atinux changed the title Add useNuxtImage type into runtime config fix(types): Add useNuxtImage type into runtime config May 14, 2024
@farnabaz farnabaz merged commit 444cbef into nuxt-modules:main May 16, 2024
1 of 2 checks passed
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

Successfully merging this pull request may close these issues.

None yet

4 participants