Skip to content

Commit 2b9e6c2

Browse files
committed
fix: follow existing pattern to add ShareCard.d.vue.ts
1 parent 7f8f5d9 commit 2b9e6c2

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This type declaration file is required to break a circular type resolution in vue-tsc.
2+
// And is based off Package.d.vue.ts
3+
//
4+
// nuxt-og-image generates a type declaration (.nuxt/module/nuxt-og-image.d.ts) that imports
5+
// this component's type. This creates a cycle: nuxt.d.ts → nuxt-og-image.d.ts → ShareCard.vue →
6+
// needs auto-import globals from nuxt.d.ts. Without this file, vue-tsc resolves the component
7+
// before the globals are available, so all auto-imports (computed, toRefs, useFetch, etc.) fail.
8+
9+
import type { DefineComponent } from 'vue'
10+
11+
declare const _default: DefineComponent<{
12+
name: string
13+
theme?: 'light' | 'dark'
14+
color?: string
15+
}>
16+
17+
export default _default

app/utils/colors.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
export function withAlpha(color: string, alpha: number): string {
99
if (color.startsWith('oklch(')) return color.replace(')', ` / ${alpha})`)
1010
if (color.startsWith('#'))
11-
return color + Math.round(alpha * 255).toString(16).padStart(2, '0')
11+
return (
12+
color +
13+
Math.round(alpha * 255)
14+
.toString(16)
15+
.padStart(2, '0')
16+
)
1217
return color
1318
}
1419

0 commit comments

Comments
 (0)