silvenon / remark-smartypants

remark plugin to implement SmartyPants
MIT License
54 stars 3 forks source link

fix types for newest unified version #78

Closed mashehu closed 6 months ago

mashehu commented 11 months ago

This should fix the following typescript errors (when using the latest version of unified in @astrojs/markdown-remark):

@astrojs/markdown-remark:build:   Overload 1 of 3, '(preset?: Preset | null | undefined): Processor<Root, undefined, undefined, undefined, undefined>', gave the following error.
@astrojs/markdown-remark:build:     Type '(options?: void | Options | undefined) => void | Transformer<Root, Root>' has no properties in common with type 'Preset'.
@astrojs/markdown-remark:build:   Overload 2 of 3, '(list: PluggableList): Processor<Root, undefined, undefined, undefined, undefined>', gave the following error.
@astrojs/markdown-remark:build:     Argument of type '(options?: void | Options | undefined) => void | Transformer<Root, Root>' is not assignable to parameter of type 'PluggableList'.
@astrojs/markdown-remark:build:   Overload 3 of 3, '(plugin: Plugin<[], Root, Root>, ...parameters: [] | [boolean]): Processor<import("/Users/matho180/astro/node_modules/.pnpm/@types+mdast@4.0.2/node_modules/@types/mdast/index").Root, import("/Users/matho180/astro/node_modules/.pnpm/@types+mdast@3.0.14/node_modules/@types/mdast/index").Root, import("/Users/matho180/astro/node_modules/.pnpm/@types+mdast@3.0.14/node_modules/@types/mdast/index").Root, undefined, undefined>', gave the following error.
@astrojs/markdown-remark:build:     Argument of type '(options?: void | Options | undefined) => void | Transformer<Root, Root>' is not assignable to parameter of type 'Plugin<[], Root, Root>'.
@astrojs/markdown-remark:build:       Type 'void | Transformer<Root, Root>' is not assignable to type 'void | Transformer<Root, Root> | undefined'.
@astrojs/markdown-remark:build:         Type 'Transformer<Root, Root>' is not assignable to type 'void | Transformer<Root, Root> | undefined'.
hahnbeelee commented 11 months ago

Hi can this be merged? I'm also running into these issues

silvenon commented 11 months ago

Can you resolve conflicts? Let me know if you need help.

silvenon commented 6 months ago

I'll continue this effort in a separate PR, probably by refactoring the source code itself to TypeScript and building type definitions that way. Seems like the safest way instead of maintaining them separately.

Btw, I seem to recall being able to use this plugin recently without type errors, though 🤔 maybe @mdx-js/rollup didn't have the latest unified dependency or whatever.

silvenon commented 6 months ago

Thanks for your contribution, @mashehu! I'll report back once I make a release. Whoever else is interested can follow #84.