Skip to content

Can we correctly understand TypeScript with only a lexer? #4316

Description

@jafl

This example seems like it requires a parser, not just a lexer:

function identity<Type>(arg: Type): Type {
  return arg;
}

let output = identity<string>("myString");

Without knowing what comes after < in the last line, it seems to be impossible to tell if it's a comparison operator or a generics declaration.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions