Ryan Cavanaugh
Ryan Cavanaugh
@typescript-bot pack this
`!expr` isn't considered a truthiness position today. Maybe for this check in particular it would make sense to generalize it to all boolean coercions
Gonna find all the bad code now, I think @typescript-bot test it
Collated breaks Clearly intentional, albeit weird: ```ts optimizeNodes(): this | undefined { return `${this.code}` ? this : undefined } ``` Very good find -- catching an operator precedence bug. The...
@arcanis it really sounds like you want nominal types (#202), since even if regex types existed, you'd still want the library consumer to go through the validator functions?
```ts type Unfunction = T & { call: null; apply: null; bind: null; } function getUnfunction(callableObject: T): Unfunction { Object.setPrototypeOf(callableObject, null); return callableObject as Unfunction; } let callableObject = getUnfunction(()...
You could also use `never` in place of `null`
`Exclude` gives the possibility to remove something from a union, and conditional types do some other good stuff. For cases of actual subtype exclusion, the possibility of aliasing makes this...
> simply with a check that prevents people from committing the aliasing mistake you described? What mistake?
What you're describing is just the `ButNot` type above, but with the `?` removed