Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't break transform when there is no space between unnamed default exported function and generic parameter bracket #305

Merged
merged 1 commit into from
May 4, 2024

Conversation

brc-dd
Copy link
Contributor

@brc-dd brc-dd commented May 2, 2024

Currently it throws errors like this:

[!] (plugin dts) Error: Syntax not yet supported

  62 | }
  63 |
> 64 | declare functionexport_default<T extends Request = Request>(
     | ^^^^^^^
  65 |  options?: IOptions<T>
  66 | ): Polka<T>;
  67 |
node_modules/.pnpm/polka@1.0.0-next.25/node_modules/polka/index.d.mts
    at Transformer.convertStatement (file:///Users/divyansh/vitepress/node_modules/.pnpm/rollup-plugin-dts@6.1.0_rollup@4.17.2_typescript@5.4.5/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.mjs:1301:19)
    at new Transformer (file:///Users/divyansh/vitepress/node_modules/.pnpm/rollup-plugin-dts@6.1.0_rollup@4.17.2_typescript@5.4.5/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.mjs:1230:18)
    at convert (file:///Users/divyansh/vitepress/node_modules/.pnpm/rollup-plugin-dts@6.1.0_rollup@4.17.2_typescript@5.4.5/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.mjs:1221:25)
    at Object.transform (file:///Users/divyansh/vitepress/node_modules/.pnpm/rollup-plugin-dts@6.1.0_rollup@4.17.2_typescript@5.4.5/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.mjs:1668:31)
    at handleDtsFile (file:///Users/divyansh/vitepress/node_modules/.pnpm/rollup-plugin-dts@6.1.0_rollup@4.17.2_typescript@5.4.5/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.mjs:1805:54)
    at Object.transform (file:///Users/divyansh/vitepress/node_modules/.pnpm/rollup-plugin-dts@6.1.0_rollup@4.17.2_typescript@5.4.5/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.mjs:1840:24)
    at /Users/divyansh/vitepress/node_modules/.pnpm/rollup@4.17.2/node_modules/rollup/dist/shared/rollup.js:989:40

Input:

export default function<T extends Request = Request>(
	options?: IOptions<T>
): Polka<T>;

Please see added test for easier repro.

@brc-dd brc-dd changed the title fix: don't break transform when there is no space between function and generic parameter fix: don't break transform when there is no space between unnamed default exported function and generic parameter bracket May 2, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Swatinem Swatinem merged commit 7198ba0 into Swatinem:master May 4, 2024
6 checks passed
@brc-dd brc-dd deleted the fix-spacing branch May 4, 2024 13:34
@brc-dd
Copy link
Contributor Author

brc-dd commented May 18, 2024

@Swatinem Hi, sorry for the ping, but can a patch version be published? 🙏

@Swatinem
Copy link
Owner

👍🏻 published a patch version now, sorry for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants