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

using typescript instance class #1996

Open
sarahBuisson opened this issue May 10, 2024 · 1 comment
Open

using typescript instance class #1996

sarahBuisson opened this issue May 10, 2024 · 1 comment

Comments

@sarahBuisson
Copy link

When I use ImmutableJs on the instance of a ts class, I didn"t get neither a record nor a FromJs


class A {
    constructor(public a: number) {
    }
}

console.log("A",fromJS(new A(2)));

Is it possible to use instance instead of structure?

@jdeniau
Copy link
Member

jdeniau commented May 10, 2024

I do not have a computer right now, but FromJS will return either a List or a Map.
In an object case, it will be converted to a Map, by iterating on each property.
You will probably have either a Map with a as key or an empty Map if the class a prop is not iterable.

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

2 participants