Published
Edited
Sep 16, 2022
1 star
Insert cell
Insert cell
{
if (lastStatement === undefined) {
return undefined;
}

if (ts.isDeclaration(lastStatement)) {
return ts.getNameOfDeclaration(lastStatement).escapedText;
}

if (ts.isVariableStatement(lastStatement)) {
if (lastStatement.declarationList.declarations.length != 1) {
throw `Variable statement must have only one declaration but got ${lastStatement.declarationList.declarations.length}`
}
return lastStatement.declarationList.declarations[0].name.escapedText
}

return undefined;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more