Make anyArray.filter(Boolean) return any[], not unknown[] (#31515)

* Add this-parameter workaround to Array.filter

Allows anys.filter(Boolean) to once again return any[], not unknown[].

* Add any constraint to Boolean factory function

I want to test how well this works.

* Remove Boolean factory type guard

* Remove typeGuardBoolean test
This commit is contained in:
Nathan Shively-Sanders
2019-05-22 09:45:41 -07:00
committed by GitHub
parent 1e7a77cf78
commit b36c8a0690
9 changed files with 264 additions and 124 deletions

2
src/lib/es5.d.ts vendored
View File

@@ -513,7 +513,7 @@ interface Boolean {
interface BooleanConstructor {
new(value?: any): Boolean;
<T>(value?: T): value is Exclude<T, false | null | undefined | '' | 0>;
<T>(value?: T): boolean;
readonly prototype: Boolean;
}