Within my main.ts file, I've included the following code snippet :
interface bodyInfos {
height?: any;
mass?: any;
}
const calculateBmi = (user: bodyInfos) => {
return user.mass / ( user.height ** 2 );
};
let foo: bodyInfos;
let bar: bodyInfos;
// Foo
foo.height = 172;
foo.mass = 75;
// Bar
bar.height = 180;
bar.mass = 90;
console.log('foo BMI', calculateBmi(foo) );
console.log('bar BMI', calculateBmi(bar) );
Whenever I attempt to run the main.ts file using the command: node main.ts, an error pops up in the console displaying:
interface bodyInfos {
^^^^^^^^
SyntaxError: Unexpected identifier
I'm reaching out for your assistance, please.