Lazar Ljubenović
Lazar Ljubenović
For a majority of usecases, the following types are treated as equal: ```ts interface Type1 { x?: number } interface Type2 { x: number | undefined } ``` The difference...
Instead of writing `tg.throwIf(tg.isNot(tg.isString))`, it would be nicer to write `tg.throwUnless(tg.isString)`.
https://stackoverflow.com/questions/18884249/checking-whether-something-is-iterable
From [here](https://devblogs.microsoft.com/typescript/announcing-typescript-3-7-beta/): > ```ts > function assertIsString(val: any): asserts val is string { > if (typeof val !== "string") { > throw new AssertionError("Not a string!"); > } > }...
```ts const isMorphRuleOfType = (type: TMorphType) => { return (rule: MorphRuleBase): rule is MorphRuleBase => { return rule.type === type } } ``` Think of a way to quickly create...
Instead of writing ```ts export const isLanguageCode = tg.isEnum(...enumValues(LanguageCode)) ``` where `enumValues` is a function defied as follows ```ts export function enumValues (enumeration: T): Array { return objectKeys(enumeration) .filter(k =>...
The lib currently exports `Guard` with only one generic argument: `(x: any) => x is T`, but I found that in code I often need `(x: V) => x is...
I think it's not gonna be straightforward at all to cover all cases with overloads. But it should at least work nicely with most of the guards. I'm not even...
- Open issue first for big changes to discuss it. - How to run tests. - How to format commit message.