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

String Literal Param in Default Type Definition in Interface Function Causes Breakage #1035

Open
frank-weindel opened this issue Jun 24, 2024 · 1 comment · May be fixed by #1036
Open

String Literal Param in Default Type Definition in Interface Function Causes Breakage #1035

frank-weindel opened this issue Jun 24, 2024 · 1 comment · May be fixed by #1036

Comments

@frank-weindel
Copy link

frank-weindel commented Jun 24, 2024

Code

let var1;

interface MyInterface {
  func<T = Lowercase<'StringLiteral'>>(): T;
}

let var2;

JavaScript and TypeScript Nightly version: 5.6.0-dev.20240623

Screenshot 2024-06-24 at 12 33 28 PM

Breakage continues for many other keywords at the same block level such as: let, const, export, for, while, interface etc. class itself seems to overcome the breakage.

@frank-weindel
Copy link
Author

I've confirmed this also occurs with double quoted " string literal types and number literal types. As well as when the extends keyword is used.

let var1;

interface MyInterface {
  func1<T = Lowercase<'StringLiteral'>>(): T;
  func2<T = Lowercase<"StringLiteral">>(): T;
  func3<T = Lowercase<123>>(): T;
}

let var2;
let var1;

interface MyInterface {
  func1<T extends Lowercase<'StringLiteral'>>(): T;
  func2<T extends Lowercase<"StringLiteral">>(): T;
  func3<T extends Lowercase<123>>(): T;
}

let var2;

frank-weindel added a commit to frank-weindel/TypeScript-TmLanguage that referenced this issue Jun 25, 2024
frank-weindel added a commit to frank-weindel/TypeScript-TmLanguage that referenced this issue Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant