5

I have the following interface:

export interface ITransaction {
   id: number;
   description: string;
   category: string;
   tags: array;
   date: string;
   amount: number;
}

Obviously I'm declaring it wrong as I'm seeing an error in my editor. As you can see, tags ought to be an array. This is how the data look in JSON format:

{
   "id": 1,
   "description": "Sandwich",
   "date": "2017-09-01",
   "category": "Take away",
   "tags": ["Holidays"],
   "amount": -2
}

I can't seem to find this in the docs. How can I put this property correctly into the interface?

2

1 Answer 1

14

See TypeScript basic types:

export interface ITransaction {
  ...
  tags: string[]
  ...
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.