If I have an array a
where each element is an object consisting of two properties first
and second
, how should I declare `a\'s type su
If you want an array where first will always have the same type, this will do
interface IArrayGeneric {
first: T;
second: (arg: T) => string;
}
const a: Array>;
This will ensure that you can't put any object into a
that doesn't satisfy the above requirements, but will also constrain T
to one specific type
you choose.