Using @Prop decorator for TypeScript - compilers gives error asking to initialise prop Using @Prop decorator for TypeScript - compilers gives error asking to initialise prop vue.js vue.js

Using @Prop decorator for TypeScript - compilers gives error asking to initialise prop


The initial error message is a result of TypeScript's Strict Class Initialization (introduced in 2.7). The release notes for 2.7 describe using the definite assignment operator (!) to address this issue. In your case, you'd do this:

@Prop({ default: '' }) private type!: string