0

I have an object while running i am getting the following error as Property doesn't exist on type object can anyone tell me what am i doing wrong in it.

let filter = { project: 'Test', flow: 'basic', start: 0, length: 3 }; 

Error:

 src/app/_services/flow.service.ts(14,39): error TS2339: Property 'project' does not exist on type 'object'. src/app/_services/flow.service.ts(14,62): error TS2339: Property 'flow' does not exist on type 'object'. src/app/_services/flow.service.ts(14,83): error TS2339: Property 'start' does not exist on type 'object'. src/app/_services/flow.service.ts(14,106): error TS2339: Property 'length' does not exist on type 'object'. 
6
  • what property.. Commented Feb 26, 2019 at 6:47
  • Where do you see that error? Commented Feb 26, 2019 at 6:47
  • how do you use it? which property? Commented Feb 26, 2019 at 6:48
  • could you please share the error log Commented Feb 26, 2019 at 6:48
  • pleaseh share code snippet flow.service.ts where you getting error Commented Feb 26, 2019 at 6:51

4 Answers 4

4

You probably have filter typed as object[] as well. And property project does not exist on object. If you don't care about typing, you can declare filter as Array<any>:

let filter: Array<any>;

Sign up to request clarification or add additional context in comments.

Comments

3

Do this and the problem goes away,

private filter: any[]; 

Comments

1

The problem may be with your flow.service.ts field where you have set that to type object and all the field in filter don't exist on the type object. In your flow.service.ts change the feild type to any.

filter: any; 

Comments

-2

Initialize an object with name filter like:

filter = []; 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.