-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
An argument for 'reviver' was not provided. #1935
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
Comments
Real world just-upgrade breaking test suite: reactive/data-client#2424 CI: https://app.circleci.com/pipelines/github/data-client/rest-hooks/9617/workflows/48caf48a-179e-4b43-a1db-a1388047347a/jobs/61606 |
I tried some things, and it's kind of funny (or weird) import { fromJS } from 'immutable';
const create = [(data: any) => data, fromJS][1];
create({}); // do error
const create2 = [fromJS][0];
create2({}); // works fine
const create3 =([(data: any) => data, fromJS] as const)[1];
create3({}); // works fine
const create4 = [(data: any, useless = undefined) => data, fromJS][1];
create4({}); // works fine In the first example, the created array has a type like I see in your test stack that you already use a |
After some tests, I think #1936 does fix this and is a better declaration file for me :
|
Yeah that looks like a reasonable solution. Just to provide some clarity about the tests - while the 'as const' does wrap the whole tuple of tuples; since test.each is iterating through the first array; the function will end up acting on either - which is why it ends up in a union type. Though really I was just trying to create another function with the same usage as fromJS. (I never call it with a second arg). I think the generation of a full union type is correct; but the fact that this breaks polymorphic functions seems to be the bug in TypeScript. |
What happened
Upgraded from 4.2.2 to 4.2.4 to 4.3.4
#1927 is the culprit
How to reproduce
typescript 4.9.5
immutable 4.2.4
https://stackblitz.com/edit/typescript-sk2pyy?file=index.ts
The text was updated successfully, but these errors were encountered: