kaleidawave / ezno

A JavaScript compiler and TypeScript checker written in Rust with a focus on static analysis and runtime performance
https://kaleidawave.github.io/posts/introducing-ezno/
MIT License
2.42k stars 45 forks source link

Reverse Uppercase argument (possibly linked to trailing when looking up properties) #174

Open kaleidawave opened 2 months ago

kaleidawave commented 2 months ago

While working on mapped types (#157), I found the following

interface X {
    a: 2,
    A: 4,
    b: 6
}

type UT<Type> = {
    [Property in keyof Type as Capitalize<string & Property>]: Type[Property]
};

declare let x: UT<X>;
x.A

x.A: 2 | 4

This is difficult because Property contribution is set inside

The argument could be fixed via

The actual lookup is a bit more complex

Also

kaleidawave commented 1 month ago

I think this was added in #157. There exists the CaseInsensitive type + mapping for inferred results. But no test for it yet