Files
cal.diy/lib/event.ts
T
521be467a4 resolved typescript problems for success.tsx, useTheme.tsx and event.ts (#786)
* resolved typescript problems for success.tsx, useTheme.tsx and event.ts

* remove NextRouter inferred type

Co-authored-by: Alex Johansson <[email protected]>

* remove router query inferred type

Co-authored-by: Alex Johansson <[email protected]>

* URIcomponent change ternary

Co-authored-by: Alex Johansson <[email protected]>

* infer types for event type

* completed requested changes

* Update pages/success.tsx | change context type to proper

Co-authored-by: Alex Johansson <[email protected]>

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Alex Johansson <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
2021-10-05 23:53:24 +01:00

9 lines
337 B
TypeScript

export function getEventName(
name: string | string[] | undefined,
eventTitle: string,
eventNameTemplate: string | null
) {
if (!name || !(typeof name === "string")) name = ""; // If name is not set or is not of proper type
return eventNameTemplate ? eventNameTemplate.replace("{USER}", name) : eventTitle + " with " + name;
}