Skip to content

Instantly share code, notes, and snippets.

@eczn
Last active July 20, 2021 10:08
Show Gist options
  • Select an option

  • Save eczn/aee18241d3ad74cef7ef6e9b87a96bf7 to your computer and use it in GitHub Desktop.

Select an option

Save eczn/aee18241d3ad74cef7ef6e9b87a96bf7 to your computer and use it in GitHub Desktop.
函数逆变
class I1 { a: number = 11 };
class I2 { b: number = 11 };

type K1 = (k: I1) => void;
type K2 = (k: I2) => void;

type K1K2 = K1 | K2;
declare const fn: K1K2;

type ARG = K1K2 extends (arg: infer A) => void ? A : never;
// ARG = I1 & I2

函数逆变

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment