My snippet.
signUpInfo: {code: string, message: string}
= new Subject<{code: string, message: string}>();
The error Atom editor gives me.
Type 'Subject<{code: string, message: string}>' is not assignable to type '{code: string, message: string}'. Property 'code' is missing in type 'Subject<{code: string, message: string}>'.
Removing the typings in the variable, replacing by type any or {} removes the error.
signUpInfo = new Subject<{code: string, message: string}>();
signUpInfo: any = new Subject<{code: string, message: string}>();
signUpInfo: {} = new Subject<{code: string, message: string}>();
signUpInfo = new Subject<{code: string, message: string}>();
signUpInfo: any[] = new Subject<model[]>();
I am used to put a typeings on every variable in TS, I have no problems when passing regular types such as string number booleans etc. but when passing array or object as Subject variable typings it seems that Im not allowed to it.
What is the correct way of typing an object or array Subject variable in typescript?
