JS backend: generate copy function for data classes.