import { createContext } from 'react' ; export template T param { ( ... args : any ) => T } useFunc param { ( T | undefined ) } initialData returns export const getServiceToken = < T > ( useFunc , initialData = undefined ) => { return createContext ( initialData as T ) ; } ;