Skip to content

(TypeScript) Camel-case type parameters: only first component is highlighted #3403

@cakoose

Description

@cakoose

Describe the issue

In the type parameter "OutT", the "Out" is highlighted differently from the "T".

Which language seems to have the issue?

typescript

Are you using highlight or highlightAuto?

Not sure. I noticed this issue on StackOverflow and reproduced with your JSFiddle template.

Sample Code to Reproduce

https://jsfiddle.net/650rLwyd/

Screenshot:

Screen Shot 2021-11-20 at 15 30 25

Expected behavior

GitHub's highlighting in markdown code fences looks better:

type ParseFunc<OutT, InT> = (val: InT) => OutT;

declare const parseString: ParseFunc<string, unknown>;

declare const makeParseObject: <FPs extends {[s: string]: ParseFunc<any, any>}> (fieldParsers: FPs)
    => ParseFunc<ParseObjectResult<FPs>, unknown>;
type ParseObjectResult<FPs extends {[s: string]: ParseFunc<any, unknown>}> =
    {[F in keyof FPs]: ParseResult<FPs[F]>}
type ParseResult<P> = P extends ParseFunc<infer OutT, unknown> ? OutT : never;

Screenshot, just in case it changes:

Screen Shot 2021-11-20 at 15 27 32

Additional context

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