I've created an interface called "IPerson" in new TypeScript file (.ts):
export interface IPerson {
firstName:string;
lastName:string;
age:number;
sayHi:()=> string;
}
when I try to import and create a new object in "test.ts" based on that interface:
import {IPerson} from './interfaces/person.interface';
let p1:IPerson = {
firstName:"Ali",
lastName:"Helmi",
age:35,
sayHi:()=>`Hi Ali`
}
After running this command in the terminal:
node test.js
I get this error:
SyntaxError: Unexpected token 'export' in typescript
Could you pleas help me find the error and fix it?
Thank you!