-
Notifications
You must be signed in to change notification settings - Fork 30.5k
feat: Add call‑bind
#50541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
weswigham
merged 1 commit into
DefinitelyTyped:master
from
ExE-Boss:types/call-bind/v1.0
Jan 12, 2021
Merged
feat: Add call‑bind
#50541
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import './test/callBind.test'; | ||
| import './test/callBound.test'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // This is necessary to disallow import of `call-bind/callBound.js`: | ||
| // tslint:disable-next-line: no-declare-current-package no-single-declare-module | ||
| declare module 'call-bind/callBound' { | ||
| import type { Intrinsics } from 'get-intrinsic'; | ||
|
|
||
| type PrependThisParameter<T> = T extends (...args: infer A) => infer R | ||
| ? (thisArg: ThisParameterType<T>, ...args: A) => R | ||
| : T; | ||
|
|
||
| export = callBoundIntrinsic; | ||
|
|
||
| function callBoundIntrinsic<K extends keyof Intrinsics>( | ||
| name: K, | ||
| allowMissing?: false, | ||
| ): PrependThisParameter<Intrinsics[K]>; | ||
| function callBoundIntrinsic<K extends keyof Intrinsics>( | ||
| name: K, | ||
| allowMissing?: boolean, | ||
| ): PrependThisParameter<Intrinsics[K]> | undefined; | ||
| function callBoundIntrinsic(name: string, allowMissing?: boolean): any; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| // Type definitions for call-bind 1.0 | ||
| // Project: https://github.com/ljharb/call-bind#readme | ||
| // Definitions by: Jordan Harband <https://github.com/ljharb> | ||
| // ExE Boss <https://github.com/ExE-Boss> | ||
| // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
| // TypeScript Version: 3.9 | ||
|
|
||
| // This is necessary to disallow import of `call-bind/index` or `call-bind/index.js`: | ||
| // tslint:disable-next-line: no-declare-current-package no-single-declare-module | ||
| declare module 'call-bind' { | ||
| export = callBind; | ||
|
|
||
| /** | ||
| * For a given function, creates a bound function that has the same body as the original function. | ||
| * The this object of the bound function is associated with the specified object, and has the specified initial parameters. | ||
| * | ||
| * Equivalent to: | ||
| * ```js | ||
| * Function.prototype.call.bind(target, ...) | ||
| * ``` | ||
| * | ||
| * @param target The function to be used as the this object for `Function.prototype.call`. | ||
| * @param args Arguments to bind to the parameters of the function. | ||
| */ | ||
| function callBind<T, A extends readonly unknown[], R>( | ||
| target: (this: T, ...args: A) => R, | ||
| ): (thisArg: T, ...args: A) => R; | ||
| function callBind<T, A extends readonly unknown[], R>( | ||
| target: (this: T, ...args: A) => R, | ||
| thisArg: T, | ||
| ): (...args: A) => R; | ||
| function callBind<T, AX extends readonly unknown[], A extends readonly unknown[], R>( | ||
| originalFunction: (this: T, ...args: readonly [...bound: AX, ...args: A]) => R, | ||
| thisArg: T, | ||
| ...bound: AX | ||
| ): (...args: A) => R; | ||
|
|
||
| namespace callBind { | ||
| /** | ||
| * For a given function, creates a bound function that has the same body as the original function. | ||
| * The this object of the bound function is associated with the specified object, and has the specified initial parameters. | ||
| * | ||
| * Equivalent to: | ||
| * ```js | ||
| * Function.prototype.apply.bind(target, ...) | ||
| * ``` | ||
| * | ||
| * @param target The function to be used as the this object for `Function.prototype.apply`. | ||
| * @param args Arguments to bind to the parameters of the function. | ||
| */ | ||
| function apply<T, A extends readonly unknown[], R>( | ||
| target: (this: T, ...args: A) => R, | ||
| ): (thisArg: T, args: Readonly<A>) => R; | ||
| function apply<T, A extends readonly unknown[], R>( | ||
| target: (this: T, ...args: A) => R, | ||
| thisArg: T, | ||
| ): (args: Readonly<A>) => R; | ||
| function apply<T, A1 extends readonly unknown[], A2 extends readonly unknown[], R>( | ||
| originalFunction: (this: T, ...args: readonly [...A1, ...A2]) => R, | ||
| thisArg: T, | ||
| ...args: A1 | ||
| ): (args: Readonly<A2>) => R; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "private": true, | ||
| "types": "index", | ||
| "typesVersions": { | ||
| "<=3.9": { "*": ["ts3.9/*"] } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import callBind = require('call-bind'); | ||
| import { apply as applyBind } from 'call-bind'; | ||
|
|
||
| declare const any: unknown; | ||
|
|
||
| callBind(() => {}); // $ExpectType (thisArg: unknown) => void | ||
| callBind((a: string, b: number) => {}, null, 'foo'); // $ExpectType (b: number) => void | ||
|
|
||
| // $ExpectType (thisArg: unknown, v: string | number | symbol) => boolean || (thisArg: unknown, v: PropertyKey) => boolean | ||
| callBind(Object.prototype.hasOwnProperty); | ||
| // $ExpectType (v: string | number | symbol) => boolean || (v: PropertyKey) => boolean | ||
| callBind(Object.prototype.hasOwnProperty, any); | ||
|
|
||
| applyBind(() => {}); // $ExpectType (thisArg: unknown, args: readonly []) => void | ||
| applyBind((a: string, b: number) => {}, null, 'foo'); // $ExpectType (args: readonly [b: number]) => void | ||
|
|
||
| // $ExpectType (thisArg: unknown, args: readonly [v: string | number | symbol]) => boolean || (thisArg: unknown, args: readonly [v: PropertyKey]) => boolean | ||
| applyBind(Object.prototype.hasOwnProperty); | ||
| // $ExpectType (args: readonly [v: string | number | symbol]) => boolean || (args: readonly [v: PropertyKey]) => boolean | ||
| applyBind(Object.prototype.hasOwnProperty, any); | ||
|
|
||
| // These are invalid because of `package.json#exports`: | ||
| import callBindIllegal1 = require('call-bind/index'); // $ExpectError | ||
| import callBindIllegal2 = require('call-bind/index.js'); // $ExpectError | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import callBound = require('call-bind/callBound'); | ||
|
|
||
| callBound('%ArrayProto_keys%'); // $ExpectType (thisArg: unknown) => IterableIterator<number> | ||
| callBound('%ArrayProto_values%'); // $ExpectType (thisArg: unknown) => IterableIterator<any> | ||
| callBound('%ArrayProto_entries%'); // $ExpectType (thisArg: unknown) => IterableIterator<[number, any]> | ||
| callBound('%ArrayProto_forEach%'); // $ExpectType (thisArg: unknown, callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any) => void | ||
|
|
||
| callBound('%ObjProto_toString%'); // $ExpectType (thisArg: unknown) => string | ||
| callBound('%ObjProto_valueOf%'); // $ExpectType (thisArg: unknown) => Object | ||
|
|
||
| // $ExpectType (thisArg: unknown, onfulfilled?: ((value: any) => unknown) | null | undefined, onrejected?: ((reason: any) => unknown) | null | undefined) => Promise<unknown> | ||
| callBound('%PromiseProto_then%'); | ||
|
|
||
| // Dotted intrinsic: | ||
| // $ExpectType (thisArg: unknown, v: string | number | symbol) => boolean || (thisArg: unknown, v: PropertyKey) => boolean | ||
| callBound('%Object.prototype.hasOwnProperty%'); | ||
|
|
||
| // These are invalid because of `package.json#exports`: | ||
| import callBoundIllegal1 = require('call-bind/callBound.js'); // $ExpectError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import './test/callBind.test'; | ||
| import './test/callBound.test'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| // This is necessary to disallow import of `call-bind/index` or `call-bind/index.js`: | ||
| // tslint:disable-next-line: no-declare-current-package no-single-declare-module | ||
| declare module 'call-bind' { | ||
| export = callBind; | ||
|
|
||
| /** | ||
| * For a given function, creates a bound function that has the same body as the original function. | ||
| * The this object of the bound function is associated with the specified object, and has the specified initial parameters. | ||
| * | ||
| * Equivalent to: | ||
| * ```js | ||
| * Function.prototype.call.bind(target, ...) | ||
| * ``` | ||
| * | ||
| * @param target The function to be used as the this object for `Function.prototype.call`. | ||
| * @param args Arguments to bind to the parameters of the function. | ||
| */ | ||
| function callBind<T, A extends readonly unknown[], R>( | ||
| target: (this: T, ...args: A) => R, | ||
| ): (thisArg: T, ...args: A) => R; | ||
| function callBind<T, A extends readonly unknown[], R>( | ||
| target: (this: T, ...args: A) => R, | ||
| thisArg: T, | ||
| ): (...args: A) => R; | ||
| function callBind<T, A0, A extends readonly unknown[], R>( | ||
| target: (this: T, arg0: A0, ...args: A) => R, | ||
| thisArg: T, | ||
| arg0: A0, | ||
| ): (...args: A) => R; | ||
| function callBind<T, A0, A1, A extends readonly unknown[], R>( | ||
| target: (this: T, arg0: A0, arg1: A1, ...args: A) => R, | ||
| thisArg: T, | ||
| arg0: A0, | ||
| arg1: A1, | ||
| ): (...args: A) => R; | ||
| function callBind<T, A0, A1, A2, A extends readonly unknown[], R>( | ||
| target: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, | ||
| thisArg: T, | ||
| arg0: A0, | ||
| arg1: A1, | ||
| arg2: A2, | ||
| ): (...args: A) => R; | ||
| function callBind<T, A0, A1, A2, A3, A extends readonly unknown[], R>( | ||
| target: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, | ||
| thisArg: T, | ||
| arg0: A0, | ||
| arg1: A1, | ||
| arg2: A2, | ||
| arg3: A3, | ||
| ): (...args: A) => R; | ||
| function callBind<T, AX, R>( | ||
| target: (this: T, ...args: readonly AX[]) => R, | ||
| thisArg: T, | ||
| ...args: readonly AX[] | ||
| ): (...args: readonly AX[]) => R; | ||
|
|
||
| // tslint:disable-next-line: ban-types | ||
| function callBind<F extends Function>( | ||
| target: F, | ||
| ): ( | ||
| thisArg: ThisParameterType<F>, | ||
| ...args: F extends (...args: infer A) => any ? A : readonly unknown[] | ||
| ) => F extends (...args: any) => infer R ? R : any; | ||
|
|
||
| // tslint:disable-next-line: ban-types | ||
| function callBind<F extends Function>( | ||
| target: F, | ||
| thisArg: ThisParameterType<F>, | ||
| ): ( | ||
| ...args: F extends (...args: infer A) => any ? A : readonly unknown[] | ||
| ) => F extends (...args: any) => infer R ? R : any; | ||
|
|
||
| // tslint:disable-next-line: ban-types | ||
| function callBind<F extends Function>( | ||
| target: F, | ||
| thisArg: ThisParameterType<F>, | ||
| ...args: readonly unknown[] | ||
| ): (...args: readonly unknown[]) => F extends (...args: any) => infer R ? R : any; | ||
|
|
||
| namespace callBind { | ||
| /** | ||
| * For a given function, creates a bound function that has the same body as the original function. | ||
| * The this object of the bound function is associated with the specified object, and has the specified initial parameters. | ||
| * | ||
| * Equivalent to: | ||
| * ```js | ||
| * Function.prototype.apply.bind(target, ...) | ||
| * ``` | ||
| * | ||
| * @param target The function to be used as the this object for `Function.prototype.apply`. | ||
| * @param args Arguments to bind to the parameters of the function. | ||
| */ | ||
| function apply<T, A extends readonly unknown[], R>( | ||
| target: (this: T, ...args: A) => R, | ||
| ): (thisArg: T, args: Readonly<A>) => R; | ||
| function apply<T, A extends readonly unknown[], R>( | ||
| target: (this: T, ...args: A) => R, | ||
| thisArg: T, | ||
| ): (args: Readonly<A>) => R; | ||
| function apply<T, A0, A extends readonly unknown[], R>( | ||
| target: (this: T, arg0: A0, ...args: A) => R, | ||
| thisArg: T, | ||
| arg0: A0, | ||
| ): (args: Readonly<A>) => R; | ||
| function apply<T, A0, A1, A extends readonly unknown[], R>( | ||
| target: (this: T, arg0: A0, arg1: A1, ...args: A) => R, | ||
| thisArg: T, | ||
| arg0: A0, | ||
| arg1: A1, | ||
| ): (args: Readonly<A>) => R; | ||
| function apply<T, A0, A1, A2, A extends readonly unknown[], R>( | ||
| target: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, | ||
| thisArg: T, | ||
| arg0: A0, | ||
| arg1: A1, | ||
| arg2: A2, | ||
| ): (args: Readonly<A>) => R; | ||
| function apply<T, A0, A1, A2, A3, A extends readonly unknown[], R>( | ||
| target: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, | ||
| thisArg: T, | ||
| arg0: A0, | ||
| arg1: A1, | ||
| arg2: A2, | ||
| arg3: A3, | ||
| ): (args: Readonly<A>) => R; | ||
| function apply<T, AX, R>( | ||
| target: (this: T, ...args: readonly AX[]) => R, | ||
| thisArg: T, | ||
| ...args: readonly AX[] | ||
| ): (args: readonly AX[]) => R; | ||
|
|
||
| // tslint:disable-next-line: ban-types | ||
| function apply<F extends Function>( | ||
| target: F, | ||
| ): ( | ||
| thisArg: ThisParameterType<F>, | ||
| args: F extends (...args: infer A) => any ? Readonly<A> : readonly unknown[], | ||
| ) => F extends (...args: any) => infer R ? R : any; | ||
|
|
||
| // tslint:disable-next-line: ban-types | ||
| function apply<F extends Function>( | ||
| target: F, | ||
| thisArg: ThisParameterType<F>, | ||
| ): ( | ||
| args: F extends (...args: infer A) => any ? Readonly<A> : readonly unknown[], | ||
| ) => F extends (...args: any) => infer R ? R : any; | ||
|
|
||
| // tslint:disable-next-line: ban-types | ||
| function apply<F extends Function>( | ||
| target: F, | ||
| thisArg: ThisParameterType<F>, | ||
| ...args: readonly unknown[] | ||
| ): (args: ArrayLike<unknown>) => F extends (...args: any) => infer R ? R : any; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import callBind = require('call-bind'); | ||
| import { apply as applyBind } from 'call-bind'; | ||
|
|
||
| declare const any: unknown; | ||
|
|
||
| callBind(() => {}); // $ExpectType (thisArg: unknown) => void | ||
| callBind((a: string, b: number) => {}, null, 'foo'); // $ExpectType (b: number) => void | ||
| callBind(Object.prototype.hasOwnProperty); // $ExpectType (thisArg: unknown, v: string | number | symbol) => boolean | ||
| callBind(Object.prototype.hasOwnProperty, any); // $ExpectType (v: string | number | symbol) => boolean | ||
|
|
||
| applyBind(() => {}); // $ExpectType (thisArg: unknown, args: readonly []) => void | ||
| applyBind((a: string, b: number) => {}, null, 'foo'); // $ExpectType (args: readonly [number]) => void | ||
| applyBind(Object.prototype.hasOwnProperty); // $ExpectType (thisArg: unknown, args: readonly [string | number | symbol]) => boolean | ||
| applyBind(Object.prototype.hasOwnProperty, any); // $ExpectType (args: readonly [string | number | symbol]) => boolean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import callBound = require('call-bind/callBound'); | ||
|
|
||
| callBound('%ArrayProto_keys%'); // $ExpectType (thisArg: unknown) => IterableIterator<number> | ||
| callBound('%ArrayProto_values%'); // $ExpectType (thisArg: unknown) => IterableIterator<any> | ||
| callBound('%ArrayProto_entries%'); // $ExpectType (thisArg: unknown) => IterableIterator<[number, any]> | ||
| callBound('%ArrayProto_forEach%'); // $ExpectType (thisArg: unknown, callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any) => void | ||
|
|
||
| callBound('%ObjProto_toString%'); // $ExpectType (thisArg: unknown) => string | ||
| callBound('%ObjProto_valueOf%'); // $ExpectType (thisArg: unknown) => Object | ||
|
|
||
| // $ExpectType (thisArg: unknown, onfulfilled?: ((value: any) => unknown) | null | undefined, onrejected?: ((reason: any) => unknown) | null | undefined) => Promise<unknown> | ||
| callBound('%PromiseProto_then%'); | ||
|
|
||
| // Dotted intrinsic: | ||
| // $ExpectType (thisArg: unknown, v: string | number | symbol) => boolean | ||
| callBound('%Object.prototype.hasOwnProperty%'); | ||
|
|
||
| // These are invalid because of `package.json#exports`: | ||
| import callBoundIllegal1 = require('call-bind/callBound.js'); // $ExpectError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "module": "commonjs", | ||
| "lib": ["ESNext"], | ||
| "noImplicitAny": true, | ||
| "noImplicitThis": true, | ||
| "strictFunctionTypes": true, | ||
| "strictNullChecks": true, | ||
| "baseUrl": "../../", | ||
| "typeRoots": ["../../"], | ||
| "types": [], | ||
| "noEmit": true, | ||
| "forceConsistentCasingInFileNames": true | ||
| }, | ||
| "files": [ | ||
| "call-bind-tests.ts", | ||
| "index.d.ts" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| { "extends": "dtslint/dt.json" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "module": "commonjs", | ||
| "lib": ["ESNext"], | ||
| "noImplicitAny": true, | ||
| "noImplicitThis": true, | ||
| "strictFunctionTypes": true, | ||
| "strictNullChecks": true, | ||
| "baseUrl": "../", | ||
| "typeRoots": ["../"], | ||
| "types": [], | ||
| "noEmit": true, | ||
| "forceConsistentCasingInFileNames": true | ||
| }, | ||
| "files": [ | ||
| "call-bind-tests.ts", | ||
| "index.d.ts" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| { "extends": "dtslint/dt.json" } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this instead of just using
unknowndirectly?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
unknownonly refers to a type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha, so it could be named anything then. i was just confused by the name
anyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree,
anyis a super confusing name for a value of typeunknown. Maybe tryunknown?