Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
stringifiable type with TS
export type Stringifiable = object | string | boolean | number | null;
export const stdMarker = 'gfy';
export const getJSONCanonical = function (v: Stringifiable, marker?: string) {
marker = marker || stdMarker;
return JSON.stringify({
[marker]: true,
value: v
getJSONCanonical(undefined); // no compilation error?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.