Skip to content

Commit

Permalink
fix: type-checking
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-ub committed Oct 7, 2024
1 parent ade44ae commit 68fb29c
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 49 deletions.
3 changes: 2 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@astrojs/check": "^0.9.3",
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
* loaded when a user imports the Vitesse integration in their Astro configuration file. These
* directives must be first at the top of the file and can only be preceded by this comment.
*/
/// <reference path="./rehype-toc.d.ts" />
/// <reference path="./locals.d.ts" />
/// <reference path="./i18n.d.ts" />
/// <reference path="./virtual.d.ts" />

import type { AstroIntegration } from 'astro'
import type { PluginTranslations, VitesseUserConfigWithPlugins } from './utils/plugins'
Expand Down
47 changes: 47 additions & 0 deletions src/virtual-internal.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
declare module 'virtual:vitesse/project-context' {
const ProjectContext: {
root: string
srcDir: string
trailingSlash: import('astro').AstroConfig['trailingSlash']
build: {
format: import('astro').AstroConfig['build']['format']
}
}
export default ProjectContext
}

declare module 'virtual:vitesse/user-css' { }

declare module 'virtual:vitesse/user-images' {
type ImageMetadata = import('astro').ImageMetadata
export const logos: {
dark?: ImageMetadata
light?: ImageMetadata
}
}

declare module 'virtual:vitesse/collection-config' {
export const collections: import('astro:content').ContentConfig['collections'] | undefined
}

// components
declare module 'virtual:vitesse/components/ToggleTheme' {
const ToggleTheme: typeof import('./components/ToggleTheme.astro').default
export default ToggleTheme
}
declare module 'virtual:vitesse/components/Footer' {
const Footer: typeof import('./components/Footer.astro').default
export default Footer
}
declare module 'virtual:vitesse/components/ScrollToTop' {
const ScrollToTop: typeof import('./components/ScrollToTop.astro').default
export default ScrollToTop
}
declare module 'virtual:vitesse/components/SiteTitle' {
const SiteTitle: typeof import('./components/SiteTitle.astro').default
export default SiteTitle
}
declare module 'virtual:vitesse/components/NavBar' {
const NavBar: typeof import('./components/NavBar.astro').default
export default NavBar
}
48 changes: 0 additions & 48 deletions src/virtual.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,7 @@ declare module 'virtual:vitesse/user-config' {
export default Config
}

declare module 'virtual:vitesse/project-context' {
const ProjectContext: {
root: string
srcDir: string
trailingSlash: import('astro').AstroConfig['trailingSlash']
build: {
format: import('astro').AstroConfig['build']['format']
}
}
export default ProjectContext
}

declare module 'virtual:vitesse/user-css' { }

declare module 'virtual:vitesse/user-images' {
type ImageMetadata = import('astro').ImageMetadata
export const logos: {
dark?: ImageMetadata
light?: ImageMetadata
}
}

declare module 'virtual:vitesse/plugin-translations' {
const PluginTranslations: import('./utils/plugins').PluginTranslations
export default PluginTranslations
}

declare module 'virtual:vitesse/collection-config' {
export const collections: import('astro:content').ContentConfig['collections'] | undefined
}

// components
declare module 'virtual:vitesse/components/ToggleTheme' {
const ToggleTheme: typeof import('./components/ToggleTheme.astro').default
export default ToggleTheme
}
declare module 'virtual:vitesse/components/Footer' {
const Footer: typeof import('./components/Footer.astro').default
export default Footer
}
declare module 'virtual:vitesse/components/ScrollToTop' {
const ScrollToTop: typeof import('./components/ScrollToTop.astro').default
export default ScrollToTop
}
declare module 'virtual:vitesse/components/SiteTitle' {
const SiteTitle: typeof import('./components/SiteTitle.astro').default
export default SiteTitle
}
declare module 'virtual:vitesse/components/NavBar' {
const NavBar: typeof import('./components/NavBar.astro').default
export default NavBar
}

0 comments on commit 68fb29c

Please sign in to comment.