I want to know what is meaning of this is:
export type VSelect = VTextField & {
reset: () => void;
clearableCallback: () => void;
}
so I want to know meaning of this type specially reset: () => void
I want to know what is meaning of this is:
export type VSelect = VTextField & {
reset: () => void;
clearableCallback: () => void;
}
so I want to know meaning of this type specially reset: () => void
A type is declared this way:
export type TypeName = {
property1: type,
property1: type,
property1: type,
/** ... */
}
So here, () => void
is the type of a function
that doesn't have any parameter, and is returning void
.
So you can suppose that the reset
function is like that:
const reset = function (): void {
/** some code */
}
Hence, you can do the same way with whatever you like, eg:
const getUserById = function async (userId: string): Promise<User | null> {
/** some code */
}
export type UserService = {
getUserById: (userId: string) => Promise<User | null>
}