Skip to content

Incorrect type of LanguageDetail.keywords #3778

Closed
@alexeyinkin

Description

@alexeyinkin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions