Vue Prop has no initializer and is not definitely assigned in the constructor
You don't need set strictPropertyInitialization": false
to solve this.
According to this link in Microsoft TypeScript-Vue-Starter repo:
Properties are defined by prefixing instance variables with the @Prop() decorator from the vue-property-decorator package. Because the --strictPropertyInitialization option is on, we need to tell TypeScript that Vue will initialize our properties by appending a ! to them. This tells TypeScript "hey, relax, someone else is going to assign this property a value."
You just need to append the !
to the prop name:
@Prop({default: '', required:false}) tag!: string
Update 2020/06/15
My original answer I gave at the time was a intermittent solution and not the correct one. This answer is the correct way of doing this; Appending the prop name with a !
.
Original Answer
I had the same issue. I fixed it by adding "strictPropertyInitialization": false,
to tsconfig.json's compilerOptions.
{ "compilerOptions": { "outDir": "./built/", "sourceMap": true, "strict": true, "noImplicitReturns": true, "experimentalDecorators": true, "module": "es2015", "moduleResolution": "node", "target": "es5", "strictPropertyInitialization": false, "lib": [ "es5", "es2015", "dom", "ScriptHost" ] }, "include": [ "./src/**/*" ]}