function f([a,b,c]) {
// this works but a,b and c are any
}
it\'s possible write something like that?
function f([a: number,b: nu
my code was something like below
type Node = {
start: string;
end: string;
level: number;
};
const getNodesAndCounts = () => {
const nodes : Node[];
const counts: number[];
// ... code here
return [nodes, counts];
}
const [nodes, counts] = getNodesAndCounts(); // problematic line needed type
typescript was giving me error in line below TS2349: Cannot invoke an expression whose type lacks a call signature;
nodes.map(x => {
//some mapping;
return x;
);
Changing line to below resolved my problem;
const [nodes, counts] = getNodesAndCounts();