Angular « Różności …

Różności …

25 marca 2021

Angular tuple type, arrays

Zaszufladkowany do: Angular — Jacek @ 09:06

I’m really confused about this now. I’m pretty sure that

let x:SomeType[] = []

is equivalent to

let x: Array<SomeType> = []

but is

let x:[SomeType] = []

also equivalent and correct?

asked Aug 28 ’20 at 0:13
Michael Dausmann

3,41822 gold badges2626 silver badges3838 bronze badges

2 Answers

10

No. [SomeType] represents a tuple type, i.e., an array with exactly one element of SomeType

[string, number], for example, would match an array like ["test", 0]

source:

https://stackoverflow.com/questions/63625736/is-interface-a-valid-array-definition-in-typescript

29 grudnia 2020

Ubuntu post install

Zaszufladkowany do: Angular,JavaScript,Linux,Programowanie,React — Jacek @ 08:23
sudo apt-get update
sudo apt-get install build-essential

Strona startowa: www.jaceksen.pl