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

react-select: doesn't compile since OptionType is a ReadonlyArray #35708

Closed
paillave opened this issue May 24, 2019 · 1 comment
Closed

react-select: doesn't compile since OptionType is a ReadonlyArray #35708

paillave opened this issue May 24, 2019 · 1 comment

Comments

@paillave
Copy link

paillave commented May 24, 2019

Since the commit bd1dc27 such a code doesn't compile anymore (the issue is at console.log([value.id])):

import { ValueType, ActionMeta } from "react-select/lib/types";

interface IOptionType {
    id: number;
    name: string;
};

function mappedOnChange(value: ValueType<IOptionType>) {
    if (value) {
        if (value instanceof Array) {
            console.log(value.map(i => i.id));
        }
        else {
            console.log([value.id]);
        }
    }
}
@paillave paillave reopened this May 24, 2019
paillave added a commit to paillave/DefinitelyTyped that referenced this issue May 25, 2019
@paillave
Copy link
Author

Actually, the issue is not here but in TypeScript it self.
here is the issue with the workaround mentioned at the end: microsoft/TypeScript#17002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant