You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #5949 implements F-bounded polymorphism. It doesn't seem to be working correctly for methods.
interfaceTable<T>{// For this method `T` is apparently a brand new type parameter.
insert<TextendsU,U>(obj: U): T;// insert(obj: any)}interfaceFoo{
a: string;
b: string;}letFoos: Table<Foo>;
// `foo1`'s type is inferred to be {a: 1}
let foo1 = Foos.insert({a: 1}) // =>;// Should produce errorletfoo2=Foos.insert({c: 1});
The text was updated successfully, but these errors were encountered:
This is by design. As you mention in your comment, your insert method introduces a new (and unused) type parameter called T that is constrained to extend U, but there is no constraint on U itself. I'm guessing you're trying to express that U must be a supertype of T. That's not currently possible, but there is some discussion of that issue in #6613.
PR #5949 implements F-bounded polymorphism. It doesn't seem to be working correctly for methods.
The text was updated successfully, but these errors were encountered: