Arun R
Arun R

Reputation: 23

Angular 2/4 interface declaration concern

I find out that in angular, we have to declare an interface before processing with a JSON data from a server. Its okay with a small json structure but let's assume we have a large json file with a hundred of key-value pair I think its difficult to create an exact interface in our app.

What is the solution for this?

Upvotes: 0

Views: 49

Answers (1)

Udi Mazor
Udi Mazor

Reputation: 1826

You don't must to create an Interface. You want to create an interface so you can enjoy the benefits of a strongly-typed language (typescript).

You can just use "any" instead but you'll still have to remember the elements of the "json" in order to access its values.

Upvotes: 1

Related Questions