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: improve custom tsType handling #25

Merged
merged 5 commits into from
Nov 18, 2021
Merged

fix: improve custom tsType handling #25

merged 5 commits into from
Nov 18, 2021

Conversation

danielroe
Copy link
Member

No description provided.

@danielroe danielroe requested a review from pi0 November 17, 2021 12:31
@danielroe danielroe self-assigned this Nov 17, 2021
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 17, 2021

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1b190eb
Status:🚫  Build failed.

View logs

@@ -186,14 +186,22 @@ function parseJSDocs (input: string | string[]): Schema {

if (firstTag >= 0) {
const tags = clumpLines(lines.slice(firstTag), ['@'], '\n')
const typedefs = tags.reduce((typedefs, tag) => {
const { 1: typedef, 2: alias } = tag.match(/@typedef\s+\{([\S\s]+)\} (.*)/) || []
Copy link
Member

Choose a reason for hiding this comment

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

Maybe using named groups?

@pi0
Copy link
Member

pi0 commented Nov 18, 2021

One more suggestion to make typedef support perfect, we need to find a way to generate top level import type {} in dts files. Since typeof import cannot be used for type-only exports (example: typeof import('pkg-types').TSConfig is not valid). I was thinking maybe as simplest way, when generating dts, we might replace import import('.*') with a top-level import?

@danielroe
Copy link
Member Author

@pi0 That would be nice idea. I'll push as separate PR as I think that can be implemented solely in dts generator.

@pi0 pi0 merged commit 696214d into main Nov 18, 2021
@pi0 pi0 deleted the fix/more-tweaks branch November 18, 2021 18:15
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