Skip to content

Commit

Permalink
fix(star-warp): Fix type error when used as a Starlight plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryuni committed Oct 30, 2024
1 parent 43847c5 commit eda7b7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gold-toys-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@inox-tools/star-warp': patch
---

Fixes type error when used as a Starlight plugin.
12 changes: 11 additions & 1 deletion packages/star-warp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { z } from 'astro/zod';
import { makePlugin } from './configPlugin.js';
import type { AstroIntegration } from 'astro';
import { makeOpenSearchPlugin } from './openSearchPlugin.js';
import type { StarlightPlugin } from '@astrojs/starlight/types';

export default defineIntegration({
const integration = defineIntegration({
name: '@inox-tools/star-warp',
optionsSchema: z
.object({
Expand Down Expand Up @@ -102,3 +103,12 @@ export default defineIntegration({
return comboIntegration;
},
});

// Yeah it is like this for the type generation to result in friendly types.
// Deal with it future me!

const starWarp = integration as (
...args: Parameters<typeof integration>
) => AstroIntegration & StarlightPlugin;

export default starWarp;

0 comments on commit eda7b7d

Please sign in to comment.