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

Incorrect type of LanguageDetail.keywords #3778

Closed
alexeyinkin opened this issue May 3, 2023 · 1 comment · Fixed by #3779
Closed

Incorrect type of LanguageDetail.keywords #3778

alexeyinkin opened this issue May 3, 2023 · 1 comment · Fixed by #3779
Labels
bug help welcome Could use help from community parser

Comments

@alexeyinkin
Copy link
Contributor

LanguageDetail.keywords are currently defined as

keywords?: Record<string, any> | string

But we have at least 3 formats:

  1. Whitespace-separated string as in Cos.
  2. string[] as in Dockerfile.
  3. Record<string, string | string[]> (plus optional $pattern) as in Dart.

The 2nd one is illegal in that definition. And the 3rd one is not as specific as it can be.

Should the correct one be string | string[] | Record<string, string | string[]> ?

Same goes for ModeDetail.

Since we are here, must we really support that variety of definitions? Is there a performance difference in loading that? Or is there no reason to prefer whitespace-separated string over string[]? Could we change to something like Record<string, string[]> in version 12? (plus some provision for $pattern: string, not sure how to code that correctly).

The reason I care is that I am porting your package to Dart, and the porting script for diverse definitions is harder to maintain.

@alexeyinkin alexeyinkin added bug help welcome Could use help from community parser labels May 3, 2023
@alexeyinkin alexeyinkin changed the title Incorrect type of LanguageDetail.keyword Incorrect type of LanguageDetail.keywords May 3, 2023
@joshgoebel
Copy link
Member

string | string[] | Record<string, string | string[]>

Yes, I believe that was the intent. PR would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help welcome Could use help from community parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants