diff --git a/.changeset/dry-houses-pay.md b/.changeset/dry-houses-pay.md new file mode 100644 index 00000000..8db12bd5 --- /dev/null +++ b/.changeset/dry-houses-pay.md @@ -0,0 +1,5 @@ +--- +"mdsvex": patch +--- + +Infer the settings type when using unified plugins with settings diff --git a/packages/mdsvex/src/types.ts b/packages/mdsvex/src/types.ts index 3d5a25c8..518a058a 100644 --- a/packages/mdsvex/src/types.ts +++ b/packages/mdsvex/src/types.ts @@ -182,7 +182,11 @@ interface HighlightOptions { alias?: Record; } -export type UnifiedPlugins = Array<[Plugin, Settings] | Plugin>; +export type PluginWithSettings< + S extends any[] = [Settings?], + P extends Plugin = Plugin +> = [P, ...S]; +export type UnifiedPlugins = Array; export interface TransformOptions { remarkPlugins?: UnifiedPlugins;