Using a type that defines a function type with generics, causes the "Method expression is not of Function type" error. Defining a function type directly will cause the error to go away.
export type FN_type<O> = (arg:object)=>O
export type output_type = string
export function my_fn<O>(out:O):FN_type<O> {
return (arg:object)=>out
}
export const my_str:FN_type<string> = my_fn('my string')
The following will have a "Method expression is not of Function type" error.
<script lang=ts>
const fn = my_str({})
</script>
If the my_str type is defined directly as a Function, then there is no error.
export type FN_type<O> = (arg:object)=>O
export type output_type = string
export function my_fn<O>(out:O):FN_type<O> {
return (arg:object)=>out
}
export const my_str:(arg:object)=>string = my_fn('my string')
Using a type that defines a function type with generics, causes the "Method expression is not of Function type" error. Defining a function type directly will cause the error to go away.
The following will have a "Method expression is not of Function type" error.
If the
my_str
type is defined directly as a Function, then there is no error.