-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Cannot assign to read only property'type'of object'#<Banner>'` #1458
Comments
Sorry, but I do not understand what you mean and what you are trying to do |
Example:
app.js
|
Looks like an issue of the transpiler plugin you are using. Does using |
Yes, it does. |
okay, are you able to create a pull request for this change and make sure its not breaking anything else in typescript infrastructure? |
Emm,I need time to test it.I'll give you a reply later. |
I also went through this issue. Apparently the babel class-properties proposal plugin in loose mode transpiles class properties without pre-assigned value non-writable. Not sure if this is a bug or intended.. Right now one solution is to assign any default values as below ( import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
@Entity('banner')
export class Banner {
@PrimaryGeneratedColumn()
id = undefined;
@Column()
type = 1;
} |
After certain tests I found that it does not work in typescript. I think problem is in babel plugin and it should be resolved there. I remember I was already reporting to them this issue year ago. Closing. |
Yes, I also found that the porblem was due to the inconsistency of bable plugin and typescript to the interpretation of decorator. |
In the JavaScript grammar. After an instance of the @entity () modified new object, the attribute value of the instance can not be changed
TypeError: Cannot assign to read only property'type'of object'#<Banner>'
I try to add
descriptor.writable = true
in Column and so on.Did I make a mistake?
The text was updated successfully, but these errors were encountered: