I am currently learning Typescript and still navigating my way through it. I have extensively searched for a solution to the issue I am facing, but couldn't find one, hence I am seeking help here. The problem lies in a SyntaxError at the interface name, and I am unsure of how to resolve it. Below is a snippet of my code:
interface Cars {
name:string
model:string
topSpeed:number
colors:string[]
speedPrint(carSpeed:number):void
}
class BMW implements Cars{
name = 'BMW X6'
model = 'S'
topSpeed = 320
colors = ['cobalt red','phantom blue','white']
speedPrint(topSpeed:number):void{
console.log(`My car top speed is ${topSpeed}`)
}
}
and this is the error:
app.ts:1
interface Cars {
^^^^
SyntaxError: Unexpected identifier
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47