Skip to content

Commit a41df95

Browse files
authored
fix to prevent error in Ts 2.7+
Definite Assignment Assertions The definite assignment assertion is a feature that allows a ! to be placed after instance property and variable declarations to relay to TypeScript that a variable is indeed assigned for all intents and purposes, even if TypeScript’s analyses cannot detect so.
1 parent a3096ba commit a41df95

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ const s = Symbol('baz')
3333
@Component
3434
export class MyComponent extends Vue {
3535

36-
@Inject() foo: string
37-
@Inject('bar') bar: string
38-
@Inject(s) baz: string
36+
@Inject() foo!: string
37+
@Inject('bar') bar!: string
38+
@Inject(s) baz!: string
3939

40-
@Model('change') checked: boolean
40+
@Model('change') checked!: boolean
4141

4242
@Prop()
43-
propA: number
43+
propA!: number
4444

4545
@Prop({ default: 'default value' })
46-
propB: string
46+
propB!: string
4747

4848
@Prop([String, Boolean])
49-
propC: string | boolean
49+
propC!: string | boolean
5050

5151
@Prop({ type: null })
52-
propD: any
52+
propD!: any
5353

5454
@Provide() foo = 'foo'
5555
@Provide('bar') baz = 'bar'

0 commit comments

Comments
 (0)