arrays


Creating an interface with an array of variable length, containing objects in TypeScript/Angular4


I am attempting to create a variable within an in-memory database that contains a TypeScript interface that describes a JSON dataset. This dataset should contain multiple arrays, which in turn contain multiple objects with a fixed length and consistent attributes.
I am writing this in Angular4 and TypeScript. The arrays must be of variable length with a minimum of 1 member
I've written this pseudo code to show you what I mean:
export class MyHomeBrewery {
taps: Array<any> = [{
id: number;
name: string;
type: string;
quantity: number;
}][...];
barrels: Array<any> {
id: number;
name: string;
width: number;
height: number;
quantity: number;
}][...];
I've had a look through the TypeScript and Angular documentation and done a few searches and I can't find the correct syntax for this. Does anyone know?
You should be using them as interfaces as below
export interface MyHomeBrewery {
taps: Array<Taps>;
barrels: Array<Barrels>;
}
export interface Taps {
id: number;
name: string;
type: string;
quantity: number;
}
export interface Barrels {
id : number;
name: string;
width: number;
height: number;
quantity: number;
}

Related Links

Find common and unique items between two arrays
Powershell, Start-Job is not Working. Without Start-job script is Ok
Correctness of algorithm to find maximum in array
Using smart pointers for array
Why another array is replaced in julia?
Cannot plot a 2D array using contourf()
Efficient way of doing numerical integration on a 2d array with variable integration length
Reshape in Fortran90
Using any array
How to pass array to nsuserdefaults and use them in a section in tableview
Extract value from const array in Z3
How do you use the buffer? [intel based assembly]
Is there a built-in function in MATLAB to get bsxfun(#rdivide,abs(X),sum(abs(X)))?
Array does not work on Powershell 2.0
Iterate through array of hashes in ANT script
To optimize use of memory is it required to clear Array Data

Categories

HOME
sql-server
numpy
fparsec
puppet
wms
automated-tests
histogrammar
java-home
google-classroom
eclipse-cdt
ndis
ssr
uiscrollview
gwtp
equalizer
aspell
propel2
cvs2svn
jconsole
scalaz7
logarithm
scalajs-react
rhandsontable
web-frontend
owl-api
xor
pyscripter
edb
spring-insight
superpowered
shibboleth
mms
bigcartel
freetts
stdclass
dojox.mobile
fastq
ideone
bnd
greenhills
udev
decompress
chrome-remote-desktop
tcserver
mcrypt
gmt
polar-coordinates
project-template
aescryptoserviceprovider
excon
gitweb
try-finally
gherkin
spring-repositories
dac
brackets-shell
web-essentials
galaxy
difference
hateoas
self-hosting
direct3d12
sourcegear-vault
datasnap
android-snackbar
google-hadoop
ember-cli-addons
custom-url
multipleselection
orientation-changes
gmaps4rails
x-ua-compatible
firebug-lite
funq
humanizer
io.js
funkload
ssms-addin
ifft
wic
bigint
.net-cf-3.5
astyanax
execvp
dynamic-binding
swrl
backbone-relational
client-library
icsharpcode
lync-server-2010
attachevent
pitch
usn
deploying
macruby
responsetext
maven-ant-tasks
wchar
testunit
windows-live-id
pureftpd
svn-hooks
hadoop-plugins
sitemappath
file-encodings
revision
kpi

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App