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

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

Open
kaleidawave opened this issue Jul 18, 2024 · 0 comments
Assignees
Labels
checking Issues around checking tsc-behaviour Trying to match TSC behaviour

Comments

@kaleidawave
Copy link
Owner

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

  • CovariantContribution::CaseInsenstive
  • Which specialised to intrinsic TypeId::CASE_INSENSITIVE alias type (similar to existing intrinsics)

The actual lookup is a bit more complex

  • get_property_unbound with PropertyKey where it can be an or (or or-like through a big or) should collect possibles
    • Does this collect things correctly? Is some information lost and the parameter made bigger?
  • slice_matches should have a case insensitive boolean parameter?

Also

  • function x<T>(u: Uppercase<T>): T. x("hi"): CaseInsensitive<"hi">
  • Subtyping
@kaleidawave kaleidawave added checking Issues around checking tsc-behaviour Trying to match TSC behaviour labels Jul 18, 2024
@kaleidawave kaleidawave self-assigned this Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checking Issues around checking tsc-behaviour Trying to match TSC behaviour
Projects
None yet
Development

No branches or pull requests

1 participant