goodvibration
goodvibration

Reputation: 6206

What is wrong with this TypeScript declaration?

I'm declaring this:

export interface Interface {
    func: string[][] => string[][];
}

And I'm getting this:

error TS1005: ';' expected.

func: string[][] => string[][];
                 ~~

error TS1131: Property or signature expected.

func: string[][] => string[][];
                    ~~~~~~

error TS1011: An element access expression should take an argument.

func: string[][] => string[][];

error TS1011: An element access expression should take an argument.

func: string[][] => string[][];

error TS1128: Declaration or statement expected.

}
~

What is the correct syntax here?

Upvotes: 0

Views: 2596

Answers (1)

Andrey Mormysh
Andrey Mormysh

Reputation: 819

The arrow function '=>' creates an expression. An interface on another hand is a definition, so you would do it like so:

export interface Interface {
  func(arg: string[][]): string[][];
}

Upvotes: 2

Related Questions