After realizing that create-react-app now supports typescript, I encountered some issues while trying to transfer my current codebase from react-scripts-ts
. Most of my classes are based on Record
and cannot be constructed anymore due to errors like:
Cannot set on an immutable record.
I stumbled upon an old Babel issue with a similar problem but couldn't find any guidance on how to configure Babel to fix it. How can I resolve this?
I implement Immutable.js as explained here, for example:
import { Record } from 'immutable'
interface PersonProps {
firstName: string
lastName: string
}
const defaultPersonProps: PersonProps = {
firstName: '',
lastName: '',
}
class Person extends Record(defaultPersonProps) implements PersonProps {
public readonly firstName!: string
public readonly lastName!: string
public constructor(values: PersonProps) {
super(values)
}
}
Check out the related issue on GitHub