symToStr
Get the name of a symbol as typed string.
import { symToStr } from "tsafe/symToStr";
declare const foo: any;
//str is of type "foo" and str === "foo"
const str = symToStr({ foo });Without symToStr
symToStrexport const myFunctionX = () => {};
export const name = "myFunctionX";With symToStr
symToStrimport { symToStr } from "tsafe/symToStr";
export const myFunctionX = () => {};
export const name = symToStr({ myFunctionX });
// ^name is of type "myFunctionX"Last updated
Was this helpful?