I just learned TS. When I was writing test code, when I needed to create an instance: the following problem occurred, which was a bit blurry
#The specific implementation class part of the function module is as follows
淡淡烟草味2017-06-26 11:00:02
18 and 19 are type definitions. There is no need to construct such a type in your test code. You only need to pass a correct parameter when instance alarm
(and the type of the parameter is the definition of 18 and 19. According to this The definition requires passing parameters).
某草草2017-06-26 11:00:02
getAlarmConfig
and alarmOutput
are the definitions of two types, which can be understood as function signatures, not specific implementations.
What you need to do in lines 18 and 19 should be the implementation of these two types,
As long as they comply Signature can be implemented in any way,
For example
const alarmOutput: alarmOutput = (msg) => {}
const getAlarmConfig: getAlarmConfig = (id) => new Promise((resolve) => resolve([]));
PS: It is best not to name the implementation object the same as the type definition