Home>
I have a simple interest, but I want to define something like a function with properties in TypeScript.
Is this possible in the first place?interface
could be defined as follows:
interface Hoge {
a: string;
(arg: string): void;
}
I'm having trouble understanding how to initialize.
const f: Hoge = (arg: string) =>{console.log (arg);};
// Property 'a' is missing in type '(arg: string) =>void' but required in type 'Hoge'.
I would be happy if you could tell me.
-
Answer # 1
Related articles
- typescript - how to create a function that returns a return value (return value) of a specific type (function that determines ou
- php - i want to create a function that passes two variables and returns a string
- ruby - i don't know how to create a group function with rails and register a new participant there
- php - create a function that has a dummy argument of array $arr and passes an array array(1, 3, 5, 7,7, 9) containing numerical
- typescript - error when initializing class properties with generics
- i want to create a function that passes php int type and string type and outputs string content of the number of times of that i
- [swiftui] i want to create a textfield with a search function
- php - how to create a function that displays the index and elements of an associative array of arguments
- php i want to create a function that keeps displaying randomly until a specific string is displayed
- cannot create a function that satisfies python max<x<min
- php - if boolean type is true, add 1 to int type also, if false, create a function that subtracts 1
- php - i want to create a task display/hide function using js
- python - i want to create a button with tkinter and call a function
- typescript - when i tried to create a nuxtjs environment with docker, i got an error saying cannot read file tsconfigjson
- i want to create a function that gets the date and time and displays it
- php - i want to create a slider and thumbnail function using swiperjs by linking it with a custom post
- why does typescript not recognize the valid map function in javascript?
- html - i want to create a function where the count is incremented by 1 when a button is pressed in django
- typescript function arguments
- create a graph in c ++ (when the applied function differs depending on the range)
Trends
Teached by kind experts and solved it!