Property '' does not exist on type 'Object'. Observable subscribe

When you tell typescript:

WORKFLOW_DATA: Object

You are telling it that WORKFLOW_DATA is a plain object with no attributes. When you later try to access WORKFLOW_DATA.testDataArray the compiler thinks you misusing the type.

If you want type checking on WORKFLOW_DATA you need to create an interface that describes your object.


Typescript expects WORKFLOW_DATA to be Object here:

.subscribe( WORKFLOW_DATA => {} )

because you told it so:

  getWorkflowForEditor(): Observable<Object>

But Object doesn't have testDataArray property... You should either tell TypeScript that data can have any properties:

  getWorkflowForEditor(): Observable<any>

or use

console.log( WORKFLOW_DATA["testDataArray"] );