UNPKG

@xlink-network/xlink-sdk

Version:
1 lines 1.03 kB
{"version":3,"sources":["../src/utils/typeHelpers.ts"],"sourcesContent":["export function isNotNull<T>(input: T | undefined | null): input is T {\n return input != null\n}\n\nexport function checkNever(_x: never): undefined {\n /* do nothing */\n return\n}\n\nexport type StringOnly<T> = Extract<T, string>\n\nexport type NumberOnly<T> = Extract<T, number>\n\nexport type OneOrMore<T> = readonly [T, ...T[]]\n\nexport type CompactType<T> = {\n [P in keyof T]: T[P]\n}\n\n/**\n * WARNING: This is a hack do type exhaustiveness check\n */\nexport function assertExclude<T, const E>(\n asserting: T,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n excluding: E,\n): asserts asserting is Exclude<T, E> {\n return\n}\nexport namespace assertExclude {\n export const i = <T>(): T => null as any\n}\n"],"mappings":";AAAO,SAAS,UAAa,OAAyC;AACpE,SAAO,SAAS;AAClB;AAEO,SAAS,WAAW,IAAsB;AAE/C;AACF;AAeO,SAAS,cACd,WAEA,WACoC;AACpC;AACF;AAAA,CACO,CAAUA,mBAAV;AACE,EAAMA,eAAA,IAAI,MAAY;AAAA,GADd;","names":["assertExclude"]}