#Can the function keyword be used within a `type`?

5 messages · Page 1 of 1 (latest)

sand yoke
#

This gives an error:

type ContentCallback = function ($dialogElementBody: string): void;

This doesn't:

type ContentCallback = ($dialogElementBody: string) => void;

Is that just the way it is; can type only use arrow syntax?

floral loom
#
type ContentCallback = {
    ($dialogElementBody: string): void
}
#

If you aren't typing this, it's the same as an arrow function though.

wraith umbra
#

Yeah, functions are either method syntax or arrow syntax, not function keyword syntax.

sand yoke
#

oh, right. Thank you