-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
redux-orm broken by #43624 #43867
Comments
I mean, the difference is that we're relating models by variance now, whereas before it was structural. Technically it's a regression, but I assume the actual issue is that the variance of the first type parameter is incorrectly measured as contravariant. |
So this is a case of fixing a bug, which exposes another bug? =( |
So, I minified this down and came to the conclusion... that the error is actually, sort-of, technically correct. The Here's a greatly simplified comparison, take this: type ModelId<M extends ModelSub> = M; // just validates the input matches the `Model` type to issue an error
export declare class Model<MClass extends typeof ModelSub = typeof ModelSub> {
class: MClass;
readonly ref: ModelId<this>;
set<K>(value: K extends ModelId<this>['class'] ? number : string): void;
}
export declare class ModelSub extends Model {} and compare to type ModelId<M extends Model> = M; // just validates the input matches the `Model` type to issue an error
export declare class Model<MClass extends typeof Model = typeof Model> {
class: MClass;
readonly ref: ModelId<this>;
set<K>(value: K extends ModelId<this>['class'] ? number : string): void;
} (so, the same, but with Prior to the change, what'd happen is that the conditional in the Now... while that gets back the old no-error behavior for TL;DR: Three step process where our behavior flip-flops in the middle.
If you agree the new errors are better, we can put off 2 and 3 for awhile if need be (though we should get them both done rapidly so we don't visibly flip-flop behavior). If you disagree, we can scratch 3, and we should probably work on merging #31277 sooner, since that'll remove the errors from the variance based checks, which effectively regains the old behavior. In both cases, #31277 is the next step here. |
Your recommended steps sound good. (2) and (3) are now combined in #43887, right? Let's do the following:
|
The fix is too risky to take for 4.3, so wait until 4.4: microsoft/TypeScript#43867 (comment)
The fix is too risky to take for 4.3, so wait until 4.4: microsoft/TypeScript#43867 (comment)
The nightly dtslint run for 4/28 fails on redux-orm, with new errors on examples like:
Almost certainly a result of #43624, but it could be #42449 or #43835, since they went in on the same day.
If this is an intended result of that PR, can you fix up redux-orm? A naive change to
Ref<M extends Model>
doesn't work.The text was updated successfully, but these errors were encountered: